作者 yangfu

商品统计修改

... ... @@ -32,7 +32,7 @@ func (dao *OrderGoodDao) CooperationGoodsStatistics(queryOptions map[string]inte
if v, ok := queryOptions["limit"]; ok {
queryLimit += fmt.Sprintf("limit %v \n", v)
}
sql := fmt.Sprintf(`select order_good_name good_name,sum(coalesce(order_good_amount,0)) good_amount from order_goods
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
where company_id=? and org_id = ? and deleted_at is null %v
GROUP BY order_good_name
order by good_amount desc
... ...