From 17e9ad4bbbbd0129e8da4dc0cfeee0028d7121e0 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 24 二月 2025 17:40:23 +0800
Subject: [PATCH] 资金类型和重点分类多选

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

diff --git a/system/src/main/resources/mapper/system/SysDeptMapper.xml b/system/src/main/resources/mapper/system/SysDeptMapper.xml
index cff192d..8de6205 100644
--- a/system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.hnct.system.mapper.SysDeptMapper">
+<mapper namespace="com.ycl.system.mapper.SysDeptMapper">
 
-	<resultMap type="com.hnct.system.domain.SysDept" id="SysDeptResult">
+	<resultMap type="SysDept" id="SysDeptResult">
 		<id     property="deptId"     column="dept_id"     />
 		<result property="parentId"   column="parent_id"   />
 		<result property="ancestors"  column="ancestors"   />
@@ -27,7 +27,7 @@
         from sys_dept d
     </sql>
 
-	<select id="selectDeptList" parameterType="com.hnct.system.domain.SysDept" resultMap="SysDeptResult">
+	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
 		<if test="deptId != null and deptId != 0">
@@ -65,6 +65,13 @@
 		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">
 		select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
 	</select>
@@ -86,8 +93,18 @@
 	    <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 ancestors
+		from sys_user SU
+		INNER JOIN sys_dept SD ON SU.dept_id = SD.dept_id
+		where SU.user_id = #{userId}
+	</select>
 
-    <insert id="insertDept" parameterType="com.hnct.system.domain.SysDept">
+	<select id="selectByName" parameterType="string" resultType="long">
+		SELECT dept_id FROM sys_dept WHERE dept_name = #{name} and del_flag = '0' limit 1
+	</select>
+
+    <insert id="insertDept" parameterType="SysDept">
  		insert into sys_dept(
  			<if test="deptId != null and deptId != 0">dept_id,</if>
  			<if test="parentId != null and parentId != 0">parent_id,</if>
@@ -115,12 +132,12 @@
  		)
 	</insert>
 
-	<update id="updateDept" parameterType="com.hnct.system.domain.SysDept">
+	<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