This commit is contained in:
苏尹岚
2021-03-17 15:03:05 +08:00
parent 9dc520daa3
commit d40a381552
2 changed files with 30 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
package dao
import (
"fmt"
"sort"
"time"
@@ -1231,8 +1230,6 @@ func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType
sqlParams = append(sqlParams, pageSize, offset)
Begin(db)
defer Commit(db)
fmt.Println(sql)
fmt.Println(sqlParams)
if err = GetRows(db, &requestList, sql, sqlParams...); err == nil {
return &model.PagedInfo{
TotalCount: GetLastTotalRowCount(db),
@@ -1241,3 +1238,30 @@ func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType
}
return pagedInfo, err
}
func GetStoreManageStateSimple(db *DaoDB, storeIDs, brandIDs []int, vendorID int) (pagedInfo []*model.StoreManageState, err error) {
sql := `
SELECT a.*
FROM store_manage_state a
LEFT JOIN store b ON b.id = a.store_id AND b.deleted_at = ?
WHERE a.vendor_status <> ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
model.StoreStatusDisabled,
}
if len(storeIDs) > 0 {
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if len(brandIDs) > 0 {
sql += " AND b.brand_id IN (" + GenQuestionMarks(len(brandIDs)) + ")"
sqlParams = append(sqlParams, brandIDs)
}
if vendorID != -1 {
sql += " AND a.vendor_id = ?"
sqlParams = append(sqlParams, vendorID)
}
err = GetRows(db, &pagedInfo, sql, sqlParams...)
return pagedInfo, err
}