|
|
@@ -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
|