lisai17@sina.com 2021-03-16 14:28:46 +08:00
parent 8dead8a5f4
commit e4cb4230a5
1 changed files with 4 additions and 19 deletions

View File

@ -739,29 +739,14 @@ public class OrderclusterService extends BaseService {
* @return * @return
*/ */
public BigDecimal undoPrice(int customer_id) { public BigDecimal undoPrice(int customer_id) {
String sql = "select(\n" + String sql = "select sum(t.`total_weight`* t.`unit_price`) `total_price`\n" +
" select sum(t.`total_weight` * t.`unit_price`) `total_price`\n" + " from `ordercluster` t\n" +
" from `ordercluster` t\n" + " where t.`customer_id`= ? \n" +
" where t.`customer_id`= ?\n" + " and t.state< ? ";
" and t.state < ? ) - (\n" +
" select sum(t.`weight` * t.`unit_price`) total_price\n" +
" from order_temp t\n" +
" where exists(\n" +
" select 1 from `ordercluster` o\n" +
" where o.`customer_id`= ?\n" +
" and o.id= t.`ordercluster_id`\n" +
" and o.`state`< ?" +
" )\n" +
" and t.`customer_id`= ?\n" +
" and t.`state`= ?)";
BigDecimal out = Db.queryBigDecimal( BigDecimal out = Db.queryBigDecimal(
sql, sql,
customer_id, customer_id,
OrderStateEnum.RECEIVED.getStateid(),
customer_id,
OrderStateEnum.RECEIVED.getStateid(),
customer_id,
OrderStateEnum.RECEIVED.getStateid() OrderStateEnum.RECEIVED.getStateid()
); );