40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package dto
|
|
|
|
import "joylink.club/bj-rtsts-server/db/model"
|
|
|
|
type ProjectLinkRspDto struct {
|
|
Pid int32 `json:"pid" form:"pid"`
|
|
Name string `json:"name" form:"name"`
|
|
Code string `json:"code" form:"code"`
|
|
PublishedGiLinks []*PublishedGiLinkDto `json:"mapInfoLinks" form:"mapInfoLinks"`
|
|
}
|
|
|
|
type ProjectLinkReqDto struct {
|
|
Pid int32 `json:"pid" form:"pid"`
|
|
Mids []*int32 `json:"mids" form:"mids"`
|
|
}
|
|
|
|
type PublishedGiLinkDto struct {
|
|
Id int32 `json:"id" form:"id"`
|
|
Name string `json:"name" form:"name"`
|
|
Category string `json:"category" form:"category"`
|
|
Type int32 `json:"type" form:"type"`
|
|
}
|
|
|
|
func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto {
|
|
return &ProjectLinkRspDto{
|
|
Pid: gi.ID,
|
|
Name: gi.Name,
|
|
Code: gi.Code,
|
|
PublishedGiLinks: []*PublishedGiLinkDto{},
|
|
}
|
|
}
|
|
|
|
func ConvertFromPublishedGiLink(giSlice []*model.Published) []*PublishedGiLinkDto {
|
|
var result []*PublishedGiLinkDto
|
|
for _, gi := range giSlice {
|
|
result = append(result, &PublishedGiLinkDto{Id: gi.ID, Name: gi.Code, Category: gi.Category, Type: gi.Type})
|
|
}
|
|
return result
|
|
}
|