update UserAllQuery
This commit is contained in:
parent
41c52b6fc6
commit
3c4eab8977
|
@ -13,10 +13,21 @@ type CommonQuery struct {
|
|||
Keyword string
|
||||
RoleID string
|
||||
Status string
|
||||
Deleted string
|
||||
Sort interface{}
|
||||
Other map[string]interface{}
|
||||
}
|
||||
|
||||
// AssignDeleted ...
|
||||
func (q *CommonQuery) AssignDeleted(cond bson.M) {
|
||||
if q.Deleted == "true" {
|
||||
cond["deleted"] = true
|
||||
}
|
||||
if q.Deleted == "false" {
|
||||
cond["deleted"] = false
|
||||
}
|
||||
}
|
||||
|
||||
// AssignKeyword ...
|
||||
func (q *CommonQuery) AssignKeyword(cond bson.M) {
|
||||
if q.Keyword != "" {
|
||||
|
|
|
@ -40,6 +40,7 @@ type UserAllQuery struct {
|
|||
Keyword string
|
||||
RoleID string
|
||||
Status string
|
||||
Deleted string // true or false
|
||||
Sort interface{}
|
||||
Other map[string]interface{} // query fields in other object
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ func All(queryParams model.UserAllQuery) (r model.UserAll) {
|
|||
Status: queryParams.Status,
|
||||
Sort: queryParams.Sort,
|
||||
Other: queryParams.Other,
|
||||
Deleted: queryParams.Deleted,
|
||||
}
|
||||
|
||||
// Assign condition
|
||||
|
@ -119,6 +120,7 @@ func All(queryParams model.UserAllQuery) (r model.UserAll) {
|
|||
query.AssignKeyword(cond)
|
||||
query.AssignRoleID(cond)
|
||||
query.AssignStatus(cond)
|
||||
query.AssignDeleted(cond)
|
||||
query.AssignOther(cond)
|
||||
|
||||
wg.Add(1)
|
||||
|
|
Loading…
Reference in New Issue