冲突修改

This commit is contained in:
苏尹岚
2019-12-02 11:14:20 +08:00
11 changed files with 111 additions and 37 deletions

View File

@@ -949,3 +949,31 @@ func UpdateOrdersWithoutJxStoreID(db *DaoDB, fromDate, toDate time.Time) (count
}
return ExecuteSQL(db, sql, sqlParams)
}
func GetMyOrderCountInfo(db *DaoDB, userID string, fromDate, toDate time.Time, statuss []int) (countInfo []*model.GoodsOrderCountInfo, err error) {
if utils.IsTimeZero(fromDate) {
return nil, fmt.Errorf("必须指定开始日期")
}
if utils.IsTimeZero(toDate) {
toDate = fromDate
}
sql := `
SELECT t1.lock_status, t1.status, COUNT(*) count
FROM goods_order t1
WHERE t1.user_id = ? AND t1.vendor_id = ?
AND t1.order_created_at >= ? AND t1.order_created_at <= ?
`
sqlParams := []interface{}{
userID,
model.VendorIDJX,
fromDate, toDate,
}
if len(statuss) > 0 {
sql += " AND t1.status IN (" + GenQuestionMarks(len(statuss)) + ")"
sqlParams = append(sqlParams, statuss)
}
sql += " GROUP BY 1,2"
err = GetRows(db, &countInfo, sql, sqlParams...)
return countInfo, err
}