|
|
@@ -13,6 +13,7 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.organization.entity.UserRoleRelation;
|
|
|
import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
|
|
|
import com.xjrsoft.module.system.dto.MenuTreeDto;
|
|
|
+import com.xjrsoft.module.system.dto.RoleMenuServeListDto;
|
|
|
import com.xjrsoft.module.system.dto.SaveRoleXjrMenuQuickDto;
|
|
|
import com.xjrsoft.module.system.entity.Authorize;
|
|
|
import com.xjrsoft.module.system.entity.Menu;
|
|
|
@@ -70,7 +71,7 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|
|
* 查询角色菜单服务
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<MenuServeVo> getRoleMenuServe(SaveRoleXjrMenuQuickDto dto) {
|
|
|
+ public List<MenuServeVo> getRoleMenuServe(RoleMenuServeListDto dto) {
|
|
|
// 获取角色菜单
|
|
|
List<MenuVo> menuVos = getAuthMenuByRoleIds(new ArrayList<Long>() {{
|
|
|
add(dto.getRoleId());
|
|
|
@@ -107,6 +108,7 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|
|
.eq(XjrMenuQuick::getUserId, userId)
|
|
|
.selectAs(XjrMenuQuick::getSystemId, Menu::getSystemId)
|
|
|
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty())));
|
|
|
+ // 取角色菜单
|
|
|
if (menus.size() == 0) {
|
|
|
List<Long> roleIds = getUserRoleIds();
|
|
|
menus = this.selectJoinList(Menu.class,
|
|
|
@@ -115,6 +117,8 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|
|
.in(XjrMenuQuick::getRoleId,roleIds)
|
|
|
.selectAs(XjrMenuQuick::getSystemId, Menu::getSystemId)
|
|
|
.select(Menu.class, x -> VoToColumnUtil.fieldsToColumns(MenuListVo.class).contains(x.getProperty())));
|
|
|
+ // 去重
|
|
|
+ menus = menus.stream().distinct().collect(Collectors.toList());
|
|
|
}
|
|
|
return menus;
|
|
|
}
|
|
|
@@ -206,12 +210,12 @@ public class MenuServiceImpl extends MPJBaseServiceImpl<MenuMapper, Menu> implem
|
|
|
|
|
|
if (!StrUtil.isEmptyIfStr(parentId) || !StrUtil.equals(String.valueOf(parentId), String.valueOf(GlobalConstant.FIRST_NODE_VALUE))) {
|
|
|
// 给每条数据设置子系统信息
|
|
|
- menuVos.stream().filter(x -> StrUtil.equals(x.getId().toString(), String.valueOf(parentId)))
|
|
|
- .findAny()
|
|
|
- .ifPresent(parentNode -> {
|
|
|
- node.setSystemId(parentNode.getSystemId());
|
|
|
- node.setSystemName(parentNode.getSystemName());
|
|
|
- });
|
|
|
+// menuVos.stream().filter(x -> StrUtil.equals(x.getId().toString(), String.valueOf(parentId)))
|
|
|
+// .findAny()
|
|
|
+// .ifPresent(parentNode -> {
|
|
|
+// node.setSystemId(parentNode.getSystemId());
|
|
|
+// node.setSystemName(parentNode.getSystemName());
|
|
|
+// });
|
|
|
Long number = menuVos.stream().filter(x -> x.getParentId().equals(node.getId())).count();
|
|
|
if (number == 0) {
|
|
|
childMenus.add(node);
|