Quellcode durchsuchen

菜单配置调整

dzx vor 4 Wochen
Ursprung
Commit
febd910f5a

+ 2 - 0
src/main/java/com/xjrsoft/module/system/controller/XjrMenuGroupSetController.java

@@ -108,6 +108,8 @@ public class XjrMenuGroupSetController {
     @ApiOperation(value = "查询学生菜单")
     @SaCheckPermission("xjrmenugroupset:detail")
     public RT<List<XjrMenuGroupMenuListVo>> menuList(@Valid XjrMenuGroupMenuListDto dto){
+        XjrMenuGroupSet groupSet = xjrMenuGroupSetService.getById(dto.getXjrMenuGroupSetId());
+        dto.setRoleId(groupSet.getRoleId());
         return RT.ok(xjrMenuGroupSetService.getMenuList(dto));
     }
 

+ 3 - 0
src/main/java/com/xjrsoft/module/system/dto/XjrMenuGroupMenuListDto.java

@@ -18,4 +18,7 @@ public class XjrMenuGroupMenuListDto extends PageInput {
 
     @ApiModelProperty("功能分类设置id")
     private Long xjrMenuGroupSetId;
+
+    @ApiModelProperty("角色id")
+    private Long roleId;
 }

+ 9 - 4
src/main/resources/mapper/system/XjrMenuGroupMapper.xml

@@ -4,13 +4,18 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xjrsoft.module.system.mapper.XjrMenuGroupMapper">
     <select id="getMenuList" parameterType="com.xjrsoft.module.system.dto.XjrMenuGroupMenuListDto" resultType="com.xjrsoft.module.system.vo.XjrMenuGroupMenuListVo">
-        SELECT id, name,(
+        SELECT id, NAME,(
             SELECT COUNT(*) FROM xjr_menu_group WHERE delete_mark = 0 AND xjr_menu_group_set_id = #{dto.xjrMenuGroupSetId}
             AND xjr_menu_id = xjr_menu.id
         ) AS is_selected,
-            (SELECT COUNT(*) FROM xjr_menu_group WHERE delete_mark = 0 AND xjr_menu_group_set_id != #{dto.xjrMenuGroupSetId}
-                                                                AND xjr_menu_id = xjr_menu.id) as is_used FROM xjr_menu WHERE system_id = 1726806691140907010
+        (
+            SELECT COUNT(*) FROM xjr_menu_group a1
+            INNER JOIN xjr_menu_group_set a2 ON a1.xjr_menu_group_set_id = a2.id
+            WHERE a1.delete_mark = 0 AND a2.id != #{dto.xjrMenuGroupSetId} AND a2.role_id = #{dto.roleId}
+            AND a2.delete_mark = 0
+            AND a1.xjr_menu_id = xjr_menu.id
+        ) AS is_used FROM xjr_menu WHERE system_id = 1726806691140907010
         AND delete_mark = 0 AND enabled_mark = 1
-        and system_type = 'system_app'
+        AND system_type = 'system_app'
     </select>
 </mapper>