正在显示
3 个修改的文件
包含
3 行增加
和
1 行删除
@@ -47,7 +47,7 @@ func (mappingRuleService *MappingRuleService) CreateMappingRule(ctx *domain.Cont | @@ -47,7 +47,7 @@ func (mappingRuleService *MappingRuleService) CreateMappingRule(ctx *domain.Cont | ||
47 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 47 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
48 | } | 48 | } |
49 | 49 | ||
50 | - if duplicateRule, e := mappingRuleRepository.FindOne(map[string]interface{}{"context": ctx, "name": cmd.Name}); e == nil && duplicateRule != nil { | 50 | + if duplicateRule, e := mappingRuleRepository.FindOne(map[string]interface{}{"context": ctx, "name": cmd.Name, "tableId": cmd.TableId}); e == nil && duplicateRule != nil { |
51 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "方案名称重复") | 51 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "方案名称重复") |
52 | } | 52 | } |
53 | 53 |
@@ -81,6 +81,7 @@ func (ptr *PreviewDataTableService) CreateTemporaryFile(ctx *domain.Context, fil | @@ -81,6 +81,7 @@ func (ptr *PreviewDataTableService) CreateTemporaryFile(ctx *domain.Context, fil | ||
81 | return nil, fmt.Errorf("源文件/校验文件才可以创建临时文件") | 81 | return nil, fmt.Errorf("源文件/校验文件才可以创建临时文件") |
82 | } | 82 | } |
83 | file = file.CopyTo(domain.TemporaryFile, ctx) | 83 | file = file.CopyTo(domain.TemporaryFile, ctx) |
84 | + file.FileInfo.TableId = 0 | ||
84 | if file, err = fileRepository.Save(file); err != nil { | 85 | if file, err = fileRepository.Save(file); err != nil { |
85 | return nil, err | 86 | return nil, err |
86 | } | 87 | } |
@@ -114,6 +114,7 @@ func (repository *MappingRuleRepository) FindOne(queryOptions map[string]interfa | @@ -114,6 +114,7 @@ func (repository *MappingRuleRepository) FindOne(queryOptions map[string]interfa | ||
114 | query := sqlbuilder.BuildQuery(tx.Model(mappingRuleModel), queryOptions) | 114 | query := sqlbuilder.BuildQuery(tx.Model(mappingRuleModel), queryOptions) |
115 | WhereContext(query, queryOptions) | 115 | WhereContext(query, queryOptions) |
116 | query.SetWhereByQueryOption("name = ?", "name") | 116 | query.SetWhereByQueryOption("name = ?", "name") |
117 | + query.SetWhereByQueryOption("table_id = ?", "tableId") | ||
117 | query.SetWhereByQueryOption("mapping_rule.mapping_rule_id = ?", "mappingRuleId") | 118 | query.SetWhereByQueryOption("mapping_rule.mapping_rule_id = ?", "mappingRuleId") |
118 | if err := query.First(); err != nil { | 119 | if err := query.First(); err != nil { |
119 | if err.Error() == "pg: no rows in result set" { | 120 | if err.Error() == "pg: no rows in result set" { |
-
请 注册 或 登录 后发表评论