From 562a960261b75d70abd65aa10528f09aeece94e8 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 24 九月 2024 09:49:23 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml b/smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml
index 92b8d2f..6ed52c9 100644
--- a/smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/SysUserDeptMapper.xml
@@ -10,6 +10,7 @@
         <result property="deptId" column="dept_id"/>
         <result property="delFlag" column="del_flag"/>
         <result property="deptCode" column="dept_code"/>
+        <result property="deptName" column="dept_name"/>
         <result property="deptType" column="dept_type"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
@@ -33,6 +34,7 @@
                create_time,
                update_time,
                dept_code,
+               dept_name,
                dept_type
         from sys_user_dept
     </sql>
@@ -41,6 +43,7 @@
             resultMap="SysUserDeptResult">
         <include refid="selectSysUserDeptVo"/>
         <where>
+            del_flag=0
             <if test="userId != null ">
                 and user_id = #{userId}
             </if>
@@ -55,6 +58,12 @@
             </if>
             <if test="updateTime != null ">
                 and update_time = #{updateTime}
+            </if>
+            <if test="deptType != null ">
+                and dept_type = #{deptType}
+            </if>
+            <if test="deptCode != null ">
+                and dept_code = #{deptCode}
             </if>
         </where>
     </select>
@@ -88,6 +97,9 @@
             <if test="deptCode != null ">
                 dept_code,
             </if>
+            <if test="deptName != null ">
+                dept_name,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},
@@ -108,6 +120,9 @@
             </if>
             <if test="deptCode != null ">
                 #{deptCode},
+            </if>
+            <if test="deptName != null ">
+                #{deptName},
             </if>
         </trim>
     </insert>
@@ -136,6 +151,9 @@
             <if test="deptCode != null ">
                 dept_code = #{deptCode},
             </if>
+            <if test="deptName != null ">
+                dept_name = #{deptName},
+            </if>
         </trim>
         where id = #{id}
     </update>
@@ -149,7 +167,14 @@
     </update>
 
     <select id="selectDeptListByUserId" resultMap="deptResult">
-        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status
+        select d.dept_id,
+               d.dept_name,
+               d.parent_id,
+               d.ancestors,
+               d.dept_name,
+               d.order_num,
+               d.leader,
+               d.status as dept_status
         from sys_dept d
                  left join sys_user_dept ud on d.dept_id = ud.dept_id
         where ud.user_id = #{userId}
@@ -169,4 +194,14 @@
     </update>
 
 
+    <update id="deleteSysUserDeptByCode" parameterType="String">
+        update sys_user_dept
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1,
+            update_time = sysdate()
+        </trim>
+        where user_id =#{userId} and dept_code=#{deptCode}
+    </update>
+
+
 </mapper>

--
Gitblit v1.9.3