可配余额问题

dev
wuwenxiong 2022-03-09 10:21:36 +08:00
parent 9cedc28427
commit f6f0774106
1 changed files with 27 additions and 17 deletions

View File

@ -197,9 +197,10 @@ public class PresellOrderService extends BaseService {
params.add(id);
params.add(id);
params.add(id);
params.add(id);
String sql = "SELECT\n" +
" IFNULL(\n" +
" IFNULL(\n" +
" (\n" +
" SELECT\n" +
" (\n" +
@ -216,22 +217,31 @@ public class PresellOrderService extends BaseService {
" 0\n" +
" )\n" +
" ) - (\n" +
" IFNULL(\n" +
" (\n" +
" SELECT\n" +
" sum(\n" +
" t.total_price\n" +
" )\n" +
" FROM\n" +
" order_temp t\n" +
" WHERE\n" +
" t.sale_type = 1\n" +
" AND t.state = 5\n" +
" AND t.customer_id = ?\n" +
" ),\n" +
" 0\n" +
" )\n" +
" ) - (\n" +
" IFNULL(\n" +
" (\n" +
" SELECT\n" +
" sum(t.total_price)\n" +
" FROM\n" +
" order_temp t\n" +
" WHERE\n" +
" t.sale_type = 1\n" +
" AND t.state = 5\n" +
" AND t.customer_id = ?\n" +
" AND NOT EXISTS (\n" +
" SELECT\n" +
" *\n" +
" FROM\n" +
" ordercluster c\n" +
" WHERE\n" +
" c.sale_type = 1\n" +
" AND c.state < 5\n" +
" AND c.customer_id = ?\n" +
" AND t.ordercluster_id = c.id\n" +
" )\n" +
" ),\n" +
" 0\n" +
" )\n" +
" ) - (\n" +
" IFNULL(\n" +
" (\n" +
" SELECT\n" +