From a0020e9ccac495a6bb9efedc2c2f523277387081 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 26 三月 2025 00:09:24 +0800
Subject: [PATCH] 按时完成的任务还需要排除被驳回的
---
system/src/main/resources/mapper/system/SysDeptMapper.xml | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/system/src/main/resources/mapper/system/SysDeptMapper.xml b/system/src/main/resources/mapper/system/SysDeptMapper.xml
index 83092a3..3aa7471 100644
--- a/system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -47,6 +47,18 @@
order by d.parent_id, d.order_num
</select>
+ <select id="selectDeptListNoAuth" parameterType="SysDept" resultMap="SysDeptResult">
+ <include refid="selectDeptVo"/>
+ where d.del_flag = '0'
+ <if test="parentId != null">
+ AND FIND_IN_SET(#{parentId}, ancestors) > 0
+ </if>
+ <if test="deptName != null and deptName != ''">
+ AND dept_name like concat('%', #{deptName}, '%')
+ </if>
+ order by d.parent_id, d.order_num
+ </select>
+
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
@@ -63,6 +75,13 @@
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
+ </select>
+
+ <select id="selectDeptByIds" 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,
+ (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
+ from sys_dept d
+ where d.dept_id in <foreach collection="deptIds" open="(" separator="," close=")" item="deptId">#{deptId}</foreach>
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
@@ -85,6 +104,30 @@
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+ </select>
+ <select id="selectAncestors" resultType="java.lang.String">
+ select SD.ancestors
+ from sys_user SU
+ INNER JOIN sys_dept SD ON SU.dept_id = SD.dept_id
+ where SU.user_id = #{userId}
+ </select>
+
+ <select id="selectByName" parameterType="string" resultType="long">
+ SELECT dept_id FROM sys_dept WHERE dept_name = #{name} and del_flag = '0' limit 1
+ </select>
+
+ <select id="getChildIds" parameterType="long" resultType="long">
+ WITH RECURSIVE temp_table AS (
+ SELECT
+ dept_id FROM sys_dept WHERE dept_id = #{deptId} AND del_flag = '0'
+ UNION ALL
+ SELECT
+ so.dept_id FROM sys_dept so INNER JOIN temp_table tb ON so.parent_id = tb.dept_id AND so.del_flag = '0'
+ )
+ SELECT
+ dept_id
+ FROM
+ temp_table
</select>
<insert id="insertDept" parameterType="SysDept">
@@ -118,9 +161,9 @@
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
- <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
+ <if test="parentId != null">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
- <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
+ <if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
--
Gitblit v1.8.0