Browse Source

修改角色单角色查询

zhangxin 4 ngày trước cách đây
mục cha
commit
129985635e

+ 30 - 12
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppInstructorMapper.xml

@@ -36,12 +36,14 @@
         <result property="certificateInnocence" column="certificate_innocence"/>
         <result property="healthy" column="healthy"/>
         <result property="honorList" column="honor"/>
-        <collection property="selecteddeparts" ofType="java.lang.String" javaType="java.util.List">
-            <result column="deptId" />
-        </collection>
-        <collection property="selectedroles" ofType="java.lang.String" javaType="java.util.List">
-            <result  column="roleId" />
-        </collection>
+        <result property="selecteddeparts" column="selecteddeparts"/>
+        <result property="selectedroles" column="selectedroles"/>
+<!--        <collection property="selecteddeparts" ofType="java.lang.String" javaType="java.util.List">-->
+<!--            <result column="deptId" />-->
+<!--        </collection>-->
+<!--        <collection property="selectedroles" ofType="java.lang.String" javaType="java.util.List">-->
+<!--            <result  column="roleId" />-->
+<!--        </collection>-->
 <!--        <collection property="selecteddepartsList"-->
 <!--                column="staffId"-->
 <!--        select="selectDeptIdsByUserId"-->
@@ -134,12 +136,28 @@
         ORDER BY a.create_time DESC
     </select>
     <select id="findByStaffId"  resultMap="staffVOResult">
-        select a.id as staffId,b.id as instructorId,a.username,a.realname,a.status,null as password,b.training_programs,b.teaching_philosophy,b.excel_msg,a.certificate_innocence,a.healthy,a.honor,b.background_img
-        ,c.dep_id as deptId,d.role_id as roleId
-        from sys_user a
-        left join nm_instructor b on a.id =b.user_id and b.del_flag=0
-        left join sys_user_depart c on a.id = c.user_id
-        left join sys_user_role d on a.id = d.user_id
+        SELECT
+            a.id AS staffId,
+            b.id AS instructorId,
+            a.username,
+            a.realname,
+            a.status,
+            NULL AS password,
+            b.training_programs,
+            b.teaching_philosophy,
+            b.excel_msg,
+            a.certificate_innocence,
+            a.healthy,
+            a.honor,
+            b.background_img,
+            (SELECT GROUP_CONCAT(DISTINCT c.dep_id ORDER BY c.dep_id SEPARATOR ',')
+             FROM sys_user_depart c
+             WHERE c.user_id = a.id) AS	selecteddeparts,
+            (SELECT GROUP_CONCAT(DISTINCT d.role_id ORDER BY d.role_id SEPARATOR ',')
+             FROM sys_user_role d
+             WHERE d.user_id = a.id) AS selectedroles
+        FROM sys_user a
+        LEFT JOIN  nm_instructor b ON a.id = b.user_id AND b.del_flag = 0
         where a.id=#{id} and a.del_flag=0
     </select>
 

+ 2 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/vo/staff/StaffVO.java

@@ -80,11 +80,11 @@ public class StaffVO {
     private  List<String> honor;
 
     @Schema(description = "所属部门")
-    private List<String> selecteddeparts;
+    private String selecteddeparts;
 
 
     @Schema(description = "所属角色")
-    private List<String> selectedroles;
+    private String selectedroles;
     /**培训项目*/
     @Excel(name = "培训项目", width = 15)
     @Schema(description = "培训项目,使用,分割")