| | |
| | | <!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.DjJdgzTrackRecordDao"> |
| | | <update id="retract"> |
| | | UPDATE dj_jdgz_track_record |
| | | SET CURRENT_STATUS = 0 |
| | | WHERE LEVEL3_NETWORK_ID = ( |
| | | SELECT LEVEL3_NETWORK_ID |
| | | FROM dj_jdgz_track_record |
| | | WHERE id = ${id} |
| | | ) |
| | | AND create_date >= ( |
| | | SELECT create_date |
| | | FROM dj_jdgz_track_record |
| | | WHERE id = ${id} |
| | | ); |
| | | </update> |
| | | |
| | | <select id="getList" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord"> |
| | | SELECT |
| | |
| | | b.LEVEL3_NODE_ID ELSE a.id |
| | | END AS level3NodeId, |
| | | c.id as level3NetworkId, |
| | | c.teamgroup_name, |
| | | c.dept_id, |
| | | c.cabin_id, |
| | | c.iseal_cabin, |
| | | c.type, |
| | | c.`NAME` as level3NetworkName, |
| | | a.PROCESS_NAME AS level3NodeName, |
| | | a.REQUIRED_COMPLETION_TIME, |
| | |
| | | WHERE |
| | | a.IS_DELETE = 0 |
| | | and a.network_id != 10000 |
| | | <if test="userId!=null"> |
| | | AND a.TEAMGROUP_ID in (select teamgroup from sys_user where is_delete=0 and user_id=#{userId}) |
| | | </if> |
| | | <if test="status==1"> |
| | | AND b.CURRENT_STATUS = 1 |
| | | </if> |
| | |
| | | AND f.IS_DELETE = 0 |
| | | AND g.IS_DELETE = 0 |
| | | AND g.id = ${level1NetworkId} |
| | | <if test="deptId!=null"> |
| | | and c.dept_id = ${deptId} |
| | | </if> |
| | | <if test="isealCabin!=null"> |
| | | and c.iseal_cabin = ${isealCabin} |
| | | </if> |
| | | <if test="teamId!=null"> |
| | | and c.TEAMGROUP_ID = ${teamId} |
| | | </if> |
| | | <if test="cabinId!=null"> |
| | | and c.cabin_id = ${cabinId} |
| | | </if> |
| | | <if test="type!=null and type!=''"> |
| | | and c.type = #{type} |
| | | </if> |
| | | <if test="name!=null and name!=''"> |
| | | and c.name LIKE '%${name}%' |
| | | </if> |
| | | <if test="status==0"> |
| | | GROUP BY |
| | | c.id |
| | |
| | | </select> |
| | | <select id="getHistory" 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_contact AS trackPerson, |
| | | tracked_person || ',' || tracked_person_contact AS trackedPerson, |
| | | 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, |
| | |
| | | <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 b.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' |
| | | 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, |
| | | dj_sys_teamgroup_class e |
| | | 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' |
| | | 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, |
| | | dj_sys_teamgroup_class e |
| | | where d.TEAMGROUP_ID = e.id |
| | | </select> |
| | | <select id="prompt" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord"> |
| | |
| | | e.PROCESS_NAME AS level1NodeName, |
| | | f.project_name, |
| | | g.week_no, |
| | | h.name as teamGroupName |
| | | b.TEAMGROUP_NAME |
| | | FROM |
| | | `dj_jdgz_network_level3_list` a |
| | | LEFT JOIN dj_jdgz_network_level3 b ON b.id = a.NETWORK_ID |
| | |
| | | dj_jdgz_track_record where is_delete = 0 ) |
| | | and a.is_delete = 0 |
| | | <if test="userId!=null"> |
| | | AND a.TEAMGROUP_ID in (select teamgroup from sys_user where is_delete=0 and user_id=#{userId}) |
| | | AND a.TEAMGROUP_ID in (select teamgroup from sys_user where is_delete=0 and id=#{userId}) |
| | | </if> |
| | | AND b.IS_DELETE = 0 |
| | | AND c.IS_DELETE = 0 |
| | |
| | | b.GENERAL_REPAIR_UNIT|| ',' || b.GENERAL_REPAIR_UNIT_DIRECTOR|| ',' || |
| | | b.GENERAL_REPAIR_UNIT_CONTACT AS generalRepair, |
| | | b.REPAIR_UNIT|| ',' || b.REPAIR_UNIT_DIRECTOR|| ',' || b.REPAIR_UNIT_CONTACT AS `repair`, |
| | | b.track_person|| ',' || b.track_person_contact AS trackPerson, |
| | | b.tracked_person|| ',' || b.tracked_person_contact AS trackedPerson, |
| | | b.track_person|| ',' || b.track_person_unit || ',' || b.track_person_contact AS trackPerson, |
| | | b.tracked_person|| ',' || b.tracked_person_unit || ',' || b.tracked_person_contact AS trackedPerson, |
| | | b.track_method, |
| | | b.track_location, |
| | | b.track_location, |
| | |
| | | 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 = a.TEAMGROUP_ID |
| | | LEFT JOIN dj_sys_teamgroup_class h ON h.id = c.TEAMGROUP_ID |
| | | WHERE |
| | | a.IS_DELETE = 0 |
| | | and a.network_id != 10000 |
| | |
| | | from dj_jdgz_track_record |
| | | where LEVEL3_NODE_ID = ${level3NodeId} |
| | | </select> |
| | | <select id="getListByImport" resultType="com.example.server.progressTrack.model.DjJdgzTrackRecord"> |
| | | SELECT |
| | | c.id, |
| | | c.`NAME` as level3NetworkName, |
| | | CASE |
| | | WHEN |
| | | b.GENERAL_REPAIR_UNIT IS NOT NULL THEN b.GENERAL_REPAIR_UNIT else |
| | | c.GENERAL_REPAIR_UNIT |
| | | END as GENERAL_REPAIR_UNIT, |
| | | CASE |
| | | WHEN |
| | | b.GENERAL_REPAIR_UNIT_DIRECTOR IS NOT NULL THEN b.GENERAL_REPAIR_UNIT_DIRECTOR else |
| | | c.GENERAL_REPAIR_UNIT_DIRECTOR |
| | | END as GENERAL_REPAIR_UNIT_DIRECTOR, |
| | | CASE |
| | | WHEN |
| | | b.GENERAL_REPAIR_UNIT_CONTACT IS NOT NULL THEN |
| | | b.GENERAL_REPAIR_UNIT_CONTACT else |
| | | c.GENERAL_REPAIR_UNIT_CONTACT |
| | | END as GENERAL_REPAIR_UNIT_CONTACT, |
| | | CASE |
| | | WHEN |
| | | b.REPAIR_UNIT IS NOT NULL THEN b.REPAIR_UNIT else |
| | | c.REPAIR_UNIT |
| | | END as REPAIR_UNIT, |
| | | CASE |
| | | WHEN |
| | | b.REPAIR_UNIT_DIRECTOR IS NOT NULL THEN b.REPAIR_UNIT_DIRECTOR else |
| | | c.REPAIR_UNIT_DIRECTOR |
| | | END as REPAIR_UNIT_DIRECTOR, |
| | | CASE |
| | | WHEN |
| | | b.REPAIR_UNIT_CONTACT IS NOT NULL THEN |
| | | b.REPAIR_UNIT_CONTACT else |
| | | c.REPAIR_UNIT_CONTACT |
| | | END as REPAIR_UNIT_CONTACT, |
| | | b.track_person, |
| | | b.track_person_unit, |
| | | b.track_person_contact, |
| | | b.tracked_person, |
| | | b.tracked_person_unit, |
| | | b.tracked_person_contact |
| | | FROM |
| | | dj_jdgz_network_level3_list a |
| | | LEFT JOIN ( |
| | | SELECT * |
| | | FROM dj_jdgz_track_record |
| | | WHERE (LEVEL3_NODE_ID, update_date) IN ( |
| | | SELECT LEVEL3_NODE_ID, MAX(update_date) |
| | | FROM dj_jdgz_track_record |
| | | GROUP BY LEVEL3_NODE_ID |
| | | ) |
| | | ) b ON b.LEVEL3_NODE_ID = a.id |
| | | LEFT JOIN dj_jdgz_network_level3 c ON c.id = a.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 |
| | | WHERE |
| | | a.IS_DELETE = 0 |
| | | and a.network_id != 10000 |
| | | <if test="selectedIds!=null and selectedIds!=''"> |
| | | AND c.TEAMGROUP_ID in (${selectedIds}) |
| | | </if> |
| | | and (b.CURRENT_STATUS IS null OR b.CURRENT_STATUS = 0) |
| | | 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 g.id = ${level1Id} |
| | | <if test="level2Id!=null"> |
| | | AND e.id = ${level2Id} |
| | | </if> |
| | | <if test="level2NodeId!=null"> |
| | | AND d.id = ${level2NodeId} |
| | | </if> |
| | | GROUP BY |
| | | c.id |
| | | ORDER BY |
| | | 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 |
| | | where a.IS_DELETE = 0 |
| | | and a.LEVEL1_NETWORK_ID = ${level1NetworkId} |
| | | and a.TEAMGROUP_ID = ${teamgroupId} |
| | | and a.LEVEL1_NETWORK_ID = c.id |
| | | and b.IS_DELETE = 0 |
| | | and b.NETWORK_ID = a.id |
| | | and c.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' ) ) |
| | | </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' ) ) |
| | | </if> |
| | | <if test="column==4"> |
| | | and (b.CURRENT_STATUS = 0 or b.CURRENT_STATUS is null) |
| | | and b.REQUIRED_COMPLETION_TIME < ( SELECT datetime( 'now' ) ) |
| | | </if> |
| | | <if test="column==5"> |
| | | and b.CURRENT_STATUS = 1 |
| | | AND b.REQUIRED_COMPLETION_TIME <= b.ACTUAL_COMPLETION |
| | | </if> |
| | | <if test="column==6"> |
| | | and b.CURRENT_STATUS = 1 |
| | | AND b.REQUIRED_COMPLETION_TIME > b.ACTUAL_COMPLETION |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |