高级查询修改
# Conflicts: # pkg/application/user/query/list_user.go
正在显示
2 个修改的文件
包含
6 行增加
和
0 行删除
| @@ -43,6 +43,9 @@ type ListUserQuery struct { | @@ -43,6 +43,9 @@ type ListUserQuery struct { | ||
| 43 | InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` | 43 | InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` |
| 44 | // 在企业范围内 | 44 | // 在企业范围内 |
| 45 | InCompanyIds []int64 `cname:"在企业范围内" json:"inCompanyIds,omitempty"` | 45 | InCompanyIds []int64 `cname:"在企业范围内" json:"inCompanyIds,omitempty"` |
| 46 | + | ||
| 47 | + // 自定义高级查询 | ||
| 48 | + AdvancedQuery string `json:"advancedQuery"` | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { | 51 | func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { |
| @@ -228,6 +228,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | @@ -228,6 +228,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | ||
| 228 | if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 { | 228 | if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 { |
| 229 | query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v)) | 229 | query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v)) |
| 230 | } | 230 | } |
| 231 | + if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 { | ||
| 232 | + query.Where(v.(string)) | ||
| 233 | + } | ||
| 231 | query.SetOffsetAndLimit(20) | 234 | query.SetOffsetAndLimit(20) |
| 232 | query.SetOrderDirect("user_id", "DESC") | 235 | query.SetOrderDirect("user_id", "DESC") |
| 233 | if count, err := query.SelectAndCount(); err != nil { | 236 | if count, err := query.SelectAndCount(); err != nil { |
-
请 注册 或 登录 后发表评论