From c1a463b9f1c0a7160dbd0ac1c7490eef13861a5e Mon Sep 17 00:00:00 2001
From: huangh <hshgjzd5@163.com>
Date: Tue, 29 Oct 2024 15:02:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/gzdyh_test' into gzdyh_test

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUnitMapper.xml |  100 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 95 insertions(+), 5 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 11a7fa8..efcc35f 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-19 20:04:19
+ * @time:2024-10-17 16:41:35
  * @version 1.0.0
 -->
 <mapper namespace="cn.huge.module.ctuser.dao.mapper.CtUnitMapper">
@@ -46,6 +46,13 @@
             <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"/>
+            <result property="unitFun" column="unit_fun"/>
+            <result property="courtStatus" column="court_status"/>
     </resultMap>
     <!-- 表 -->
     <sql id='table-name'>dyh_ct_unit</sql>
@@ -85,7 +92,14 @@
         delete_status,
         cust_id,
         create_time,
-        update_time
+        update_time,
+        postal_code,
+        telephone,
+        work_time_week,
+        work_time_am,
+        work_time_pm,
+        unit_fun,
+        court_status
     </sql>
     <!-- 更新实体字段 -->
     <sql id="set-part">
@@ -122,7 +136,14 @@
             <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>
+            <if test="entity.unitFun != null">unit_fun = #{entity.unitFun},</if>
+            <if test="entity.courtStatus != null">court_status = #{entity.courtStatus}</if>
     </sql>
     <!-- 条件 -->
     <sql id="where-part">
@@ -222,7 +243,7 @@
                     and disp_status = #{terms.dispStatus}
                 </if>
                 <if test="terms.deleteStatus = null and terms.deleteStatus =''">
-                    and delete_status = '0'
+                    and delete_status = 0
                 </if>
                 <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
                     and delete_status = #{terms.deleteStatus}
@@ -243,6 +264,27 @@
                 <if test="terms.updateStart != null and terms.updateStart !='' and terms.updateEnd != null and terms.updateEnd !=''">
                     and (DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.updateStart}
                         and DATE_FORMAT(update_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.updateEnd})
+                </if>
+                <if test="terms.postalCode != null and terms.postalCode !=''">
+                    and postal_code = #{terms.postalCode}
+                </if>
+                <if test="terms.telephone != null and terms.telephone !=''">
+                    and telephone = #{terms.telephone}
+                </if>
+                <if test="terms.workTimeWeek != null and terms.workTimeWeek !=''">
+                    and work_time_week = #{terms.workTimeWeek}
+                </if>
+                <if test="terms.workTimeAm != null and terms.workTimeAm !=''">
+                    and work_time_am = #{terms.workTimeAm}
+                </if>
+                <if test="terms.workTimePm != null and terms.workTimePm !=''">
+                    and work_time_pm = #{terms.workTimePm}
+                </if>
+                <if test="terms.unitFun != null and terms.unitFun !=''">
+                    and unit_fun = #{terms.unitFun}
+                </if>
+                <if test="terms.courtStatus != null and terms.courtStatus !=''">
+                    and court_status = #{terms.courtStatus}
                 </if>
             </where>
         </if>
@@ -317,4 +359,52 @@
         WHERE
         id = #{entity.id}
     </update>
-</mapper> 
\ No newline at end of file
+
+    <!--  更新调度规则指标目标组织名称  -->
+    <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>
+
+    <!--  根据条件分页查询  -->
+    <select id="selectUnitByGridId" resultMap="dataResult">
+        SELECT
+            t1.*
+        FROM dyh_ct_unit t1 left join dyh_ct_unit_grid t2 on t1.id = t2.dyh_unit_id
+        where t2.third_unit_id = #{gridUnitId} limit 1
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0