From 6c2a01f6bc53b27805dbd514ac7ea83b58af2323 Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Tue, 10 Sep 2024 20:34:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml | 85 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 81 insertions(+), 4 deletions(-)
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
index e1b5686..c42ddef 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml
@@ -5,7 +5,7 @@
* @description: 自定义sql,请自行实现业务逻辑
* @company: hugeinfo
* @author: liyj
- * @time:2024-08-17 15:30:57
+ * @time:2024-08-19 20:04:19
* @version 1.0.0
-->
<mapper namespace="cn.huge.module.ctuser.dao.mapper.CtUnitMapper">
@@ -46,6 +46,12 @@
<result property="custId" column="cust_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
+ <result property="postalCode" column="postal_code"/>
+ <result property="telephone" column="telephone"/>
+ <result property="workTimeWeek" column="work_time_week"/>
+ <result property="workTimeAm" column="work_time_am"/>
+ <result property="workTimePm" column="work_time_pm"/>
+
</resultMap>
<!-- 表 -->
<sql id='table-name'>dyh_ct_unit</sql>
@@ -85,7 +91,12 @@
delete_status,
cust_id,
create_time,
- update_time
+ update_time,
+ postal_code,
+ telephone,
+ work_time_week,
+ work_time_am,
+ work_time_pm
</sql>
<!-- 更新实体字段 -->
<sql id="set-part">
@@ -122,12 +133,22 @@
<if test="entity.deleteStatus != null">delete_status = #{entity.deleteStatus},</if>
<if test="entity.custId != null">cust_id = #{entity.custId},</if>
<if test="entity.createTime != null">create_time = #{entity.createTime},</if>
- <if test="entity.updateTime != null">update_time = #{entity.updateTime}</if>
+ <if test="entity.updateTime != null">update_time = #{entity.updateTime},</if>
+ <if test="entity.postalCode != null">postal_code = #{entity.postalCode},</if>
+ <if test="entity.telephone != null">telephone = #{entity.telephone},</if>
+ <if test="entity.workTimeWeek != null">work_time_week = #{entity.workTimeWeek},</if>
+ <if test="entity.workTimeAm != null">work_time_am = #{entity.workTimeAm},</if>
+ <if test="entity.workTimePm != null">work_time_pm = #{entity.workTimePm},</if>
+
+
</sql>
<!-- 条件 -->
<sql id="where-part">
<if test="terms != null">
<where>
+ <if test="terms.keyword != null and terms.keyword !=''">
+ and unit_name like CONCAT('%', #{terms.keyword}, '%')
+ </if>
<if test="terms.id != null and terms.id !=''">
and id = #{terms.id}
</if>
@@ -145,6 +166,12 @@
</if>
<if test="terms.unitType != null and terms.unitType !=''">
and unit_type = #{terms.unitType}
+ </if>
+ <if test="terms.unitTypes != null and terms.unitTypes.size > 0 ">
+ and unit_type in
+ <foreach item="unitType" collection="terms.unitTypes" separator="," open="(" close=")" index="">
+ #{unitType}
+ </foreach>
</if>
<if test="terms.unitCode != null and terms.unitCode !=''">
and unit_code = #{terms.unitCode}
@@ -222,7 +249,7 @@
and disp_status = #{terms.dispStatus}
</if>
<if test="terms.deleteStatus = null and terms.deleteStatus =''">
- and delete_status = '1'
+ and delete_status = 0
</if>
<if test="terms.deleteStatus != null and terms.deleteStatus !=''">
and delete_status = #{terms.deleteStatus}
@@ -307,4 +334,54 @@
limit #{page.offset}, #{page.size}
</select>
+ <!-- 更新对象 -->
+ <update id="updateTerms">
+ update
+ <include refid="table-name"/>
+ <set>
+ <include refid="set-part"/>
+ </set>
+ WHERE
+ id = #{entity.id}
+ </update>
+
+ <!-- 更新调度规则指标目标组织名称 -->
+ <update id="updateDispNormCauseTargetUnitName">
+ update dyh_disp_norm_cause
+ set target_unit_name = #{unitName}
+ where target_unit_id = #{unitId}
+ </update>
+
+ <!-- 查询某一单位下下一级所有管辖单位-->
+ <select id="listAllChild" resultMap="dataResult">
+ WITH RECURSIVE unit_hierarchy(id, parent_id, name) AS (
+ -- 锚成员 (起始点)
+ SELECT
+ id ,
+ parent_id,
+ unit_name
+ FROM
+ dyh_ct_unit
+ WHERE
+ id = #{unitId}
+
+ UNION ALL
+
+ -- 递归成员
+ SELECT
+ u.id,
+ u.parent_id,
+ u.unit_name
+ FROM
+ dyh_ct_unit u
+ JOIN
+ unit_hierarchy h ON u.parent_id = h.id where u.delete_status = 0
+ )
+ SELECT
+ id AS id,
+ parent_id AS parent_id,
+ name AS unit_name
+ FROM
+ unit_hierarchy;
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0