作者 郑周

1. 用户搜索 增加 状态过滤条件

@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "github.com/linmadan/egglib-go/utils/tool_funs" 5 "github.com/linmadan/egglib-go/utils/tool_funs"
6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" 6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/user/query" 7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/user/query"
  8 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
8 ) 9 )
9 10
10 type UserService struct{} 11 type UserService struct{}
@@ -26,6 +27,7 @@ func (service *UserService) ListUsers(listUserQuery *query.ListUserQuery) (inter @@ -26,6 +27,7 @@ func (service *UserService) ListUsers(listUserQuery *query.ListUserQuery) (inter
26 count, list, err := userRepo.Find(map[string]interface{}{ 27 count, list, err := userRepo.Find(map[string]interface{}{
27 "companyId": listUserQuery.CompanyId, 28 "companyId": listUserQuery.CompanyId,
28 "name": listUserQuery.Name, 29 "name": listUserQuery.Name,
  30 + "status": domain.UserStatusEnable,
29 }) 31 })
30 if err != nil { 32 if err != nil {
31 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 33 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -24,7 +24,7 @@ const ( @@ -24,7 +24,7 @@ const (
24 UserTypeCommon int = 1 24 UserTypeCommon int = 1
25 UserTypeManager int = 2 25 UserTypeManager int = 2
26 26
27 - UserStatusEnable int = 1 27 + UserStatusEnable int = 1 // 正常用户 2禁用用户
28 ) 28 )
29 29
30 type UserRepository interface { 30 type UserRepository interface {
@@ -119,6 +119,9 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d @@ -119,6 +119,9 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d
119 if v, ok := queryOptions["account"]; ok { 119 if v, ok := queryOptions["account"]; ok {
120 query.Where("account like ?", v) 120 query.Where("account like ?", v)
121 } 121 }
  122 + if v, ok := queryOptions["status"]; ok {
  123 + query.Where("status=?", v)
  124 + }
122 if v, ok := queryOptions["name"].(string); ok && len(v) > 0 { 125 if v, ok := queryOptions["name"].(string); ok && len(v) > 0 {
123 query.Where("name like ?", fmt.Sprintf("%%%v%%", v)) 126 query.Where("name like ?", fmt.Sprintf("%%%v%%", v))
124 } 127 }