Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark

This commit is contained in:
gazebo
2019-11-25 18:14:13 +08:00

View File

@@ -63,7 +63,7 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time,
LEFT JOIN
(
SELECT
a.store_id,
IF(a.jx_store_id <> 0,a.jx_store_id,store_id) store_id,
COUNT(*) order_counts,
SUM(sale_price) sale_price,
SUM(actual_pay_price) actual_pay_price,
@@ -88,11 +88,11 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time,
sqlParams = append(sqlParams, fromDate, toDate)
}
if len(storeIDs) > 0 {
sql += ` AND a.store_id IN(` + GenQuestionMarks(len(storeIDs)) + `)`
sql += ` AND IF(a.jx_store_id != 0, a.jx_store_id, a.store_id) IN(` + GenQuestionMarks(len(storeIDs)) + `)`
sqlParams = append(sqlParams, storeIDs)
}
sql += `
GROUP BY a.store_id
GROUP BY 1
)s
ON s.store_id = c.id
`
@@ -136,7 +136,7 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
LEFT JOIN
(
SELECT
a.store_id,
IF(a.jx_store_id <> 0,a.jx_store_id,store_id) store_id,
COUNT(*) order_counts,
SUM(sale_price) sale_price,
SUM(actual_pay_price) actual_pay_price,
@@ -160,11 +160,11 @@ func GetGetStatisticsReportForAfsOrders(db *DaoDB, storeIDs []int, fromDate time
sqlParams = append(sqlParams, fromDate, toDate)
}
if len(storeIDs) > 0 {
sql += ` AND a.store_id IN(` + GenQuestionMarks(len(storeIDs)) + `)`
sql += ` AND IF(a.jx_store_id != 0, a.jx_store_id, a.store_id) IN(` + GenQuestionMarks(len(storeIDs)) + `)`
sqlParams = append(sqlParams, storeIDs)
}
sql += `
GROUP BY a.store_id
GROUP BY 1
)s
ON s.store_id = c.id
`