This commit is contained in:
邹宗楠
2025-05-08 14:18:20 +08:00
parent e251b0f606
commit 7a5a2f3e85
2 changed files with 22 additions and 5 deletions

View File

@@ -8,13 +8,12 @@ import (
)
// GetBadCommentOrderId 根据差评商品列表获取订单号
func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameList []string) (string, error) {
func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameList []string, skuList []int) (string, error) {
sqlParams := []interface{}{}
sql := `
SELECT count(s.vendor_order_id) count,s.vendor_order_id FROM goods_order g
LEFT JOIN order_sku s ON g.vendor_order_id = s.vendor_order_id
WHERE g.jx_store_id = ? AND g.vendor_id = ? AND g.order_created_at >= ? AND g.order_created_at <= ? AND s.sku_name IN (` + dao.GenQuestionMarks(len(foodNameList)) + `) GROUP BY s.vendor_order_id LIMIT 0, 1000
`
WHERE g.jx_store_id = ? AND g.vendor_id = ? AND g.order_created_at >= ? AND g.order_created_at <= ?`
sqlParams = append(sqlParams, []interface{}{
jxStoreId,
model.VendorIDMTWM,
@@ -22,6 +21,14 @@ func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameL
endTime,
foodNameList,
})
if len(foodNameList) != 0 {
sql += `AND s.sku_name IN (` + dao.GenQuestionMarks(len(foodNameList)) + `) GROUP BY s.vendor_order_id LIMIT 0, 1000`
sqlParams = append(sqlParams, foodNameList)
}
if len(skuList) != 0 {
sql += `AND s.sku_id IN (` + dao.GenQuestionMarks(len(skuList)) + `) GROUP BY s.vendor_order_id LIMIT 0, 1000`
sqlParams = append(sqlParams, skuList)
}
commentOrder := make([]*badCommentOrder, 0, 0)
if err := GetRows(GetDB(), &commentOrder, sql, sqlParams...); err != nil {