From e301d5c4e6de0aca423c54481d100e6ca2886b01 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期六, 08 十一月 2025 22:57:12 +0800
Subject: [PATCH] 清洗数据库日期错误,并且导入日期通用化处理
---
src/main/resources/mapper/progressTrack/DjJdgzTrackRecordDao.xml | 146 ++++++++++++++++++++++++++++++++----------------
1 files changed, 97 insertions(+), 49 deletions(-)
diff --git a/src/main/resources/mapper/progressTrack/DjJdgzTrackRecordDao.xml b/src/main/resources/mapper/progressTrack/DjJdgzTrackRecordDao.xml
index 7206048..c7e0e53 100644
--- a/src/main/resources/mapper/progressTrack/DjJdgzTrackRecordDao.xml
+++ b/src/main/resources/mapper/progressTrack/DjJdgzTrackRecordDao.xml
@@ -36,6 +36,7 @@
c.dept_id,
c.cabin_id,
c.iseal_cabin,
+ c.islt,
c.type,
c.`NAME` as level3NetworkName,
a.PROCESS_NAME AS level3NodeName,
@@ -85,11 +86,13 @@
AND e.IS_DELETE = 0
AND f.IS_DELETE = 0
AND g.IS_DELETE = 0
+ <if test="level1NetworkId!=null">
AND g.id = ${level1NetworkId}
+ </if>
<if test="deptId!=null">
and c.dept_id = ${deptId}
</if>
- <if test="isealCabin!=10000">
+ <if test="isealCabin!=10000 and isealCabin!=null">
and c.iseal_cabin = ${isealCabin}
</if>
<if test="teamId!=null">
@@ -136,38 +139,38 @@
</select>
<select id="getReport" resultType="com.example.server.progressTrack.Dto.StatistReportsDto">
select d.*, e.name as teamGroupName
- from (
- select TEAMGROUP_ID,
- count(1) as allNum,
- sum(case when status = 'zcjxz' or status = 'lq' then 1 else 0 end) as jxzNum,
- sum(case when status = 'lq' then 1 else 0 end) as lqNum,
- sum(case when status = 'yq' then 1 else 0 end) as yqNum,
- sum(case when status = 'zcwc' then 1 else 0 end) as zcwcNum,
- sum(case when status = 'cqwc' then 1 else 0 end) as cqwcNum
- from (
- select a.TEAMGROUP_ID,
- CASE
- WHEN b.CURRENT_STATUS = 1
- AND b.REQUIRED_COMPLETION_TIME > b.ACTUAL_COMPLETION THEN
- 'cqwc'
- WHEN b.CURRENT_STATUS = 1 THEN
- 'zcwc'
- WHEN b.REQUIRED_COMPLETION_TIME < (SELECT datetime('now')) THEN 'yq'
- WHEN b.REQUIRED_COMPLETION_TIME <
- (SELECT date('now', '-' || c.advent_day || ' days')) THEN 'lq'
+ from (select TEAMGROUP_ID,
+ count(1) as allNum,
+ sum(case when status = 'zcjxz' or status = 'lq' then 1 else 0 end) as jxzNum,
+ sum(case when status = 'lq' then 1 else 0 end) as lqNum,
+ sum(case when status = 'yq' then 1 else 0 end) as yqNum,
+ sum(case when status = 'zcwc' then 1 else 0 end) as zcwcNum,
+ sum(case when status = 'cqwc' then 1 else 0 end) as cqwcNum
+ from (select c.TEAMGROUP_ID,
+ CASE
+ WHEN b.CURRENT_STATUS = 1
+ AND b.REQUIRED_COMPLETION_TIME > b.ACTUAL_COMPLETION THEN
+ 'cqwc'
+ WHEN b.CURRENT_STATUS = 1 THEN
+ 'zcwc'
+ WHEN b.REQUIRED_COMPLETION_TIME < (SELECT datetime('now')) THEN 'yq'
+ WHEN b.REQUIRED_COMPLETION_TIME <
+ (SELECT date('now', '-' || d.advent_day || ' days')) THEN 'lq'
ELSE 'zcjxz'
END AS status
- from dj_jdgz_network_level3 a,
- dj_jdgz_network_level3_list b,
- dj_jdgz_network_level1 c
- where a.IS_DELETE = 0
- and a.LEVEL1_NETWORK_ID = ${level1NetworkId}
- and a.LEVEL1_NETWORK_ID = c.id
- and b.IS_DELETE = 0
- and b.NETWORK_ID = a.id
- ) c
- group by TEAMGROUP_ID
- ) d,
+ FROM dj_jdgz_track_record a
+ LEFT JOIN dj_jdgz_network_level3_list b
+ on b.ID = a.LEVEL3_NODE_ID
+ LEFT JOIN dj_jdgz_network_level3 c on c.ID = b.NETWORK_ID
+ LEFT JOIN dj_jdgz_network_level1 d on d.ID = c.LEVEL1_NETWORK_ID
+ where c.IS_DELETE = 0
+ and c.LEVEL1_NETWORK_ID = ${level1NetworkId}
+ and c.LEVEL1_NETWORK_ID = d.id
+ and b.IS_DELETE = 0
+ and a.IS_DELETE = 0
+ and d.IS_DELETE = 0
+ and b.NETWORK_ID = c.id) c
+ group by TEAMGROUP_ID ) d,
dj_sys_teamgroup_class e
where d.TEAMGROUP_ID = e.id
</select>
@@ -257,7 +260,7 @@
a.IS_DELETE = 0
and a.network_id != 10000
<if test="teamgroupId!=null and teamgroupId!=''">
- AND a.TEAMGROUP_ID in (${teamgroupId})
+ AND h.ID in (${teamgroupId})
</if>
<if test="istq!=1 and istq!=null">
AND a.REQUIRED_COMPLETION_TIME < b.estimated_completion_time
@@ -469,24 +472,26 @@
a.REQUIRED_COMPLETION_TIME
</select>
<select id="getReportRecord" resultType="com.example.server.progressTrack.Dto.ReportRecordDto">
- select a.NAME,b.PROCESS_NAME
- from dj_jdgz_network_level3 a,
- dj_jdgz_network_level3_list b,
- dj_jdgz_network_level1 c
+ select c.NAME,b.PROCESS_NAME
+ FROM dj_jdgz_track_record a
+ LEFT JOIN dj_jdgz_network_level3_list b on b.ID = a.LEVEL3_NODE_ID
+ LEFT JOIN dj_jdgz_network_level3 c on c.ID = b.NETWORK_ID
+ LEFT JOIN dj_jdgz_network_level1 d on d.ID = c.LEVEL1_NETWORK_ID
where a.IS_DELETE = 0
- and a.LEVEL1_NETWORK_ID = ${level1NetworkId}
- and a.TEAMGROUP_ID = ${teamgroupId}
- and a.LEVEL1_NETWORK_ID = c.id
+ and c.LEVEL1_NETWORK_ID = ${level1NetworkId}
+ and c.TEAMGROUP_ID = ${teamgroupId}
+ and c.LEVEL1_NETWORK_ID = d.id
and b.IS_DELETE = 0
- and b.NETWORK_ID = a.id
+ and b.NETWORK_ID = c.id
and c.IS_DELETE = 0
+ and d.IS_DELETE = 0
<if test="column==2">
and (b.CURRENT_STATUS = 0 or b.CURRENT_STATUS is null)
- and b.REQUIRED_COMPLETION_TIME >= ( SELECT date( 'now', '-' || c.advent_day || ' days' ) )
+ and b.REQUIRED_COMPLETION_TIME >= ( SELECT date( 'now', '-' || d.advent_day || ' days' ) )
</if>
<if test="column==3">
and (b.CURRENT_STATUS = 0 or b.CURRENT_STATUS is null)
- and b.REQUIRED_COMPLETION_TIME < ( SELECT date( 'now', '-' || c.advent_day || ' days' ) )
+ and b.REQUIRED_COMPLETION_TIME < ( SELECT date( 'now', '-' || d.advent_day || ' days' ) )
</if>
<if test="column==4">
and (b.CURRENT_STATUS = 0 or b.CURRENT_STATUS is null)
@@ -507,13 +512,56 @@
WHERE LEVEL3_NETWORK_ID = ${level3NetworkId}
AND process_name = #{processName}
AND is_delete = 0
- AND update_date = (
- SELECT MAX(update_date)
- FROM dj_jdgz_track_record
- WHERE LEVEL3_NETWORK_ID = ${level3NetworkId}
- AND process_name = #{processName}
- AND is_delete = 0
- )
+ <if test="weekNo!=null">
+ and week_no = ${weekNo}
+ </if>
+ limit 1
+ </select>
+ <select id="getName" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord">
+ SELECT
+ PROCESS_NAME
+ FROM
+ dj_jdgz_track_record
+ WHERE
+ is_delete = 0
+ AND LEVEL3_NETWORK_ID = ${level3NetworkId}
+ GROUP BY
+ PROCESS_NAME
+ ORDER BY
+ CREATE_DATE ,UPDATE_DATE
+ </select>
+ <select id="isExistTrackRecord" resultType="com.example.server.progressTrack.model.DjJdgzNetworkLevel3List">
+ select a.*,b.id as trackRecordId
+ from dj_jdgz_network_level3_list a
+ left join dj_jdgz_track_record b on b.is_delete = 0 and a.id = b.LEVEL3_NODE_ID
+ where a.is_delete = 0
+ and a.network_id = ${level3NetworkId}
+ and a.sort > ${sort}
+ order by a.sort
+ limit 1
+ </select>
+ <select id="getRecordById" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord">
+ select GENERAL_REPAIR_UNIT || ',' || GENERAL_REPAIR_UNIT_DIRECTOR || ',' ||
+ GENERAL_REPAIR_UNIT_CONTACT AS generalRepair,
+ REPAIR_UNIT || ',' || REPAIR_UNIT_DIRECTOR || ',' || REPAIR_UNIT_CONTACT AS `repair`,
+ track_person || ',' || track_person_unit || ',' || track_person_contact AS trackPerson,
+ tracked_person || ',' || tracked_person_unit || ',' || tracked_person_contact AS trackedPerson,
+ track_method,
+ track_location,
+ CURRENT_STATUS,
+ has_delay_risk,
+ estimated_completion_time,
+ problem,
+ followup_plan,
+ remark,
+ process_name
+ from dj_jdgz_track_record
+ where level3_network_id = ${id}
+ and is_delete = 0
+ </select>
+ <select id="getAll" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord">
+ select *
+ from dj_jdgz_track_record
</select>
</mapper>
--
Gitblit v1.9.1