作者 yangfu

商品统计修改

@@ -32,7 +32,7 @@ func (dao *OrderGoodDao) CooperationGoodsStatistics(queryOptions map[string]inte @@ -32,7 +32,7 @@ func (dao *OrderGoodDao) CooperationGoodsStatistics(queryOptions map[string]inte
32 if v, ok := queryOptions["limit"]; ok { 32 if v, ok := queryOptions["limit"]; ok {
33 queryLimit += fmt.Sprintf("limit %v \n", v) 33 queryLimit += fmt.Sprintf("limit %v \n", v)
34 } 34 }
35 - sql := fmt.Sprintf(`select order_good_name good_name,sum(coalesce(order_good_amount,0)) good_amount from order_goods 35 + sql := fmt.Sprintf(`select order_good_name good_name,sum(coalesce(case when dividends_order_number is not null then order_good_amount else -order_good_amount end,0)) good_amount from order_goods
36 where company_id=? and org_id = ? and deleted_at is null %v 36 where company_id=? and org_id = ? and deleted_at is null %v
37 GROUP BY order_good_name 37 GROUP BY order_good_name
38 order by good_amount desc 38 order by good_amount desc