作者 yangfu

子部门列表修改

... ... @@ -39,6 +39,8 @@ type ListUserQuery struct {
PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
}
func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -204,7 +204,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int
query.SetWhereByQueryOption("(user_type & ?)>0", "userType")
query.SetWhereByQueryOption("enable_status=?", "enableStatus")
query.SetWhereByQueryOption(fmt.Sprintf(`user_role @> '[{"roleId":%v}]'`, queryOptions["roleId"]), "roleId")
if v, ok := queryOptions["inEnableStatus"]; ok && len(v.([]int)) > 0 {
query.Where(`enable_status in (?)`, pg.In(v))
}
if v, ok := queryOptions["depName"]; ok && len(v.(string)) > 0 {
query.Where(fmt.Sprintf(`ext->>'depName' like '%%%v%%'`, v))
}
... ...