|
...
|
...
|
@@ -132,6 +132,24 @@ |
|
132
|
132
|
AND tb.debt_status = #{vo.debtStatus}
|
|
133
|
133
|
</if>
|
|
134
|
134
|
</where>
|
|
|
135
|
+ ORDER BY
|
|
|
136
|
+ CASE
|
|
|
137
|
+ WHEN d.name like '宁波办%' THEN 1
|
|
|
138
|
+ WHEN d.name like '温州办%' THEN 2
|
|
|
139
|
+ WHEN d.name like '东莞办%' THEN 3
|
|
|
140
|
+ WHEN d.name like '佛山办%' THEN 4
|
|
|
141
|
+ WHEN d.name like '苏州办%' THEN 5
|
|
|
142
|
+ WHEN d.name like '常州办%' THEN 6
|
|
|
143
|
+ WHEN d.name like '北方办%' THEN 7
|
|
|
144
|
+ WHEN d.name like '紫铜办%' THEN 8
|
|
|
145
|
+ WHEN d.name like '外贸办%' THEN 9
|
|
|
146
|
+ ELSE 10 -- 其他办事处按字母顺序排在后面
|
|
|
147
|
+ END,
|
|
|
148
|
+ d.name ASC,
|
|
|
149
|
+ r.name ASC,
|
|
|
150
|
+ cs.short_name ASC,
|
|
|
151
|
+ oc.name ASC,
|
|
|
152
|
+ tb.shipment_date DESC
|
|
135
|
153
|
</select>
|
|
136
|
154
|
|
|
137
|
155
|
<select id="queryByCustomerShortName" resultMap="ReceiptLedgerInfo">
|
|
...
|
...
|
@@ -231,7 +249,8 @@ |
|
231
|
249
|
tb.region,
|
|
232
|
250
|
r.name as region_name,
|
|
233
|
251
|
max(cc.company_credit_limit) as quota,
|
|
234
|
|
- max(cc.company_settlement_period) as settle_term
|
|
|
252
|
+ max(cc.company_settlement_period) as settle_term,
|
|
|
253
|
+ sum(distinct rl.end_account_receivable) as end_account_total
|
|
235
|
254
|
from base_data_customer_short tb
|
|
236
|
255
|
left join sys_dept d on tb.dept_id = d.id
|
|
237
|
256
|
left join sys_dept r on tb.region = r.id
|
|
...
|
...
|
@@ -254,11 +273,27 @@ |
|
254
|
273
|
group by tb.short_name,tb.type,tb.dept_id,tb.region
|
|
255
|
274
|
having 1=1
|
|
256
|
275
|
<if test="vo.debtStartValue != null">
|
|
257
|
|
- and sum(rl.end_account_receivable) >= #{debtStartValue}
|
|
|
276
|
+ and sum(distinct rl.end_account_receivable) >= #{vo.debtStartValue}
|
|
258
|
277
|
</if>
|
|
259
|
278
|
<if test="vo.debtEndValue != null">
|
|
260
|
|
- and sum(rl.end_account_receivable) <= #{debtEndValue}
|
|
|
279
|
+ and sum(distinct rl.end_account_receivable) <= #{vo.debtEndValue}
|
|
261
|
280
|
</if>
|
|
|
281
|
+ order by
|
|
|
282
|
+ case
|
|
|
283
|
+ when d.name like '宁波办%' then 1
|
|
|
284
|
+ when d.name like '温州办%' then 2
|
|
|
285
|
+ when d.name like '东莞办%' then 3
|
|
|
286
|
+ when d.name like '佛山办%' then 4
|
|
|
287
|
+ when d.name like '苏州办%' then 5
|
|
|
288
|
+ when d.name like '常州办%' then 6
|
|
|
289
|
+ when d.name like '北方办%' then 7
|
|
|
290
|
+ when d.name like '紫铜办%' then 8
|
|
|
291
|
+ when d.name like '外贸办%' then 9
|
|
|
292
|
+ else 10 -- 其他办事处按字母顺序排在后面
|
|
|
293
|
+ end,
|
|
|
294
|
+ d.name asc,
|
|
|
295
|
+ r.name asc,
|
|
|
296
|
+ sum(distinct rl.end_account_receivable) desc
|
|
262
|
297
|
</select>
|
|
263
|
298
|
|
|
264
|
299
|
<select id="statisticsDebtByShortName" resultType="java.util.Map">
|
...
|
...
|
|