Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-09-23 16:58:39 +08:00
6 changed files with 135 additions and 168 deletions

View File

@@ -199,15 +199,18 @@ func GetStoreDetail2(db *DaoDB, storeID int, vendorStoreID string, vendorID int)
return storeDetail, err
}
func GetStoreCourierList(db *DaoDB, storeID, status int) (courierStoreList []*model.StoreCourierMap, err error) {
func GetStoreCourierList(db *DaoDB, storeIDs []int, status int) (courierStoreList []*model.StoreCourierMap, err error) {
sql := `
SELECT t1.*
FROM store_courier_map t1
WHERE t1.deleted_at = ? AND t1.store_id = ?
WHERE t1.deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
storeID,
}
if len(storeIDs) > 0 {
sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
if status != model.StoreStatusAll {
sql += " AND t1.status = ?"

View File

@@ -17,7 +17,7 @@ func TestGetStoreDetail(t *testing.T) {
}
func TestGetStoreCourierList(t *testing.T) {
storeCourierList, err := GetStoreCourierList(GetDB(), 100119, model.StoreStatusOpened)
storeCourierList, err := GetStoreCourierList(GetDB(), []int{100119}, model.StoreStatusOpened)
if err != nil {
t.Fatal(err)
}