作者 yangfu

用户列表修改

... ... @@ -9,6 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/user/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
"time"
)
... ... @@ -486,6 +487,7 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in
userRepository = value
}
var company *domain.Company
var mapCompany = make(map[int64]*domain.Company)
var dtoUsers []*dto.UserDto
queryOptions := utils.ObjectToMap(listUserQuery)
if len(listUserQuery.Phone) > 0 {
... ... @@ -502,8 +504,14 @@ func (userService *UserService) ListUser(listUserQuery *query.ListUserQuery) (in
for i := range users {
user := users[i]
userDto := &dto.UserDto{}
if company == nil && user.CompanyId != 0 {
_, company, _ = factory.FastPgCompany(transactionContext, user.CompanyId)
var ok bool
if company, ok = mapCompany[user.CompanyId]; !ok {
_, company, err = factory.FastPgCompany(transactionContext, user.CompanyId)
if err != nil {
log.Logger.Error(err.Error())
continue
}
mapCompany[company.CompanyId] = company
}
if listUserQuery.PullRealTime {
_, dep, _ := factory.FastPgOrg(transactionContext, user.DepartmentId)
... ...