+ Store添加MarketManRole与OperatorRole

- GetStoreListByMobileOrStoreIDs支持按Store.MarketManRole与OperatorRole来得到门店列表
This commit is contained in:
gazebo
2019-08-08 15:46:32 +08:00
parent 03dd787375
commit 60f3ec9c3b
3 changed files with 33 additions and 11 deletions

View File

@@ -154,7 +154,7 @@ func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*StoreWithCityN
return storeList, err
}
func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, storeIDs []int) (storeList []*StoreWithCityName, err error) {
func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, shortRoleNameList []string, storeIDs []int) (storeList []*StoreWithCityName, err error) {
sql := `
SELECT t1.*, t2.name city_name
FROM store t1
@@ -167,6 +167,10 @@ func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, storeIDs []int) (s
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ?"
sqlParams = append(sqlParams, mobile, mobile)
}
if len(shortRoleNameList) > 0 {
sql += " OR t1.market_man_role IN (" + GenQuestionMarks(len(shortRoleNameList)) + ") OR t1.operator_role IN (" + GenQuestionMarks(len(shortRoleNameList)) + ")"
sqlParams = append(sqlParams, shortRoleNameList, shortRoleNameList)
}
if len(storeIDs) > 0 {
sql += " OR t1.id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)