作者 yangfu

高级查询修改

@@ -41,6 +41,9 @@ type ListUserQuery struct { @@ -41,6 +41,9 @@ type ListUserQuery struct {
41 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` 41 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
42 // 状态(1:启用 2:禁用 3:注销) 42 // 状态(1:启用 2:禁用 3:注销)
43 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` 43 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
  44 +
  45 + // 自定义高级查询
  46 + AdvancedQuery string `json:"advancedQuery"`
44 } 47 }
45 48
46 func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { 49 func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) {
@@ -217,6 +217,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int @@ -217,6 +217,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int
217 if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 { 217 if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 {
218 query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v)) 218 query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v))
219 } 219 }
  220 + if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 {
  221 + query.Where(v.(string))
  222 + }
220 query.SetOffsetAndLimit(20) 223 query.SetOffsetAndLimit(20)
221 query.SetOrderDirect("user_id", "DESC") 224 query.SetOrderDirect("user_id", "DESC")
222 if count, err := query.SelectAndCount(); err != nil { 225 if count, err := query.SelectAndCount(); err != nil {