代码提交

This commit is contained in:
liang.chao 2025-12-09 14:02:53 +08:00
parent 964599dad6
commit 78d24309d1
2 changed files with 20 additions and 20 deletions

View File

@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectDeptVo"> <sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.remark select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.remark
from da_ky_sys_dept d from record_da_ky_sys_dept d
</sql> </sql>
<select id="selectDeptList" parameterType="org.springblade.common.core.domain.entity.SysDept" resultMap="SysDeptResult"> <select id="selectDeptList" parameterType="org.springblade.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
@ -47,19 +47,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeptListByRoleId" resultType="Long"> <select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id select d.dept_id
from da_ky_sys_dept d from record_da_ky_sys_dept d
left join da_ky_sys_role_dept rd on d.dept_id = rd.dept_id left join da_ky_sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId} where rd.role_id = #{roleId}
<if test="deptCheckStrictly"> <if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from da_ky_sys_dept d inner join da_ky_sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) and d.dept_id not in (select d.parent_id from record_da_ky_sys_dept d inner join da_ky_sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if> </if>
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.remark, select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.remark,
(select dept_name from da_ky_sys_dept where dept_id = d.parent_id) parent_name (select dept_name from record_da_ky_sys_dept where dept_id = d.parent_id) parent_name
from da_ky_sys_dept d from record_da_ky_sys_dept d
where d.dept_id = #{deptId} where d.dept_id = #{deptId}
</select> </select>
@ -68,16 +68,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int"> <select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from da_ky_sys_dept select count(1) from record_da_ky_sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1 where del_flag = '0' and parent_id = #{deptId} limit 1
</select> </select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from da_ky_sys_dept where find_in_set(#{deptId}, ancestors) select * from record_da_ky_sys_dept where find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int"> <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from da_ky_sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) select count(*) from record_da_ky_sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select> </select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult"> <select id="checkDeptNameUnique" resultMap="SysDeptResult">
@ -87,13 +87,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTransferApplyDeptId" resultType="java.lang.Integer"> <select id="getTransferApplyDeptId" resultType="java.lang.Integer">
WITH RECURSIVE DeptTree AS ( WITH RECURSIVE DeptTree AS (
SELECT dept_id SELECT dept_id
FROM da_ky_sys_dept FROM record_da_ky_sys_dept
WHERE dept_id = #{deptId} WHERE dept_id = #{deptId}
UNION ALL UNION ALL
SELECT d.dept_id SELECT d.dept_id
FROM da_ky_sys_dept d FROM record_da_ky_sys_dept d
INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id
) )
SELECT COUNT(*) SELECT COUNT(*)
@ -104,13 +104,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getSysUserDeptId" resultType="java.lang.Integer"> <select id="getSysUserDeptId" resultType="java.lang.Integer">
WITH RECURSIVE DeptTree AS ( WITH RECURSIVE DeptTree AS (
SELECT dept_id SELECT dept_id
FROM da_ky_sys_dept FROM record_da_ky_sys_dept
WHERE dept_id = #{deptId} WHERE dept_id = #{deptId}
UNION ALL UNION ALL
SELECT d.dept_id SELECT d.dept_id
FROM da_ky_sys_dept d FROM record_da_ky_sys_dept d
INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id
) )
SELECT COUNT(*) SELECT COUNT(*)
@ -121,13 +121,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTransferIssueDeptId" resultType="java.lang.Integer"> <select id="getTransferIssueDeptId" resultType="java.lang.Integer">
WITH RECURSIVE DeptTree AS ( WITH RECURSIVE DeptTree AS (
SELECT dept_id SELECT dept_id
FROM da_ky_sys_dept FROM record_da_ky_sys_dept
WHERE dept_id = #{deptId} WHERE dept_id = #{deptId}
UNION ALL UNION ALL
SELECT d.dept_id SELECT d.dept_id
FROM da_ky_sys_dept d FROM record_da_ky_sys_dept d
INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id INNER JOIN DeptTree dt ON d.parent_id = dt.dept_id
) )
SELECT COUNT(*) SELECT COUNT(*)
@ -137,7 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertDept" parameterType="SysDept"> <insert id="insertDept" parameterType="SysDept">
insert into da_ky_sys_dept( insert into record_da_ky_sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if> <if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if> <if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if> <if test="deptName != null and deptName != ''">dept_name,</if>
@ -167,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<update id="updateDept" parameterType="SysDept"> <update id="updateDept" parameterType="SysDept">
update da_ky_sys_dept update record_da_ky_sys_dept
<set> <set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
@ -185,7 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<update id="updateDeptChildren" parameterType="java.util.List"> <update id="updateDeptChildren" parameterType="java.util.List">
update da_ky_sys_dept set ancestors = update record_da_ky_sys_dept set ancestors =
<foreach collection="depts" item="item" index="index" <foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end"> separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors} when #{item.deptId} then #{item.ancestors}
@ -198,14 +198,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<update id="updateDeptStatusNormal" parameterType="Long"> <update id="updateDeptStatusNormal" parameterType="Long">
update da_ky_sys_dept set status = '0' where dept_id in update record_da_ky_sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")"> <foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId} #{deptId}
</foreach> </foreach>
</update> </update>
<delete id="deleteDeptById" parameterType="Long"> <delete id="deleteDeptById" parameterType="Long">
update da_ky_sys_dept set del_flag = '2' where dept_id = #{deptId} update record_da_ky_sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete> </delete>
</mapper> </mapper>

View File

@ -483,7 +483,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email, email,
status, status,
del_flag AS delFlag del_flag AS delFlag
FROM da_ky_sys_dept FROM record_da_ky_sys_dept
WHERE del_flag = '0' WHERE del_flag = '0'
and status = '0' and status = '0'
</select> </select>