From 3328aec7bc4cc2c090f015cba905a82d6d52870c Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 19 十月 2025 10:34:29 +0800
Subject: [PATCH] fix:更新

---
 ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index cf439f6..b5fab18 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -16,6 +16,7 @@
 		<result property="status"     column="status"      />
 		<result property="delFlag"    column="del_flag"    />
 		<result property="parentName" column="parent_name" />
+		<result property="departmentId" column="department_id" />
 		<result property="createBy"   column="create_by"   />
 		<result property="createTime" column="create_time" />
 		<result property="updateBy"   column="update_by"   />
@@ -23,7 +24,7 @@
 	</resultMap>
 	
 	<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 
+        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.department_id, d.create_by, d.create_time 
         from sys_dept d
     </sql>
     
@@ -59,7 +60,7 @@
 	</select>
     
     <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,
+		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.department_id,
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 		from sys_dept d
 		where d.dept_id = #{deptId}
@@ -98,6 +99,7 @@
  			<if test="phone != null and phone != ''">phone,</if>
  			<if test="email != null and email != ''">email,</if>
  			<if test="status != null">status,</if>
+ 			<if test="departmentId != null">department_id,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			create_time
  		)values(
@@ -110,6 +112,7 @@
  			<if test="phone != null and phone != ''">#{phone},</if>
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="status != null">#{status},</if>
+ 			<if test="departmentId != null">#{departmentId},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			sysdate()
  		)
@@ -126,6 +129,7 @@
  			<if test="phone != null">phone = #{phone},</if>
  			<if test="email != null">email = #{email},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
+ 			<if test="departmentId != null">department_id = #{departmentId},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  			update_time = sysdate()
  		</set>
@@ -156,4 +160,20 @@
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>
 
+	<!-- 鏍规嵁departmentId鏌ヨ閮ㄩ棬 -->
+	<select id="selectDeptByDepartmentId" parameterType="Integer" resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.department_id = #{departmentId} and d.del_flag = '0'
+		limit 1
+	</select>
+
+	<!-- 鏍规嵁departmentId鍜岀埗閮ㄩ棬ID鏌ヨ閮ㄩ棬 -->
+	<select id="selectDeptByDepartmentIdAndParentId" resultMap="SysDeptResult">
+		<include refid="selectDeptVo"/>
+		where d.department_id = #{departmentId} 
+		  and d.parent_id = #{parentId} 
+		  and d.del_flag = '0'
+		limit 1
+	</select>
+
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.1