63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
|
package dto
|
||
|
|
||
|
import "joylink.club/bj-rtsts-server/db/model"
|
||
|
|
||
|
type PagePublishedReqDto struct {
|
||
|
PageQueryDto
|
||
|
Name string `json:"name" form:"name"`
|
||
|
}
|
||
|
|
||
|
type PublishedListReqDto struct {
|
||
|
Name string `json:"name" form:"name"`
|
||
|
}
|
||
|
|
||
|
type PublishedDto struct {
|
||
|
ID int32 `json:"id"`
|
||
|
Name string `json:"name"`
|
||
|
Proto []byte `json:"proto"`
|
||
|
UserID int32 `json:"userID"`
|
||
|
Note string `json:"note"`
|
||
|
Type int32 `json:"type"`
|
||
|
Category string `json:"category" form:"category"`
|
||
|
PublishAt JsonTime `json:"publishAt" time_format:"2006-01-02 15:04:05"`
|
||
|
}
|
||
|
|
||
|
func ConvertFromPublisheds(ps []*model.Published, ds []*model.PublishedVersion) []*PublishedDto {
|
||
|
vm := make(map[int32]*model.PublishedVersion)
|
||
|
for _, m := range ds {
|
||
|
vm[m.ID] = m
|
||
|
}
|
||
|
var result []*PublishedDto
|
||
|
for _, p := range ps {
|
||
|
result = append(result, ConvertFromPublished(p, vm[p.DataID]))
|
||
|
}
|
||
|
return result
|
||
|
}
|
||
|
|
||
|
func ConvertFromPublished(gi *model.Published, d *model.PublishedVersion) *PublishedDto {
|
||
|
return &PublishedDto{
|
||
|
ID: gi.ID,
|
||
|
Name: gi.Code,
|
||
|
Category: gi.Category,
|
||
|
Type: gi.Type,
|
||
|
Proto: d.Proto,
|
||
|
UserID: d.UserID,
|
||
|
Note: d.Note,
|
||
|
PublishAt: JsonTime(d.PublishAt),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type PublishReqDto struct {
|
||
|
//发布后的名称
|
||
|
Name string `json:"name" form:"name"`
|
||
|
//草稿数据的id
|
||
|
DraftId int32 `json:"draftId" form:"draftId"`
|
||
|
Note string `json:"note" form:"note"`
|
||
|
}
|
||
|
|
||
|
// PublishedGiSingleQueryDto 单个查询发布地图数据
|
||
|
type PublishedSingleQueryDto struct {
|
||
|
Name string `json:"name" form:"name"`
|
||
|
Detail bool `json:"detail" form:"detail"`
|
||
|
}
|