- 角色管理初版

This commit is contained in:
gazebo
2019-08-07 18:16:44 +08:00
parent 059be1befd
commit 3639a1c7cb
14 changed files with 500 additions and 72 deletions

View File

@@ -153,3 +153,25 @@ func GetStoreListByMobile(db *DaoDB, mobile string) (storeList []*StoreWithCityN
}
return storeList, err
}
func GetStoreListByMobileOrStoreIDs(db *DaoDB, mobile string, storeIDs []int) (storeList []*StoreWithCityName, err error) {
sql := `
SELECT t1.*, t2.name city_name
FROM store t1
LEFT JOIN place t2 ON t2.code = t1.city_code
WHERE t1.deleted_at = ? AND ( 1 = 0`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if mobile != "" {
sql += " OR t1.market_man_phone = ? OR t1.operator_phone = ?"
sqlParams = append(sqlParams, mobile, mobile)
}
if len(storeIDs) > 0 {
sql += " OR t1.id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
sqlParams = append(sqlParams, storeIDs)
}
sql += ")"
err = GetRows(db, &storeList, sql, sqlParams...)
return storeList, err
}

View File

@@ -4,6 +4,7 @@ const (
ConfigTypeSys = "Sys"
ConfigTypePricePack = "PricePack"
ConfigTypeBank = "Bank"
ConfigTypeRole = "Role"
)
var (
@@ -11,6 +12,7 @@ var (
ConfigTypeSys: "系统",
ConfigTypePricePack: "价格包",
ConfigTypeBank: "银行",
ConfigTypeRole: "角色",
}
)

View File

@@ -23,14 +23,14 @@ var (
type User struct {
ModelIDCULD
UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识
UserID2 string `orm:"size(48);column(user_id2)" json:"userID2"` // 外部唯一标识(一般用于登录)
Name string `orm:"size(48);index" json:"name"` // 外部唯一显示 标识(一般用于显示)
Mobile string `orm:"size(32)" json:"mobile"`
Email string `orm:"size(32);index" json:"email"`
Status int8 `json:"status"`
Type int8 `json:"type"` // 用户类型
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo"` // 身份证号
UserID string `orm:"size(48);column(user_id)" json:"userID" compact:"userID"` // 内部唯一标识
UserID2 string `orm:"size(48);column(user_id2)" json:"userID2" compact:"userID2"` // 外部唯一标识(一般用于登录)
Name string `orm:"size(48);index" json:"name" compact:"name"` // 外部唯一显示 标识(一般用于显示)
Mobile string `orm:"size(32)" json:"mobile" compact:"mobile"`
Email string `orm:"size(32);index" json:"email" compact:"email"`
Status int8 `json:"status" compact:"status"`
Type int8 `json:"type" compact:"type"` // 用户类型
IDCardNo string `orm:"size(18);column(id_card_no)" json:"idCardNo" compact:"idCardNo"` // 身份证号
Remark string `orm:"size(255)" json:"remark"`
}