作者 tangxvhui
... ... @@ -12,6 +12,7 @@ type CreateTemplateCommand struct {
Name string `cname:"模板名称" json:"name" valid:"Required"`
Describe string `cname:"模板描述" json:"describe"`
NodeContents []*domain.NodeContent `cname:"环节-评估内容" json:"nodeContents"`
State int `cname:"状态(0待完成配置、1待启用、2启用、3停用)"`
}
func (in *CreateTemplateCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -93,6 +93,10 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) (
State: domain.TemplateStateWaitConfig,
LinkNodes: linkNodes,
}
if in.State > domain.TemplateStateWaitConfig {
newTemplate.State = in.State
}
template, err := templateRepository.Insert(newTemplate)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ...
... ... @@ -422,6 +422,7 @@ func (controller *ImportController) parserAndInsert(file *os.File, fileName stri
in.Name = nameOnly
in.Describe = ""
in.NodeContents = list
in.State = domain.TemplateStateWaitActive
if _, err := ruService.Create(in); err != nil {
return application.ThrowError(application.ARG_ERROR, err.Error())
... ...