jinlin
2025-03-01 86f02fee03614fef275c6e0c355d73318ca3025e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0" encoding="UTF-8"?>
<!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.DjJdgzNetworkLevel1Dao">
    <update id="deleteLevel3List">
        update dj_jdgz_network_level3_list
        set is_delete=1
        where network_id in (select id from dj_jdgz_network_level3 where LEVEL1_NETWORK_ID = #{id})
    </update>
 
    <update id="deleteLevel3">
        update dj_jdgz_network_level3
        set is_delete=1
        where LEVEL1_NETWORK_ID = #{id}
    </update>
 
    <update id="deleteLevel2List">
        update dj_jdgz_network_level2_list
        set is_delete=1
        where network_id in (select id from dj_jdgz_network_level2 where LEVEL1_NETWORK_ID = #{id})
    </update>
 
    <update id="deleteLevel2">
        update dj_jdgz_network_level2
        set is_delete=1
        where LEVEL1_NETWORK_ID = #{id}
    </update>
 
    <update id="deleteLevel1List">
        update dj_jdgz_network_level1_list
        set is_delete=1
        where NETWORK_ID = #{id}
    </update>
 
    <update id="deleteLevel1">
        update dj_jdgz_network_level1
        set is_delete=1
        where id = #{id}
    </update>
 
    <select id="getList" resultType="com.example.server.progressTrack.model.DjJdgzNetworkLevel1">
        select a.*
        from dj_jdgz_network_level1 a
        <where>
            a.is_delete = 0
            <if test="shipId!=null">
                and a.ship_id = ${shipId}
            </if>
        </where>
    </select>
 
    <update id="setLevel2StatusNull">
        update dj_jdgz_network_level2_list
        set CURRENT_STATUS=null,
            ACTUAL_COMPLETION=null,
            manual_set_flag=null
        where is_delete = 0
          and (ifnull(manual_set_flag, 0) = 0 or ifnull(current_status, 0) = 0);
    </update>
    <update id="setLevel2Status">
        update dj_jdgz_network_level2_list
        set CURRENT_STATUS=1,
            ACTUAL_COMPLETION=(select max(b.ACTUAL_COMPLETION)
                               from dj_jdgz_network_level3_list b,
                                    dj_jdgz_network_level3 c
                               where b.NETWORK_ID = c.id
                                 and c.LEVEL2_NODE_ID = dj_jdgz_network_level2_list.id
                                 and b.is_delete = 0
                                 and c.is_delete = 0)
        where is_delete = 0
          and (ifnull(manual_set_flag, 0) = 0 or ifnull(current_status, 0) = 0)
          and exists(select b.*
                     from dj_jdgz_network_level3_list b,
                          dj_jdgz_network_level3 c
                     where b.NETWORK_ID = c.id
                       and c.LEVEL2_NODE_ID = dj_jdgz_network_level2_list.id
                       and b.is_delete = 0
                       and c.is_delete = 0)
          and not exists(select b.*
                         from dj_jdgz_network_level3_list b,
                              dj_jdgz_network_level3 c
                         where b.NETWORK_ID = c.id
                           and c.LEVEL2_NODE_ID = dj_jdgz_network_level2_list.id
                           and b.is_delete = 0
                           and c.is_delete = 0
                           and (b.CURRENT_STATUS is null or b.CURRENT_STATUS = 0));
    </update>
    <update id="setLevel1StatusNull">
        update dj_jdgz_network_level1_list
        set CURRENT_STATUS=null,
            ACTUAL_COMPLETION=null,
            manual_set_flag=null
        where is_delete = 0
          and (ifnull(manual_set_flag, 0) = 0 or ifnull(current_status, 0) = 0);
    </update>
    <update id="setLevel1Status">
        update dj_jdgz_network_level1_list
        set CURRENT_STATUS=1,
            ACTUAL_COMPLETION=(select max(b.ACTUAL_COMPLETION)
                               from dj_jdgz_network_level2_list b,
                                    dj_jdgz_network_level2 c
                               where b.NETWORK_ID = c.id
                                 and c.LEVEL1_NODE_ID = dj_jdgz_network_level1_list.id
                                 and b.is_delete = 0
                                 and c.is_delete = 0)
        where is_delete = 0
          and (ifnull(manual_set_flag, 0) = 0 or ifnull(current_status, 0) = 0)
          and exists(select b.*
                     from dj_jdgz_network_level2_list b,
                          dj_jdgz_network_level2 c
                     where b.NETWORK_ID = c.id
                       and c.LEVEL1_NODE_ID = dj_jdgz_network_level1_list.id
                       and b.is_delete = 0
                       and c.is_delete = 0)
          and not exists(select b.*
                         from dj_jdgz_network_level2_list b,
                              dj_jdgz_network_level2 c
                         where b.NETWORK_ID = c.id
                           and c.LEVEL1_NODE_ID = dj_jdgz_network_level1_list.id
                           and b.is_delete = 0
                           and c.is_delete = 0
                           and (b.CURRENT_STATUS is null or b.CURRENT_STATUS = 0));
    </update>
 
    <select id="getNodeStatusData" resultType="com.example.server.progressTrack.Dto.NetworkNodeStatusDto">
        select ID, REQUIRED_COMPLETION AS REQUIRED_COMPLETION_TIME, ACTUAL_COMPLETION, CURRENT_STATUS
        from dj_jdgz_network_level1_list
        where IS_DELETE = 0
          and NETWORK_ID = ${id};
    </select>
 
    <select id="getListByLevel3"
            resultType="com.example.server.progressTrack.model.DjJdgzNetworkLevel1">
        SELECT a.*
        FROM dj_jdgz_network_level1 a,
             dj_jdgz_network_level3 b
        WHERE b.content IS NOT NULL
          and b.level1_network_id = a.id
          and a.is_delete = 0
          and b.is_delete = 0
        GROUP BY a.id
    </select>
    <select id="getProjectList" resultType="com.example.client.dto.JComboBoxItem">
        select id, project_name as `name`
        from dj_jdgz_network_level1
        where is_delete = 0
        ORDER BY year desc
    </select>
 
</mapper>