作者 yangfu

高级查询修改

# Conflicts:
#	pkg/application/user/query/list_user.go
... ... @@ -43,6 +43,9 @@ type ListUserQuery struct {
InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
// 在企业范围内
InCompanyIds []int64 `cname:"在企业范围内" json:"inCompanyIds,omitempty"`
// 自定义高级查询
AdvancedQuery string `json:"advancedQuery"`
}
func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -228,6 +228,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int
if v, ok := queryOptions["cooperationCompany"]; ok && len(v.(string)) > 0 {
query.Where(fmt.Sprintf(`cooperation_info->>'cooperationCompany' like '%%%v%%'`, v))
}
if v, ok := queryOptions["advancedQuery"]; ok && len(v.(string)) > 0 {
query.Where(v.(string))
}
query.SetOffsetAndLimit(20)
query.SetOrderDirect("user_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
... ...