From 92705ac08a97ddc4904795f024723aab69e1abd8 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期六, 05 四月 2025 21:47:59 +0800
Subject: [PATCH] 修改

---
 src/main/resources/mapper/progressTrack/DjJdgzDismantTrackDao.xml |  127 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/progressTrack/DjJdgzDismantTrackDao.xml b/src/main/resources/mapper/progressTrack/DjJdgzDismantTrackDao.xml
index 32c483a..1401c75 100644
--- a/src/main/resources/mapper/progressTrack/DjJdgzDismantTrackDao.xml
+++ b/src/main/resources/mapper/progressTrack/DjJdgzDismantTrackDao.xml
@@ -2,6 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="com.example.server.progressTrack.dao.DjJdgzDismantTrackDao">
+    <delete id="deleteByName">
+        update dj_jdgz_dismant_track set is_delete=1 where name = #{name}
+    </delete>
 
     <select id="getList" resultType="com.example.server.progressTrack.model.DjJdgzDismantTrack">
         select *
@@ -12,4 +15,128 @@
             and cabin_id = ${cabinId}
         </if>
     </select>
+    <select id="getdata" resultType="com.example.server.progressTrack.model.DjJdgzDismantTrack">
+        SELECT
+        a.*,
+        k.name as cabinName,
+        h.name as teamGroupName,
+        b.name as deptName,
+        c.`NAME` as level3NetworkName,
+        d.PROCESS_NAME AS level2NodeName,
+        f.PROCESS_NAME AS level1NodeName
+        FROM
+        dj_jdgz_dismant_track a
+        LEFT JOIN dj_jdgz_network_level3 c ON c.id = a.LEVEL3_NETWORK_ID
+        LEFT JOIN dj_jdgz_network_level2_list d ON d.id = c.LEVEL2_NODE_ID
+        LEFT JOIN dj_jdgz_network_level2 e ON e.id = d.NETWORK_ID
+        LEFT JOIN dj_jdgz_network_level1_list f ON f.id = e.LEVEL1_NODE_ID
+        LEFT JOIN dj_jdgz_network_level1 g ON g.id = c.LEVEL1_NETWORK_ID
+        LEFT JOIN dj_sys_teamgroup_class h ON h.id = c.TEAMGROUP_ID
+        LEFT JOIN dj_sys_teamgroup_class b ON b.id = c.dept_id
+        LEFT JOIN cabin k ON k.id = a.cabin_id
+        WHERE
+        a.IS_DELETE = 0
+        <if test="deptId!=null and deptId!=''">
+            AND c.dept_id = ${deptId}
+        </if>
+        <if test="teamGroupId!=null and teamGroupId!=''">
+            AND c.TEAMGROUP_ID = ${teamGroupId}
+        </if>
+        <if test="level3NetworkId!=null">
+            AND a.LEVEL3_NETWORK_ID = ${level3NetworkId}
+        </if>
+
+        <if test="status==1">
+            AND a.CURRENT_STATUS = 1
+        </if>
+        <if test="status==0">
+            and (a.CURRENT_STATUS IS null OR a.CURRENT_STATUS = 0)
+        </if>
+        AND c.IS_DELETE = 0
+        AND d.IS_DELETE = 0
+        AND e.IS_DELETE = 0
+        AND f.IS_DELETE = 0
+        AND g.IS_DELETE = 0
+        AND k.IS_DELETE = 0
+        AND g.id = ${level1NetworkId}
+        ORDER BY
+        f.SORT,
+        d.SORT,
+        b.UPDATE_DATE
+    </select>
+    <select id="getStatist" resultType="com.example.server.progressTrack.Dto.StatistDismantDto">
+        select a.id,
+               case when a.pid=0 then a.NAME else '    '|| a.NAME end as name,
+               case when a.pid=0 then '' || a.id else ''|| a.pid || a.SORT end as sort,
+               sum(case when b.LEVEL3_NETWORK_ID is not null then 1 else 0 end) as sbsl,
+               sum(case when sbStatus = 1 then 1 else 0 end) as sbcxsl,
+               sum(case when zbjsl is null then 0 else zbjsl end) as zbjsl,
+               sum(case when zbjwcsl is null then 0 else zbjwcsl end) as zbjcxsl,
+               sum(case when dismantsl is null then 0 else dismantsl end) as dismantsl,
+               sum(case when exitsl is null then 0 else exitsl end) as exitsl,
+               sum(case when returnsl is null then 0 else returnsl end) as returnsl,
+               sum(case when warehousesl is null then 0 else warehousesl end) as warehousesl
+        from dj_sys_teamgroup_class  a
+                 left join (
+            select a.id as id2, a.pid as pid2,c.LEVEL3_NETWORK_ID,
+                   case when EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and (s.status=0 or s.status is null) and s.is_delete = 0) or not EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and s.status=1 and s.is_delete = 0) then 0 else 1 end as sbStatus,
+                   sum(case when c.id is not null then 1 else 0 end) as zbjsl,
+                   sum(case when c.status=1 then 1 else 0 end) as zbjwcsl,
+                   sum(case when c.dismant_time is null then 0 else 1 end) as dismantsl,
+                   sum(case when c.exit_time is null then 0 else 1 end) as exitsl,
+                   sum(case when c.return_weight_time is null then 0 else 1 end) as returnsl,
+                   sum(case when c.warehouse_time is null then 0 else 1 end) as warehousesl
+            from 	dj_sys_teamgroup_class  a
+                        left join dj_jdgz_network_level3 b on b.IS_DELETE = 0 and b.TEAMGROUP_ID = a.id
+                        left join dj_jdgz_dismant_track c on c.is_delete = 0 and c.LEVEL3_NETWORK_ID = b.id
+            where a.IS_DELETE= 0
+              and a.AREA = 'hld'
+              and b.LEVEL1_NETWORK_ID = ${level1Id}
+            group by a.id,a.NAME,b.id
+        ) b on a.id=b.id2 or a.id = b.pid2
+        where a.AREA = 'hld' and a.IS_DELETE = 0
+        group by a.id,a.NAME
+        order by sort
+    </select>
+    <select id="getStatus" resultType="java.lang.Boolean">
+        SELECT CASE
+        WHEN NOT EXISTS (
+        SELECT 1
+        FROM dj_jdgz_dismant_track
+        WHERE LEVEL3_NETWORK_ID = ${level3NetworkId} AND  (status=0 or status is null)
+        ) THEN TRUE
+        ELSE FALSE
+        END
+    </select>
+    <select id="getStatist2" resultType="com.example.server.progressTrack.Dto.StatistDismantDto">
+        select a.id,a.name,
+               sum(case when b.id is not null then 1 else 0 end) as sbsl,
+               sum(case when sbStatus = 1 then 1 else 0 end) as sbcxsl,
+               sum(case when zbjsl is null then 0 else zbjsl end) as zbjsl,
+               sum(case when zbjwcsl is null then 0 else zbjwcsl end) as zbjcxsl,
+               sum(case when dismantsl is null then 0 else dismantsl end) as dismantsl,
+               sum(case when exitsl is null then 0 else exitsl end) as exitsl,
+               sum(case when returnsl is null then 0 else returnsl end) as returnsl,
+               sum(case when warehousesl is null then 0 else warehousesl end) as warehousesl
+        from cabin a
+                 left join (
+            select b.id,c.cabin_id,
+                   case when EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and (s.status=0 or s.status is null) and s.is_delete = 0) or not EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and s.status=1 and s.is_delete = 0) then 0 else 1 end as sbStatus,
+                   sum(case when c.id is not null then 1 else 0 end) as zbjsl,
+                   sum(case when c.status=1 then 1 else 0 end) as zbjwcsl,
+                   sum(case when c.dismant_time is null then 0 else 1 end) as dismantsl,
+                   sum(case when c.exit_time is null then 0 else 1 end) as exitsl,
+                   sum(case when c.return_weight_time is null then 0 else 1 end) as returnsl,
+                   sum(case when c.warehouse_time is null then 0 else 1 end) as warehousesl
+            from dj_jdgz_network_level3 b
+                     join dj_jdgz_dismant_track c on c.is_delete = 0 and c.LEVEL3_NETWORK_ID = b.id
+            where b.IS_DELETE = 0
+                  and b.LEVEL1_NETWORK_ID = ${level1Id}
+                  and b.TEAMGROUP_ID in (select id from dj_sys_teamgroup_class where AREA = 'hld' and IS_DELETE = 0 and (id = ${id} or pid = ${id}))
+            group by b.id,c.cabin_id
+        ) b on a.id=b.cabin_id
+        where a.IS_DELETE = 0
+        group by b.cabin_id
+        order by a.id
+    </select>
 </mapper>

--
Gitblit v1.9.1