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