This commit is contained in:
苏尹岚
2021-01-22 10:05:43 +08:00
parent f85fa9e12a
commit 519592bc31
14 changed files with 145 additions and 30 deletions

View File

@@ -90,6 +90,33 @@ func GetUserRole(db *DaoDB, userIDs []string, roleIDs []int) (userRoles []*model
return userRoles, err
}
type GetUserRole2Result struct {
model.Role
model.UserRole
}
func GetUserRole2(db *DaoDB, userIDs []string, roleIDs []int) (userRoles []*GetUserRole2Result, err error) {
sql := `
SELECT *
FROM user_role a
JOIN role b ON a.role_id = b.id
WHERE a.deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if len(userIDs) > 0 {
sql += " AND a.user_id IN (" + GenQuestionMarks(len(userIDs)) + ")"
sqlParams = append(sqlParams, userIDs)
}
if len(roleIDs) > 0 {
sql += " AND a.role_id IN (" + GenQuestionMarks(len(roleIDs)) + ")"
sqlParams = append(sqlParams, roleIDs)
}
err = GetRows(db, &userRoles, sql, sqlParams)
return userRoles, err
}
func GetRoleMenu(db *DaoDB, roleIDs, menuIDs []int) (roleMenus []*model.RoleMenu, err error) {
sql := `
SELECT *
@@ -110,7 +137,3 @@ func GetRoleMenu(db *DaoDB, roleIDs, menuIDs []int) (roleMenus []*model.RoleMenu
err = GetRows(db, &roleMenus, sql, sqlParams)
return roleMenus, err
}
func GetUserStores(db *DaoDB, userID string) {
}

View File

@@ -514,7 +514,7 @@ func GetOpenedStoreCouriersByStoreID(db *DaoDB, storeID, vendorID int) (storeMap
return storeMaps, nil
}
func GetStoreList(db *DaoDB, idList, cityCodes, statuss []int, mobileList []string, shortRoleName string) (storeList []*model.Store, err error) {
func GetStoreList(db *DaoDB, idList, cityCodes, statuss, brandIDs []int, mobileList []string, shortRoleName string) (storeList []*model.Store, err error) {
sql := `
SELECT t1.*
FROM store t1
@@ -534,6 +534,10 @@ func GetStoreList(db *DaoDB, idList, cityCodes, statuss []int, mobileList []stri
sql += " AND t1.status IN (" + GenQuestionMarks(len(statuss)) + ")"
sqlParams = append(sqlParams, statuss)
}
if len(brandIDs) > 0 {
sql += " AND t1.brand_id IN (" + GenQuestionMarks(len(brandIDs)) + ")"
sqlParams = append(sqlParams, brandIDs)
}
if len(mobileList) > 0 {
sql += " AND (t1.tel1 IN (" + GenQuestionMarks(len(mobileList)) + ") OR t1.tel2 IN (" + GenQuestionMarks(len(mobileList)) + "))"
sqlParams = append(sqlParams, mobileList, mobileList)

View File

@@ -16,6 +16,7 @@ const (
UserTypeStoreBoss = 2
UserTypeOperator = 4
UserTypeBoss = 8
UserTypeRole = 16
UserTypeNonConsumer = ^1
MemberTypeDiscountCard = 1 //会员折扣卡
@@ -27,6 +28,7 @@ var (
UserTypeStoreBoss: "门店老板",
UserTypeOperator: "运营",
UserTypeBoss: "老板",
UserTypeRole: "受权限管理",
}
)