From bd428e9a0daf9c7eb8de14b2e7043d8a58cedbd3 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 4 Jun 2021 17:07:25 +0800 Subject: [PATCH] aa --- business/model/dao/dao_order.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 01c0bd7ba..46d232c6b 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -771,8 +771,8 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat offset = jxutils.FormalizePageOffset(offset) sql := fmt.Sprintf(` - SELECT a.* FROM ( - SELECT SQL_CALC_FOUND_ROWS + SELECT SQL_CALC_FOUND_ROWS a.* FROM ( + SELECT DISTINCT t1.*, CAST(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t1.order_pay_percentage > 0, t1.order_pay_percentage, %d) / 100) AS SIGNED) earning_price, t2.status waybill_status, t2.courier_name, t2.courier_mobile, @@ -987,8 +987,7 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat } } sql += ` - LIMIT ? OFFSET ?) a WHERE 1 = 1` - sqlParams = append(sqlParams, pageSize, offset) + ) a WHERE 1 = 1` if params["jxIncomeBegin"] != nil { if utils.MustInterface2Int64(params["jxIncomeBegin"]) != 0 { sqlWhere += " AND jx_income >= ?" @@ -1001,10 +1000,10 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat sqlParams = append(sqlParams, utils.MustInterface2Int64(params["jxIncomeEnd"])) } } + sql += " LIMIT ? OFFSET ?" + sqlParams = append(sqlParams, pageSize, offset) txDB, _ := Begin(db) defer Commit(db, txDB) - fmt.Println(sql) - fmt.Println(sqlParams) if err = GetRowsTx(txDB, &orders, sql, sqlParams...); err == nil { totalCount = GetLastTotalRowCount2(db, txDB) }