|
|
@@ -96,15 +96,9 @@
|
|
96
|
96
|
</choose>,
|
|
97
|
97
|
IFNULL(SUM(item_quantity), 0) AS seizeNum
|
|
98
|
98
|
FROM ledger_seizure_stats
|
|
99
|
|
- WHERE
|
|
100
|
|
- del_flag = '0'
|
|
101
|
|
- <!-- 近30天自然日 -->
|
|
102
|
|
- AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
|
|
103
|
|
- AND record_date <= CURDATE()
|
|
104
|
|
- <!-- 三级动态筛选 -->
|
|
105
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
106
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
107
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
99
|
+ <where>
|
|
|
100
|
+ <include refid="FILTER_FIXED_DATE_CRITERIA_SQL"/>
|
|
|
101
|
+ </where>
|
|
108
|
102
|
<!-- 动态分组:重点!全为空时仅按日期分组 -->
|
|
109
|
103
|
GROUP BY
|
|
110
|
104
|
<choose>
|
|
|
@@ -129,15 +123,9 @@
|
|
129
|
123
|
</choose>,
|
|
130
|
124
|
IFNULL(SUM(item_quantity), 0) AS seizeNum
|
|
131
|
125
|
FROM ledger_seizure_stats
|
|
132
|
|
- WHERE
|
|
133
|
|
- del_flag = '0'
|
|
134
|
|
- <!-- 近30天自然日 -->
|
|
135
|
|
- AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
|
|
136
|
|
- AND record_date <= CURDATE()
|
|
137
|
|
- <!-- 三级筛选条件 -->
|
|
138
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
139
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
140
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
126
|
+ <where>
|
|
|
127
|
+ <include refid="FILTER_FIXED_DATE_CRITERIA_SQL"/>
|
|
|
128
|
+ </where>
|
|
141
|
129
|
<!-- 动态分组,严格层级下钻 -->
|
|
142
|
130
|
GROUP BY
|
|
143
|
131
|
<choose>
|
|
|
@@ -159,12 +147,9 @@
|
|
159
|
147
|
</choose>,
|
|
160
|
148
|
IFNULL(SUM(item_quantity), 0) AS seizeNum
|
|
161
|
149
|
FROM ledger_seizure_stats
|
|
162
|
|
- WHERE
|
|
163
|
|
- del_flag = '0'
|
|
164
|
|
- AND record_date BETWEEN #{startDate} AND #{endDate}
|
|
165
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
166
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
167
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
150
|
+ <where>
|
|
|
151
|
+ <include refid="FILTER_FIXED_CRITERIA_SQL"/>
|
|
|
152
|
+ </where>
|
|
168
|
153
|
GROUP BY
|
|
169
|
154
|
<choose>
|
|
170
|
155
|
<when test="groupId != null">inspector_id</when>
|
|
|
@@ -179,27 +164,20 @@
|
|
179
|
164
|
<select id="statsTimeRangeTotal" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="java.lang.Integer">
|
|
180
|
165
|
SELECT IFNULL(SUM(item_quantity), 0)
|
|
181
|
166
|
FROM ledger_seizure_stats
|
|
182
|
|
- WHERE
|
|
183
|
|
- del_flag = '0'
|
|
184
|
|
- AND record_date BETWEEN #{startDate} AND #{endDate}
|
|
185
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
186
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
187
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
167
|
+ <where>
|
|
|
168
|
+ <include refid="FILTER_FIXED_CRITERIA_SQL"/>
|
|
|
169
|
+ </where>
|
|
188
|
170
|
</select>
|
|
189
|
171
|
|
|
190
|
172
|
<select id="countSeizeSubjectCategoryQuantity" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.SeizeCategoryQuantityVO">
|
|
191
|
173
|
SELECT item_category AS categoryName, IFNULL(SUM(item_quantity), 0) AS categoryNum
|
|
192
|
174
|
FROM ledger_seizure_stats
|
|
193
|
|
- WHERE
|
|
194
|
|
- del_flag = '0'
|
|
195
|
|
- AND record_date BETWEEN #{startDate} AND #{endDate}
|
|
196
|
|
- <!-- 三级联动筛选 -->
|
|
197
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
198
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
199
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
175
|
+ <where>
|
|
|
176
|
+ <include refid="FILTER_FIXED_CRITERIA_SQL"/>
|
|
200
|
177
|
<!-- 过滤空类别,避免脏数据 -->
|
|
201
|
178
|
AND item_category IS NOT NULL
|
|
202
|
179
|
AND item_category != ''
|
|
|
180
|
+ </where>
|
|
203
|
181
|
GROUP BY item_category
|
|
204
|
182
|
ORDER BY categoryNum DESC
|
|
205
|
183
|
</select>
|
|
|
@@ -207,16 +185,33 @@
|
|
207
|
185
|
<select id="countSeizeAreaQuantity" parameterType="com.sundot.airport.ledger.domain.vo.CountQueryReqVO" resultType="com.sundot.airport.ledger.domain.vo.SeizureAreaVO">
|
|
208
|
186
|
SELECT area_id AS areaId, work_area AS workArea, IFNULL(SUM(item_quantity), 0) AS areaSeizeNum
|
|
209
|
187
|
FROM ledger_seizure_stats
|
|
210
|
|
- WHERE
|
|
211
|
|
- del_flag = '0'
|
|
212
|
|
- AND record_date BETWEEN #{startDate} AND #{endDate}
|
|
213
|
|
- <!-- 三级联动筛选 -->
|
|
214
|
|
- <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
215
|
|
- <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
216
|
|
- <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
188
|
+ <where>
|
|
|
189
|
+ <include refid="FILTER_FIXED_CRITERIA_SQL"/>
|
|
217
|
190
|
<!-- 过滤空区域脏数据 -->
|
|
218
|
191
|
AND work_area IS NOT NULL AND work_area != ''
|
|
|
192
|
+ </where>
|
|
219
|
193
|
GROUP BY area_id, work_area
|
|
220
|
194
|
ORDER BY areaSeizeNum DESC
|
|
221
|
195
|
</select>
|
|
|
196
|
+
|
|
|
197
|
+ <sql id="FILTER_FIXED_CRITERIA_SQL">
|
|
|
198
|
+ del_flag = '0'
|
|
|
199
|
+ AND record_date BETWEEN #{startDate} AND #{endDate}
|
|
|
200
|
+ <include refid="FILTER_CRITERIA_SQL"/>
|
|
|
201
|
+ </sql>
|
|
|
202
|
+
|
|
|
203
|
+ <sql id="FILTER_FIXED_DATE_CRITERIA_SQL">
|
|
|
204
|
+ del_flag = '0'
|
|
|
205
|
+ <!-- 近30天自然日 -->
|
|
|
206
|
+ AND record_date >= DATE_SUB(CURDATE(), INTERVAL 29 DAY)
|
|
|
207
|
+ AND record_date <= CURDATE()
|
|
|
208
|
+ <include refid="FILTER_CRITERIA_SQL"/>
|
|
|
209
|
+ </sql>
|
|
|
210
|
+
|
|
|
211
|
+ <sql id="FILTER_CRITERIA_SQL">
|
|
|
212
|
+ <!-- 三级联动筛选 -->
|
|
|
213
|
+ <if test="deptId != null">AND dept_id = #{deptId}</if>
|
|
|
214
|
+ <if test="teamId != null">AND team_id = #{teamId}</if>
|
|
|
215
|
+ <if test="groupId != null">AND group_id = #{groupId}</if>
|
|
|
216
|
+ </sql>
|
|
222
|
217
|
</mapper>
|