- 创建或更新京西门店,注册用户时,自动根据门店的tel1,tel2添加门店老板角色

This commit is contained in:
gazebo
2019-09-05 16:57:28 +08:00
parent c98745ce59
commit f5ec608a1c
5 changed files with 54 additions and 34 deletions

View File

@@ -445,16 +445,25 @@ func GetOpenedStoreCouriersByStoreID(db *DaoDB, storeID, vendorID int) (storeMap
return storeMaps, nil
}
func GetStoreList4Role(db *DaoDB, shortRoleName string) (storeList []*model.Store, err error) {
func GetStoreList(db *DaoDB, idList []int, mobileList []string, shortRoleName string) (storeList []*model.Store, err error) {
sql := `
SELECT t1.*
FROM store t1
WHERE t1.deleted_at = ? AND (t1.market_man_role = ? OR t1.operator_role = ? OR t1.operator_role2 = ?)`
WHERE t1.deleted_at = ?`
sqlParams := []interface{}{
utils.DefaultTimeValue,
shortRoleName,
shortRoleName,
shortRoleName,
}
if len(idList) > 0 {
sql += " AND t1.id IN (" + GenQuestionMarks(len(idList)) + ")"
sqlParams = append(sqlParams, idList)
}
if len(mobileList) > 0 {
sql += " AND (t1.tel1 IN (" + GenQuestionMarks(len(mobileList)) + ") OR t1.tel2 IN (" + GenQuestionMarks(len(mobileList)) + ")"
sqlParams = append(sqlParams, mobileList, mobileList)
}
if shortRoleName != "" {
sql += " AND (t1.market_man_role = ? OR t1.operator_role = ? OR t1.operator_role2 = ?)"
sqlParams = append(sqlParams, shortRoleName, shortRoleName, shortRoleName)
}
err = GetRows(db, &storeList, sql, sqlParams...)
return storeList, err