|
@@ -162,23 +162,6 @@ func (rs *EvaluationRuleService) Remove(in *command.DeleteRuleCommand) (interfac |
|
@@ -162,23 +162,6 @@ func (rs *EvaluationRuleService) Remove(in *command.DeleteRuleCommand) (interfac |
162
|
return rule, nil
|
162
|
return rule, nil
|
163
|
}
|
163
|
}
|
164
|
|
164
|
|
165
|
-//func (rs *EvaluationRuleService) List(in *command.QueryRuleCommand) (interface{}, error) {
|
|
|
166
|
-// transactionContext, err := factory.StartTransaction()
|
|
|
167
|
-// if err != nil {
|
|
|
168
|
-// return nil, err
|
|
|
169
|
-// }
|
|
|
170
|
-// defer func() {
|
|
|
171
|
-// transactionContext.RollbackTransaction()
|
|
|
172
|
-// }()
|
|
|
173
|
-// ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
174
|
-//
|
|
|
175
|
-// total, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in))
|
|
|
176
|
-// if err != nil {
|
|
|
177
|
-// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
178
|
-// }
|
|
|
179
|
-// return tool_funs.SimpleWrapGridMap(total, rules), nil
|
|
|
180
|
-//}
|
|
|
181
|
-
|
|
|
182
|
func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (interface{}, error) {
|
165
|
func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (interface{}, error) {
|
183
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
166
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
184
|
if err != nil {
|
167
|
if err != nil {
|
|
@@ -220,6 +203,8 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
|
@@ -220,6 +203,8 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
220
|
ra := &adapter.RuleAdapter{}
|
203
|
ra := &adapter.RuleAdapter{}
|
221
|
ra.EvaluationRule = rule
|
204
|
ra.EvaluationRule = rule
|
222
|
ras = append(ras, ra)
|
205
|
ras = append(ras, ra)
|
|
|
206
|
+
|
|
|
207
|
+ total += 1
|
223
|
}
|
208
|
}
|
224
|
|
209
|
|
225
|
_, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)})
|
210
|
_, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)})
|
|
@@ -234,6 +219,11 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
|
@@ -234,6 +219,11 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i |
234
|
ras[i].CreatorName = v
|
219
|
ras[i].CreatorName = v
|
235
|
}
|
220
|
}
|
236
|
}
|
221
|
}
|
|
|
222
|
+
|
|
|
223
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
224
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
225
|
+ }
|
|
|
226
|
+
|
237
|
return tool_funs.SimpleWrapGridMap(total, ras), nil
|
227
|
return tool_funs.SimpleWrapGridMap(total, ras), nil
|
238
|
}
|
228
|
}
|
239
|
|
229
|
|
|
@@ -271,5 +261,9 @@ func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (i |
|
@@ -271,5 +261,9 @@ func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (i |
271
|
}
|
261
|
}
|
272
|
cas = append(cas, ca)
|
262
|
cas = append(cas, ca)
|
273
|
}
|
263
|
}
|
|
|
264
|
+
|
|
|
265
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
266
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
267
|
+ }
|
274
|
return map[string]interface{}{"list": cas}, nil
|
268
|
return map[string]interface{}{"list": cas}, nil
|
275
|
} |
269
|
} |