...
|
...
|
@@ -19,7 +19,6 @@ func (ptr *AppendDataToTableService) AppendData(ctx *domain.Context, fileId int, |
|
|
if err != nil {
|
|
|
return nil, fmt.Errorf("文件不存在")
|
|
|
}
|
|
|
|
|
|
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
|
|
|
table, err := tableRepository.FindOne(map[string]interface{}{"tableId": tableId})
|
|
|
if err != nil {
|
...
|
...
|
@@ -59,20 +58,24 @@ func (ptr *AppendDataToTableService) AppendData(ctx *domain.Context, fileId int, |
|
|
}
|
|
|
|
|
|
// 通知底层进行追加数据
|
|
|
requestData := domain.ReqAppendData{Table: table, FileId: fileId, FileUrl: file.FileInfo.Url}
|
|
|
requestData := domain.ReqAppendData{Table: table, FileId: fileId, FileUrl: file.FileInfo.Url, ExcelTable: excelTable}
|
|
|
if len(mappingFields) > 0 {
|
|
|
for _, m := range mappingFields {
|
|
|
if len(m.VerifiedFileFieldName) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
fromField, ok := excelTable.MatchField(&domain.Field{Name: m.VerifiedFileFieldName})
|
|
|
var toField, fromField *domain.Field
|
|
|
var ok bool
|
|
|
toField, ok = table.MatchField(m.MainTableField)
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
toField, ok := table.MatchField(m.MainTableField)
|
|
|
if len(m.VerifiedFileFieldName) == 0 {
|
|
|
fromField = &domain.Field{}
|
|
|
// continue
|
|
|
} else {
|
|
|
fromField, ok = excelTable.MatchField(&domain.Field{Name: m.VerifiedFileFieldName})
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
requestData.To = append(requestData.To, toField)
|
|
|
requestData.From = append(requestData.From, fromField)
|
|
|
}
|
...
|
...
|
|