|
@@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
|
@@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
212
|
}
|
212
|
}
|
213
|
return tool_funs.SimpleWrapGridMap(total, ras), nil
|
213
|
return tool_funs.SimpleWrapGridMap(total, ras), nil
|
214
|
}
|
214
|
}
|
|
|
215
|
+
|
|
|
216
|
+func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (interface{}, error) {
|
|
|
217
|
+ transactionContext, err := factory.StartTransaction()
|
|
|
218
|
+ if err != nil {
|
|
|
219
|
+ return nil, err
|
|
|
220
|
+ }
|
|
|
221
|
+ defer func() {
|
|
|
222
|
+ transactionContext.RollbackTransaction()
|
|
|
223
|
+ }()
|
|
|
224
|
+ ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
225
|
+ userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
226
|
+
|
|
|
227
|
+ _, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in))
|
|
|
228
|
+ if err != nil {
|
|
|
229
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
230
|
+ }
|
|
|
231
|
+
|
|
|
232
|
+ // 获取所有创建人ID
|
|
|
233
|
+ creatorMap := map[int64]int64{}
|
|
|
234
|
+ for i := range rules {
|
|
|
235
|
+ creatorMap[rules[i].CreatorId] = rules[i].CreatorId
|
|
|
236
|
+ }
|
|
|
237
|
+ creatorIds := make([]int64, 0)
|
|
|
238
|
+ for k := range creatorMap {
|
|
|
239
|
+ creatorIds = append(creatorIds, k)
|
|
|
240
|
+ }
|
|
|
241
|
+ _, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)})
|
|
|
242
|
+ cas := make([]*adapter.CreatorAdapter, 0)
|
|
|
243
|
+ for i := range users {
|
|
|
244
|
+ ca := &adapter.CreatorAdapter{
|
|
|
245
|
+ Id: users[i].Id,
|
|
|
246
|
+ Name: users[i].Name,
|
|
|
247
|
+ }
|
|
|
248
|
+ cas = append(cas, ca)
|
|
|
249
|
+ }
|
|
|
250
|
+ return map[string]interface{}{"list": cas}, nil
|
|
|
251
|
+} |