From 1c82e21ac936241bf56109e7fff87446b0b6a131 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 19 十月 2026 15:31:22 +0800
Subject: [PATCH] 【丽水】新增接口 修复Sys_User_Dept数据缺失问题

---
 ruoyi-system/src/main/resources/mapper/system/SysUserDeptMapper.xml |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserDeptMapper.xml
index cbb6490..88c3340 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserDeptMapper.xml
@@ -82,6 +82,17 @@
         where id = #{id}
     </select>
 
+    <select id="selectSysUserDeptByUserAndCode" resultMap="SysUserDeptResult">
+        <include refid="selectSysUserDeptVo"/>
+        where user_id = #{userId}
+          and dept_code = #{deptCode}
+        <if test="orgid != null and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        order by del_flag asc, id asc
+        limit 1
+    </select>
+
     <insert id="insertSysUserDept" parameterType="com.ruoyi.common.core.domain.entity.SysUserDept"
             useGeneratedKeys="true" keyProperty="id">
         insert into sys_user_dept
@@ -237,6 +248,24 @@
         where user_id =#{userId} and dept_code=#{deptCode}
     </update>
 
+    <update id="deleteSysUserDeptByUserId" parameterType="String">
+        update sys_user_dept
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1,
+            update_time = sysdate()
+        </trim>
+        where del_flag = 0
+        <if test="userId != null">
+            and user_id =#{userId}
+        </if>
+        <if test="orgid != null ">
+            and orgid = #{orgid}
+        </if>
+        <if test="deptType != null ">
+            and dept_type = #{deptType}
+        </if>
+    </update>
+
     <update id="updateSysUserDeptForSync" parameterType="com.ruoyi.common.core.domain.entity.SysUserDept">
         update sys_user_dept
         <trim prefix="SET" suffixOverrides=",">

--
Gitblit v1.9.3