Explorar o código

田长制增加祖籍部门信息

Memory_LG hai 1 ano
pai
achega
0553dc8689

+ 27 - 12
src/main/resources/mapper/digitalwater/WaterConservancyViewMapper.xml

@@ -130,25 +130,40 @@
 
     <select id="getTianList" parameterType="WaterConservancyViewBO" resultType="map">
         SELECT
-            GROUP_CONCAT( a.gridId ) gridId, `name`,  phone, id,sort,create_time createTime
+            t.id,
+            t.userId,
+            t.name,
+            t.phone,
+            t.gridId,
+            t.createTime,
+            REPLACE ( group_concat( dept_name ORDER BY find_in_set( d.dept_id, t.ancestors ) ), ',', '' ) deptName
         FROM(
             SELECT
                 DISTINCT a.user_id userId,
                 a.id,
-                a.`name`,
-                a.phone,
-                a.sort,
-                a.create_time,
-                a.grid_id gridId
+                a.`name` AS name,
+                d.dept_name AS deptName,
+                a.phone AS phone,
+                a.post post,
+                a.grid_id gridId,
+                a.create_time createTime,
+                SUBSTR( CONCAT( d.ancestors, ',', a.dept_id ), 7 ) ancestors
             FROM
                 centerdata_t_hydraulic_river_length a
-                LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
-            WHERE
-                a.type = #{leadType} ${params.dataScope}
-            ) a
+            LEFT JOIN onest_system.sys_dept d ON a.dept_id = d.dept_id
+            <where>
+                <if test="leadType != null and leadType != ''">
+                    a.type = #{leadType}
+                </if>
+                ${params.dataScope}
+            </where>
+        ) t
+        LEFT JOIN
+            onest_system.sys_dept d ON find_in_set( d.dept_id, t.ancestors )
         GROUP BY
-            a.userId
-        order by a.sort asc,a.create_time desc
+            t.name
+        order by
+            t.createTime
     </select>
 
     <select id="getGridList" parameterType="WaterConservancyViewBO" resultType="map">