正在显示
1 个修改的文件
包含
11 行增加
和
3 行删除
| @@ -16,6 +16,9 @@ import ( | @@ -16,6 +16,9 @@ import ( | ||
| 16 | func (tableService *TableService) ShowBusinessDatabases(ctx *domain.Context, cmd *query.ShowBusinessDatabasesRequest) (interface{}, error) { | 16 | func (tableService *TableService) ShowBusinessDatabases(ctx *domain.Context, cmd *query.ShowBusinessDatabasesRequest) (interface{}, error) { |
| 17 | byteCoreService := domainService.ByteCoreService{} | 17 | byteCoreService := domainService.ByteCoreService{} |
| 18 | response, err := byteCoreService.ShowBusinessDatabases(bytelib.ReqShowBusinessDatabases{}) | 18 | response, err := byteCoreService.ShowBusinessDatabases(bytelib.ReqShowBusinessDatabases{}) |
| 19 | + if err != nil { | ||
| 20 | + return nil, factory.FastError(err) | ||
| 21 | + } | ||
| 19 | return response, err | 22 | return response, err |
| 20 | } | 23 | } |
| 21 | 24 | ||
| @@ -25,6 +28,9 @@ func (tableService *TableService) ShowBusinessTables(ctx *domain.Context, cmd *q | @@ -25,6 +28,9 @@ func (tableService *TableService) ShowBusinessTables(ctx *domain.Context, cmd *q | ||
| 25 | DatabaseEnName: cmd.DatabaseEnName, | 28 | DatabaseEnName: cmd.DatabaseEnName, |
| 26 | DatabaseType: cmd.DatabaseType, | 29 | DatabaseType: cmd.DatabaseType, |
| 27 | }) | 30 | }) |
| 31 | + if err != nil { | ||
| 32 | + return nil, factory.FastError(err) | ||
| 33 | + } | ||
| 28 | result := make([]map[string]interface{}, 0) | 34 | result := make([]map[string]interface{}, 0) |
| 29 | for _, t := range response.TableFullNames { | 35 | for _, t := range response.TableFullNames { |
| 30 | result = append(result, map[string]interface{}{ | 36 | result = append(result, map[string]interface{}{ |
| @@ -43,7 +49,9 @@ func (tableService *TableService) QueryBusinessTable(ctx *domain.Context, cmd *q | @@ -43,7 +49,9 @@ func (tableService *TableService) QueryBusinessTable(ctx *domain.Context, cmd *q | ||
| 43 | PageNumber: cmd.PageNumber, | 49 | PageNumber: cmd.PageNumber, |
| 44 | PageSize: cmd.PageSize, | 50 | PageSize: cmd.PageSize, |
| 45 | }) | 51 | }) |
| 46 | - | 52 | + if err != nil { |
| 53 | + return nil, factory.FastError(err) | ||
| 54 | + } | ||
| 47 | transactionContext, err := factory.CreateTransactionContext(nil) | 55 | transactionContext, err := factory.CreateTransactionContext(nil) |
| 48 | if err != nil { | 56 | if err != nil { |
| 49 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 57 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -155,7 +163,7 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd | @@ -155,7 +163,7 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd | ||
| 155 | duplicateTable, err := tableRepository.FindOne(map[string]interface{}{"context": ctx, "tableName": cmd.TableName, | 163 | duplicateTable, err := tableRepository.FindOne(map[string]interface{}{"context": ctx, "tableName": cmd.TableName, |
| 156 | "tableTypes": []string{string(domain.MainTable), string(domain.SubTable), string(domain.SideTable)}}) | 164 | "tableTypes": []string{string(domain.MainTable), string(domain.SubTable), string(domain.SideTable)}}) |
| 157 | if err == nil && duplicateTable != nil { | 165 | if err == nil && duplicateTable != nil { |
| 158 | - return nil, fmt.Errorf("表名称重复") | 166 | + return nil, factory.FastError(fmt.Errorf("表名称重复")) |
| 159 | } | 167 | } |
| 160 | 168 | ||
| 161 | var ( | 169 | var ( |
| @@ -177,7 +185,7 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd | @@ -177,7 +185,7 @@ func (tableService *TableService) GenerateBusinessTable(ctx *domain.Context, cmd | ||
| 177 | }) | 185 | }) |
| 178 | } | 186 | } |
| 179 | if !hasPkField { | 187 | if !hasPkField { |
| 180 | - return nil, fmt.Errorf("业务表未包含字段 `id`") | 188 | + return nil, factory.FastError(fmt.Errorf("业务表未包含字段 `id`")) |
| 181 | } | 189 | } |
| 182 | mainTable = domainService.NewTable(domain.MainTable, cmd.TableName, fields, 0). | 190 | mainTable = domainService.NewTable(domain.MainTable, cmd.TableName, fields, 0). |
| 183 | WithContext(ctx). | 191 | WithContext(ctx). |
-
请 注册 或 登录 后发表评论