...
|
...
|
@@ -2,6 +2,7 @@ package domainService |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
|
|
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/repository"
|
...
|
...
|
@@ -45,7 +46,10 @@ func (ptr *CopyDataTableService) CopyTable(ctx *domain.Context, tableId int, tab |
|
|
}
|
|
|
}
|
|
|
// 验证表名是否重复
|
|
|
duplicateTable, err := tableRepository.FindOne(map[string]interface{}{"context": ctx, "tableName": tableName})
|
|
|
duplicateTable, err := tableRepository.FindOne(map[string]interface{}{
|
|
|
"context": ctx,
|
|
|
"tableName": tableName,
|
|
|
"tableTypes":domain.TableTypesToStringList(domain.MainTable,domain.SubTable,domain.SideTable)})
|
|
|
if err == nil && duplicateTable != nil {
|
|
|
return nil, fmt.Errorf("表名称重复")
|
|
|
}
|
...
|
...
|
@@ -53,7 +57,8 @@ func (ptr *CopyDataTableService) CopyTable(ctx *domain.Context, tableId int, tab |
|
|
sideTable := NewCopyTable(domain.SideTable, tableName, dataFields, table.RowCount).
|
|
|
WithContext(ctx).
|
|
|
WithParentId(table.TableId).
|
|
|
WithDataFieldIndex(table.DataFieldIndex)
|
|
|
WithDataFieldIndex(table.DataFieldIndex).
|
|
|
WithPrefix(domain.SideTable.ToString())
|
|
|
if sideTable, err = tableRepository.Save(sideTable); err != nil {
|
|
|
return nil, err
|
|
|
}
|
...
|
...
|
|