各砂站运输量统计表调整-增加石畈砂站虚拟站-2

dev
wuwenxiong 2021-10-19 09:57:16 +08:00
parent 87dcf2c864
commit 98f59cd9e8
1 changed files with 16 additions and 2 deletions

View File

@ -2164,7 +2164,20 @@ public class OrderStatService {
paramsSql = "and t.invoice_type = ? \n"; paramsSql = "and t.invoice_type = ? \n";
} }
String sql_union = "union select\n" + String union_4 = "union select\n" +
" ifnull(t.customer_id, 0) customer_id,\n" +
" t.supermarket_id,\n" +
" ifnull(sum(t.weight), 0) weight,\n" +
" ifnull(sum(t.total_price), 0) total_price\n" +
" from order_temp t\n" +
" where t.state = 5\n" +
" and t.supermarket_id = 4" +
" and (t.create_time < '2021-09-08 00:00:00' \n" +
" or t.create_time > '2021-10-15 23:59:59')\n" +
paramsSql +
" group by t.customer_id\n";
String union_99 = "union select\n" +
" ifnull(t.customer_id, 0) customer_id,\n" + " ifnull(t.customer_id, 0) customer_id,\n" +
" 99 supermarket_id,\n" + " 99 supermarket_id,\n" +
" ifnull(sum(t.weight), 0) weight,\n" + " ifnull(sum(t.weight), 0) weight,\n" +
@ -2205,11 +2218,12 @@ public class OrderStatService {
" ifnull(sum(t.total_price), 0) total_price\n" + " ifnull(sum(t.total_price), 0) total_price\n" +
" from order_temp t\n" + " from order_temp t\n" +
" where t.state = 5\n" + " where t.state = 5\n" +
" and t.supermarket_id != 4\n" +
" and t.create_time>= ? \n" + " and t.create_time>= ? \n" +
" and t.create_time<= ?\n" + " and t.create_time<= ?\n" +
paramsSql + paramsSql +
" group by t.customer_id, t.supermarket_id\n" + " group by t.customer_id, t.supermarket_id\n" +
sql_union + union_4 + union_99 +
" ) g\n" + " ) g\n" +
" group by g.customer_id\n"; " group by g.customer_id\n";