From b48be73219c84cf00f4fbbabe6ea31f6e511c4a9 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期一, 07 七月 2025 09:54:05 +0800
Subject: [PATCH] 功能改造

---
 multi-system/src/main/resources/mapper/system/SysDeptMapper.xml |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 01802b7..54dcded 100644
--- a/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -21,6 +21,8 @@
 		<result property="updateBy"   column="update_by"   />
 		<result property="updateTime" column="update_time" />
 		<result property="responsibilities"   column="responsibilities"   />
+		<result property="deptType"   column="dept_type"   />
+		<result property="responsType"   column="respons_type"   />
 		<result property="personNum" column="person_num" />
 		<result property="internalAuditors" column="internal_auditors" />
 		<result property="internalAuditorsName"   column="internal_auditors_name"   />
@@ -32,24 +34,39 @@
 			<result     property="clauseId"     column="clause_id"     />
 			<result     property="id"     column="data_id"     />
 		</collection>
+		<collection ofType="com.gkhy.exam.system.domain.vo.SysDeptManageVo" property="sysDeptManageVoList">
+			<result     property="subDeptId"     column="sub_dept_id"     />
+			<result     property="subDeptName"     column="sub_dept_name"     />
+			<result     property="deptId"     column="p_dept_id"     />
+
+		</collection>
 	</resultMap>
 	
 	<sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id, d.company_id, d.status, d.del_flag, d.create_by, d.create_time,d.person_num,d.internal_auditors,
-			d.responsibilities
+			d.responsibilities,d.dept_type,d.respons_type
         from sys_dept d
     </sql>
     
 	<select id="selectDeptList" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultMap="DeptVoResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id, d.company_id, d.status, d.del_flag, d.create_by, d.create_time,d.person_num,d.internal_auditors,
-		d.responsibilities,u.name as leader_name,d2.dept_name as parent_name, dr.content ,dr.clause_num,dr.id as data_id,dr.clause_id
+		d.responsibilities,d.dept_type,d.respons_type,u.name as leader_name,d2.dept_name as parent_name, dr.content ,dr.clause_num,dr.id as data_id,dr.clause_id,
+		sm.sub_dept_id ,sm2.dept_name sub_dept_name,sm.dept_id as p_dept_id
 		from sys_dept d
 		left join sys_user u on d.leader_user_id = u.id
 		left join sys_dept d2 on d.parent_id = d2.dept_id
 		left join sys_dept_responsibility dr on d.dept_id = dr.dept_id and dr.del_flag = '0' and data_type = 2
+		left join sys_dept_manage sm on d.dept_id = sm.dept_id
+		left join sys_dept sm2 on sm2.dept_id = sm.sub_dept_id
         where d.del_flag = '0'
 		<if test="companyId != null and companyId != 0">
 			AND d.company_id = #{companyId}
+		</if>
+		<if test="deptType != null and deptType != '' " >
+			AND d.dept_type = #{deptType}
+		</if>
+		<if test="responsType != null and responsType != '' " >
+			AND d.respons_type = #{responsType}
 		</if>
 		<if test="deptId != null and deptId != 0">
 			AND d.dept_id = #{deptId}
@@ -102,7 +119,7 @@
     
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id,d.company_id,d.status,d.person_num,d.internal_auditors,
-			   d.responsibilities,
+			   d.responsibilities,d.dept_type,d.respons_type,
 			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name,(select dept_name from sys_user where id = d.leader_user_id) leader_name
 				,(select dept_name from sys_user where id = d.internal_auditors) internal_auditors_name
 		from sys_dept d
@@ -147,6 +164,7 @@
 			<if test="responsibilities != null and responsibilities != ''">responsibilities,</if>
  			<if test="status != null">status,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
+			<if test="responsType != null and responsType != ''">respons_type,</if>
  			create_time
  		)values(
  			<if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -161,6 +179,7 @@
 			<if test="responsibilities != null and responsibilities != ''">#{responsibilities},</if>
  			<if test="status != null">#{status},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
+			<if test="responsType != null and responsType != ''">#{responsType},</if>
  			sysdate()
  		)
 	</insert>
@@ -178,6 +197,7 @@
 			<if test="responsibilities != null and responsibilities != ''">responsibilities = #{responsibilities},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="responsType != null and responsType != ''">respons_type = #{responsType},</if>
  			update_time = sysdate()
  		</set>
  		where dept_id = #{deptId}
@@ -207,4 +227,21 @@
 		update sys_dept set del_flag = '1' where dept_id = #{deptId}
 	</delete>
 
+
+	<insert id="insetMangeBatch">
+		insert into sys_dept_manage(dept_id,sub_dept_id,company_id) values
+		<foreach item="item" index="index" collection="list" separator=",">
+			(#{item.deptId},#{item.subDeptId},#{item.companyId})
+		</foreach>
+	</insert>
+
+	<delete id="deleteMangeBatch">
+		delete from sys_dept_manage where dept_id = #{deptId}
+	</delete>
+
+	<select id="getAllManage" parameterType="long" resultType="com.gkhy.exam.system.domain.SysDeptManage">
+		select * from sys_dept_manage
+		where company_id = #{companyId}
+	</select>
+
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.2