...
|
...
|
@@ -10,6 +10,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/api/bytelib"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/domainService"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
func (tableService *TableService) ShowBusinessDatabases(ctx *domain.Context, cmd *query.ShowBusinessDatabasesRequest) (interface{}, error) {
|
...
|
...
|
@@ -160,8 +161,13 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd |
|
|
var (
|
|
|
fields = make([]*domain.Field, 0)
|
|
|
mainTable *domain.Table
|
|
|
hasPkField bool
|
|
|
)
|
|
|
for i, f := range cmd.Fields {
|
|
|
if strings.ToLower(f.FieldEnName) == "id" {
|
|
|
hasPkField = true
|
|
|
continue
|
|
|
}
|
|
|
fields = append(fields, &domain.Field{
|
|
|
Index: i + 1,
|
|
|
Name: f.FieldZhName,
|
...
|
...
|
@@ -170,6 +176,9 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd |
|
|
Flag: domain.MainTableField,
|
|
|
})
|
|
|
}
|
|
|
if !hasPkField {
|
|
|
return nil, fmt.Errorf("业务表未包含字段 `id`")
|
|
|
}
|
|
|
mainTable = domainService.NewTable(domain.MainTable, cmd.TableName, fields, 0).
|
|
|
WithContext(ctx).
|
|
|
WithPrefix(domain.MainTable.ToString()).ApplyDefaultModule()
|
...
|
...
|
|