合并代码提交

This commit is contained in:
2022-11-17 15:10:16 +08:00
parent f368ebd623
commit 52645fa5b0
3 changed files with 63 additions and 62 deletions

View File

@@ -24,6 +24,8 @@ public class DeptDTO implements Serializable {
private String name; private String name;
private String code;
private String area; private String area;
private String remark; private String remark;

View File

@@ -41,7 +41,6 @@ public class Dept extends BaseEntity {
/** /**
* 部门编号 * 部门编号
*/ */
@TableField(exist=false)
private String code; private String code;
/** /**

View File

@@ -12,12 +12,12 @@
AND ${ew.sqlSegment} AND ${ew.sqlSegment}
</select> </select>
<!-- &lt;!&ndash;查询排序&ndash;&gt;--> <!-- &lt;!&ndash;查询排序&ndash;&gt;-->
<!-- <select id="getSortNum" resultType="int">--> <!-- <select id="getSortNum" resultType="int">-->
<!-- SELECT MAX(sys_dept.sort) sort--> <!-- SELECT MAX(sys_dept.sort) sort-->
<!-- FROM sys_dept sys_dept--> <!-- FROM sys_dept sys_dept-->
<!-- WHERE sys_dept.state = 1--> <!-- WHERE sys_dept.state = 1-->
<!-- </select>--> <!-- </select>-->
<select id="getIdString" resultType="String"> <select id="getIdString" resultType="String">
SELECT sys_dept.pids pids SELECT sys_dept.pids pids
@@ -28,33 +28,32 @@
<select id="getDeptTree" resultType="DeptTreeVO"> <select id="getDeptTree" resultType="DeptTreeVO">
SELECT SELECT
T3.*, T3.*,
T5.id area, T5.id area,
T5.name areaName T5.NAME areaName
FROM FROM
( sys_dept T3,
SELECT sys_area T5
@codes AS _ids,
(
SELECT @codes := GROUP_CONCAT( id ) FROM sys_dept WHERE FIND_IN_SET( pid, @codes ) ) AS T1
FROM
sys_dept s,
( SELECT @codes := #{id} ) T4
WHERE
@codes IS NOT NULL
<if test="type != null">
AND s.type in
<foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) T2,
sys_dept T3,
sys_area T5
WHERE WHERE
FIND_IN_SET( T3.id, T2._ids ) FIND_IN_SET( #{id}, T3.pids )
AND t3.area = t5.id and t3.type in
AND t3.State = 1 <foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND t3.area = t5.id
AND t3.State = 1
UNION
SELECT
T3.*,
T5.id area,
T5.NAME areaName
FROM
sys_dept T3,
sys_area T5
WHERE
t3.area = t5.id
and T3.id = #{id}
AND t3.State = 1
</select> </select>
<select id="getAllDeptTree" resultType="DeptAllTreeVO"> <select id="getAllDeptTree" resultType="DeptAllTreeVO">
@@ -121,38 +120,39 @@
<select id="getDeptDescendantIndexes" resultType="DeptDTO"> <select id="getDeptDescendantIndexes" resultType="DeptDTO">
SELECT SELECT
T3.id, T3.id,
T3.pid, T3.pid,
T3.pids, T3.pids,
T3.NAME, T3.NAME,
T3.type, T3.code,
T5.NAME area , T3.type,
T3.Remark, T5.NAME area ,
T3.sort T3.Remark,
T3.sort
FROM FROM
( (
SELECT SELECT
@codes AS _ids, @codes AS _ids,
( (
SELECT @codes := GROUP_CONCAT( id ) FROM sys_dept WHERE FIND_IN_SET( pid, @codes ) ) AS T1 SELECT @codes := GROUP_CONCAT( id ) FROM sys_dept WHERE FIND_IN_SET( pid, @codes ) ) AS T1
FROM FROM
sys_dept s, sys_dept s,
( SELECT @codes := #{id} ) T4 ( SELECT @codes := #{id} ) T4
WHERE
@codes IS NOT NULL
<if test="type != null">
AND s.type in
<foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) T2,
sys_dept T3,
sys_area T5
WHERE WHERE
FIND_IN_SET( T3.id, T2._ids ) @codes IS NOT NULL
AND t3.area = t5.id <if test="type != null">
AND t3.State = 1 AND s.type in
<foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) T2,
sys_dept T3,
sys_area T5
WHERE
FIND_IN_SET( T3.id, T2._ids )
AND t3.area = t5.id
AND t3.State = 1
Order by T3.sort asc Order by T3.sort asc
</select> </select>