rts-sim-testing-service/dto/projectLink.go

46 lines
1.4 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"`
// TODO:前端修改完成后删除
TrainSizeLinks []*TrainSizeDto `json:"trainSizeLinks" form:"trainSizeLinks"`
}
type ProjectLinkReqDto struct {
Pid int32 `json:"pid" form:"pid"`
Mids []*int32 `json:"mids" form:"mids"`
// TODO:前端修改完成后删除
Sids []*int32 `json:"sids" form:"sids"`
}
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{},
// TODO:前端修改完成后删除
TrainSizeLinks: []*TrainSizeDto{},
}
}
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
}