table_preview_dto.go
836 字节
package dto
import "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
type TablePreviewDto struct {
// 表Id
TableId int `json:"objectId"`
// 表Id
ObjectType string `json:"objectType"`
// 表类型 MainTable:主表 SideTable:副表 SubTable:分表 ExcelTable:Excel表
TableType string `json:"tableType"`
// 名称
Name string `json:"name"`
// 数据
*domain.DataTable
}
func (d *TablePreviewDto) Load(m *domain.Table, dataTable *domain.DataTable, objectType string) *TablePreviewDto {
d.TableId = m.TableId
d.TableType = m.TableType
d.ObjectType = objectType
d.Name = m.Name
d.DataTable = &domain.DataTable{}
d.Fields = dataTable.MatchFields(m.Fields(true))
d.Data = dataTable.Data
d.Total = dataTable.Total
if len(d.Data) == 0 {
d.Data = make([][]string, 0)
}
return d
}