作者 yangfu

fix: table preview

@@ -11,6 +11,9 @@ import ( @@ -11,6 +11,9 @@ import (
11 ) 11 )
12 12
13 func (tableService *TableService) TablePreview(ctx *domain.Context, cmd *command.TablePreviewCommand) (interface{}, error) { 13 func (tableService *TableService) TablePreview(ctx *domain.Context, cmd *command.TablePreviewCommand) (interface{}, error) {
  14 + if cmd.TableId == 0 {
  15 + return &dto.TablePreviewDto{}, nil
  16 + }
14 if err := cmd.ValidateCommand(); err != nil { 17 if err := cmd.ValidateCommand(); err != nil {
15 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 18 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
16 } 19 }
@@ -278,6 +278,9 @@ func (ptr *QuerySetService) PreviewPrepare(ctx *domain.Context, querySetId int, @@ -278,6 +278,9 @@ func (ptr *QuerySetService) PreviewPrepare(ctx *domain.Context, querySetId int,
278 return t, nil 278 return t, nil
279 } 279 }
280 } 280 }
  281 + if len(queryComponents) == 0 {
  282 + return &domain.Table{}, nil
  283 + }
281 284
282 // 验证 285 // 验证
283 if err = ptr.validQueryComponents(queryComponents); err != nil { 286 if err = ptr.validQueryComponents(queryComponents); err != nil {