作者 yangfu

业务表同步

... ... @@ -22,7 +22,8 @@ STARROCKS_DB_NAME = character_library
STARROCKS_USER = root
STARROCKS_PASSWORD = eagle1010
STARROCKS_HOST = 220.250.41.79
STARROCKS_PORT = 9030
#9030
STARROCKS_PORT = 9430
BLACK_LIST_USER = 0
BLACK_LIST_COMPANY = 1612991734952759296
... ...
... ... @@ -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) {
... ... @@ -158,10 +159,15 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd
}
var (
fields = make([]*domain.Field, 0)
mainTable *domain.Table
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()
... ...