aa
This commit is contained in:
@@ -304,11 +304,12 @@ func getStoreStatusCount(db *dao.DaoDB, cityCodes []int, vendorID, status int) (
|
||||
countType := &struct{ Count int }{}
|
||||
sqlParams := []interface{}{}
|
||||
sql := `
|
||||
SELECT COUNT(a.id) count
|
||||
SELECT COUNT(DISTINCT a.id) count
|
||||
FROM store a
|
||||
LEFT JOIN store_map b ON a.id = b.store_id AND b.deleted_at = ?
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.DefaultTimeValue)
|
||||
if len(cityCodes) > 0 {
|
||||
sql += " AND a.city_code IN (" + dao.GenQuestionMarks(len(cityCodes)) + ")"
|
||||
sqlParams = append(sqlParams, cityCodes)
|
||||
@@ -320,13 +321,8 @@ func getStoreStatusCount(db *dao.DaoDB, cityCodes []int, vendorID, status int) (
|
||||
sql += " AND a.status = ?"
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
sql += `
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
||||
fmt.Println(sql)
|
||||
fmt.Println(sqlParams)
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.DefaultTimeValue)
|
||||
err = dao.GetRow(db, &countType, sql, sqlParams)
|
||||
return countType.Count, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user