...
|
...
|
@@ -2,6 +2,7 @@ package service |
|
|
|
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
...
|
...
|
@@ -88,47 +89,25 @@ func (rs *RoleUserService) Remove(in *command.UserRoleDeleteCommand) (interface{ |
|
|
return rus, nil
|
|
|
}
|
|
|
|
|
|
//func (rs *RoleUserService) ListForUser(in *command.UserRoleQueryCommand) (interface{}, error) {
|
|
|
// transactionContext, err := factory.StartTransaction()
|
|
|
// if err != nil {
|
|
|
// return nil, err
|
|
|
// }
|
|
|
// defer func() {
|
|
|
// transactionContext.RollbackTransaction()
|
|
|
// }()
|
|
|
// roleRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
//
|
|
|
// in.PageNumber = 1
|
|
|
// in.PageSize = 9999999
|
|
|
//
|
|
|
// conditionMap := tool_funs.SimpleStructToMap(in)
|
|
|
// _, roles, err := roleRepository.Find(conditionMap)
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
// if len(roles) == 0 {
|
|
|
// return nil, application.ThrowError(application.BUSINESS_ERROR, "未找到角色数据")
|
|
|
// }
|
|
|
//
|
|
|
// ids := make([]int64, 0)
|
|
|
// for i := range roles {
|
|
|
// ids = append(ids, roles[i].Id)
|
|
|
// }
|
|
|
//
|
|
|
// _, users, err := userRepository.Find(conditionMap)
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
//
|
|
|
// //for i := range users {
|
|
|
// // users[i].RoleUserIds
|
|
|
// //}
|
|
|
//
|
|
|
// //if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// //}
|
|
|
// //groupAdapter := &adapter.RoleUserAdapter{}
|
|
|
// //newList := groupAdapter.TransformTree(groups)
|
|
|
// return map[string]interface{}{"list": users}, nil
|
|
|
//} |
|
|
func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface{}, error) {
|
|
|
transactionContext, err := factory.StartTransaction()
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
ruRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
in.PageNumber = 1
|
|
|
in.PageSize = 9999999
|
|
|
|
|
|
tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, in.RoleId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return tool_funs.SimpleWrapGridMap(int64(len(tempList)), tempList), nil
|
|
|
} |
...
|
...
|
|