高级查询修改
# 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) { |
@@ -229,6 +229,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | @@ -229,6 +229,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int | ||
229 | if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 { | 229 | if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 { |
230 | query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v)) | 230 | query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v)) |
231 | } | 231 | } |
232 | + if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 { | ||
233 | + query.Where(v.(string)) | ||
234 | + } | ||
232 | query.SetOffsetAndLimit(20) | 235 | query.SetOffsetAndLimit(20) |
233 | query.SetOrderDirect("user_id", "DESC") | 236 | query.SetOrderDirect("user_id", "DESC") |
234 | if count, err := query.SelectAndCount(); err != nil { | 237 | if count, err := query.SelectAndCount(); err != nil { |
-
请 注册 或 登录 后发表评论