chenshudong hai 1 mes
pai
achega
b10a660b43

+ 2 - 1
airport-common/src/main/java/com/sundot/airport/common/enums/EquipmentColorTypeEnum.java

@@ -13,7 +13,8 @@ public enum EquipmentColorTypeEnum {
13 13
     COLORLESS("COLORLESS", "无色"),
14 14
     RED("RED", "红色"),
15 15
     ORANGE("ORANGE", "橙色"),
16
-    YELLOW("YELLOW", "黄色");
16
+    YELLOW("YELLOW", "黄色"),
17
+    MIXED("MIXED", "混合");
17 18
 
18 19
     private final String code;
19 20
     private final String desc;

+ 35 - 0
airport-equipment/src/main/resources/mapper/equipment/EquipmentLedgerMapper.xml

@@ -133,6 +133,41 @@
133 133
                 inspection_team_member2_name like concat('%', #{inspectionTeamUserName}, '%')
134 134
                 )
135 135
             </if>
136
+            <choose>
137
+                <!-- 使用状态=在用 + 早于今天 -->
138
+                <when test="'RED'.equals(colorType)">
139
+                    AND usage_status = 'IN_USE'
140
+                    AND DATE(next_inspection_due_date) <![CDATA[ < ]]> CURDATE()
141
+                </when>
142
+
143
+                <!-- 使用状态=在用 + 两周内 -->
144
+                <when test="'ORANGE'.equals(colorType)">
145
+                    AND usage_status = 'IN_USE'
146
+                    AND next_inspection_due_date <![CDATA[ >= ]]> CURDATE()
147
+                    AND next_inspection_due_date <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 14 DAY)
148
+                </when>
149
+
150
+                <!-- 使用状态=在用 + 一月内 -->
151
+                <when test="'YELLOW'.equals(colorType)">
152
+                    AND usage_status = 'IN_USE'
153
+                    AND next_inspection_due_date <![CDATA[ >= ]]> CURDATE()
154
+                    AND next_inspection_due_date <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 30 DAY)
155
+                </when>
156
+
157
+                <!-- 使用状态=非在用 或 (使用状态=在用 + 一月外) -->
158
+                <when test="'COLORLESS'.equals(colorType)">
159
+                    AND (usage_status != 'IN_USE'
160
+                    OR (usage_status = 'IN_USE'
161
+                    AND next_inspection_due_date <![CDATA[ > ]]> DATE_ADD(CURDATE(), INTERVAL 30 DAY))
162
+                    )
163
+                </when>
164
+
165
+                <!-- 使用状态=在用 + (早于今天 或 一月内) -->
166
+                <when test="'MIXED'.equals(colorType)">
167
+                    AND usage_status = 'IN_USE'
168
+                    AND next_inspection_due_date <![CDATA[ <= ]]> DATE_ADD(CURDATE(), INTERVAL 30 DAY)
169
+                </when>
170
+            </choose>
136 171
         </where>
137 172
         order by
138 173
         case usage_status