...
|
...
|
@@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
|
|
}
|
|
|
return tool_funs.SimpleWrapGridMap(total, ras), nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (interface{}, error) {
|
|
|
transactionContext, err := factory.StartTransaction()
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
_, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in))
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 获取所有创建人ID
|
|
|
creatorMap := map[int64]int64{}
|
|
|
for i := range rules {
|
|
|
creatorMap[rules[i].CreatorId] = rules[i].CreatorId
|
|
|
}
|
|
|
creatorIds := make([]int64, 0)
|
|
|
for k := range creatorMap {
|
|
|
creatorIds = append(creatorIds, k)
|
|
|
}
|
|
|
_, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)})
|
|
|
cas := make([]*adapter.CreatorAdapter, 0)
|
|
|
for i := range users {
|
|
|
ca := &adapter.CreatorAdapter{
|
|
|
Id: users[i].Id,
|
|
|
Name: users[i].Name,
|
|
|
}
|
|
|
cas = append(cas, ca)
|
|
|
}
|
|
|
return map[string]interface{}{"list": cas}, nil
|
|
|
} |
...
|
...
|
|