diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java index cbd6543..02db808 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/sale/OrderStatService.java @@ -2164,7 +2164,20 @@ public class OrderStatService { 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" + " 99 supermarket_id,\n" + " ifnull(sum(t.weight), 0) weight,\n" + @@ -2205,11 +2218,12 @@ public class OrderStatService { " ifnull(sum(t.total_price), 0) total_price\n" + " from order_temp t\n" + " where t.state = 5\n" + + " and t.supermarket_id != 4\n" + " and t.create_time>= ? \n" + " and t.create_time<= ?\n" + paramsSql + " group by t.customer_id, t.supermarket_id\n" + - sql_union + + union_4 + union_99 + " ) g\n" + " group by g.customer_id\n";