...
|
...
|
@@ -100,10 +100,11 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
|
|
|
// 周期模板数据表中插入数据
|
|
|
cycleTemplate := &domain.EvaluationCycleTemplate{
|
|
|
Id: 0,
|
|
|
Name: v.Name,
|
|
|
Template: v,
|
|
|
CycleId: cycle.Id,
|
|
|
Id: 0,
|
|
|
Name: v.Name,
|
|
|
TemplateCreatedAt: v.CreatedAt,
|
|
|
Template: v,
|
|
|
CycleId: cycle.Id,
|
|
|
}
|
|
|
_, err := cycleTemplateRepository.Insert(cycleTemplate)
|
|
|
if err != nil {
|
...
|
...
|
@@ -114,7 +115,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
ctAdapter.TemplateSimples = append(ctAdapter.TemplateSimples, &domain.TemplateSimple{
|
|
|
Id: cycleTemplate.Id,
|
|
|
Name: cycleTemplate.Name,
|
|
|
CreatedAt: cycleTemplate.CreatedAt,
|
|
|
CreatedAt: cycleTemplate.TemplateCreatedAt, // 模板创建时间
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -188,10 +189,11 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
for i := range templates {
|
|
|
v := templates[i]
|
|
|
cycleTemplate := &domain.EvaluationCycleTemplate{
|
|
|
Id: 0,
|
|
|
Name: v.Name,
|
|
|
Template: v,
|
|
|
CycleId: cycle.Id,
|
|
|
Id: 0,
|
|
|
Name: v.Name,
|
|
|
TemplateCreatedAt: v.CreatedAt,
|
|
|
Template: v,
|
|
|
CycleId: cycle.Id,
|
|
|
}
|
|
|
_, err := cycleTemplateRepository.Insert(cycleTemplate)
|
|
|
if err != nil {
|
...
|
...
|
@@ -220,7 +222,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
ctAdapter.TemplateSimples = append(ctAdapter.TemplateSimples, &domain.TemplateSimple{
|
|
|
Id: cycleTemplates[i].Id,
|
|
|
Name: cycleTemplates[i].Name,
|
|
|
CreatedAt: cycleTemplates[i].CreatedAt,
|
|
|
CreatedAt: cycleTemplates[i].TemplateCreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -257,7 +259,7 @@ func (rs *EvaluationCycleService) Get(in *command.GetCycleCommand) (interface{}, |
|
|
ctAdapter.TemplateSimples = append(ctAdapter.TemplateSimples, &domain.TemplateSimple{
|
|
|
Id: cycleTemplates[i].Id,
|
|
|
Name: cycleTemplates[i].Name,
|
|
|
CreatedAt: cycleTemplates[i].CreatedAt,
|
|
|
CreatedAt: cycleTemplates[i].TemplateCreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -361,3 +363,30 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP |
|
|
}
|
|
|
return map[string]interface{}{"userTotal": userTotal, "departmentTotal": departmentTotal}, nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCommand) (interface{}, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, cycleTemplates, err := cycleTemplateRepository.Find(map[string]interface{}{"cycleId": in.CycleId}, "template")
|
|
|
|
|
|
list := make([]*domain.TemplateSimple, 0)
|
|
|
for i := range cycleTemplates {
|
|
|
list = append(list, &domain.TemplateSimple{
|
|
|
Id: cycleTemplates[i].Id,
|
|
|
Name: cycleTemplates[i].Name,
|
|
|
CreatedAt: cycleTemplates[i].TemplateCreatedAt,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{"list": list}, nil
|
|
|
} |
...
|
...
|
|