正在显示
4 个修改的文件
包含
34 行增加
和
2 行删除
@@ -20,8 +20,8 @@ const ( | @@ -20,8 +20,8 @@ const ( | ||
20 | ) | 20 | ) |
21 | 21 | ||
22 | const ( | 22 | const ( |
23 | - NodeRequiredYes int = 1 // 是否必填项-必填(默认) | ||
24 | - NodeRequiredNo int = 2 // 是否必填项-非必填 | 23 | + NodeRequiredYes int = 1 // 必填项-必填(默认) |
24 | + NodeRequiredNo int = 2 // 必填项-非必填 | ||
25 | ) | 25 | ) |
26 | 26 | ||
27 | type EntryItem struct { | 27 | type EntryItem struct { |
@@ -21,6 +21,17 @@ func NewEvaluationCycleTemplateRepository(transactionContext *pgTransaction.Tran | @@ -21,6 +21,17 @@ func NewEvaluationCycleTemplateRepository(transactionContext *pgTransaction.Tran | ||
21 | } | 21 | } |
22 | 22 | ||
23 | func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.EvaluationCycleTemplate) domain.EvaluationCycleTemplate { | 23 | func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.EvaluationCycleTemplate) domain.EvaluationCycleTemplate { |
24 | + // 历史旧数据,默认输出转成1 | ||
25 | + if m.Template != nil { | ||
26 | + for i := range m.Template.LinkNodes { | ||
27 | + node := m.Template.LinkNodes[i] | ||
28 | + for j := range node.NodeContents { | ||
29 | + if node.NodeContents[j].Required == 0 { | ||
30 | + node.NodeContents[j].Required = domain.NodeRequiredYes | ||
31 | + } | ||
32 | + } | ||
33 | + } | ||
34 | + } | ||
24 | return domain.EvaluationCycleTemplate{ | 35 | return domain.EvaluationCycleTemplate{ |
25 | Id: m.Id, | 36 | Id: m.Id, |
26 | Name: m.Name, | 37 | Name: m.Name, |
@@ -21,6 +21,18 @@ func NewEvaluationProjectRepository(transactionContext *pgTransaction.Transactio | @@ -21,6 +21,18 @@ func NewEvaluationProjectRepository(transactionContext *pgTransaction.Transactio | ||
21 | } | 21 | } |
22 | 22 | ||
23 | func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationProject) domain.EvaluationProject { | 23 | func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationProject) domain.EvaluationProject { |
24 | + // 历史旧数据,默认输出转成1 | ||
25 | + if m.Template != nil { | ||
26 | + for i := range m.Template.LinkNodes { | ||
27 | + node := m.Template.LinkNodes[i] | ||
28 | + for j := range node.NodeContents { | ||
29 | + if node.NodeContents[j].Required == 0 { | ||
30 | + node.NodeContents[j].Required = domain.NodeRequiredYes | ||
31 | + } | ||
32 | + } | ||
33 | + } | ||
34 | + } | ||
35 | + | ||
24 | return domain.EvaluationProject{ | 36 | return domain.EvaluationProject{ |
25 | Id: m.Id, | 37 | Id: m.Id, |
26 | Name: m.Name, | 38 | Name: m.Name, |
@@ -21,6 +21,15 @@ func NewEvaluationTemplateRepository(transactionContext *pgTransaction.Transacti | @@ -21,6 +21,15 @@ func NewEvaluationTemplateRepository(transactionContext *pgTransaction.Transacti | ||
21 | } | 21 | } |
22 | 22 | ||
23 | func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.EvaluationTemplate) domain.EvaluationTemplate { | 23 | func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.EvaluationTemplate) domain.EvaluationTemplate { |
24 | + // 历史旧数据,默认输出转成1 | ||
25 | + for i := range m.LinkNodes { | ||
26 | + node := m.LinkNodes[i] | ||
27 | + for j := range node.NodeContents { | ||
28 | + if node.NodeContents[j].Required == 0 { | ||
29 | + node.NodeContents[j].Required = domain.NodeRequiredYes | ||
30 | + } | ||
31 | + } | ||
32 | + } | ||
24 | return domain.EvaluationTemplate{ | 33 | return domain.EvaluationTemplate{ |
25 | Id: m.Id, | 34 | Id: m.Id, |
26 | Name: m.Name, | 35 | Name: m.Name, |
-
请 注册 或 登录 后发表评论