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"` TrainSizeLinks []*TrainSizeDto `json:"trainSizeLinks" form:"trainSizeLinks"` PublishedGiLinks []*PublishedGiLinkDto `json:"mapInfoLinks" form:"mapInfoLinks"` } type ProjectLinkReqDto struct { Pid int32 `json:"pid" form:"pid"` Sids []*int32 `json:"sids" form:"sids"` 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, TrainSizeLinks: []*TrainSizeDto{}, PublishedGiLinks: []*PublishedGiLinkDto{}, } } func ConvertFromPublishedGiLink(giSlice []*model.PublishedGi) []*PublishedGiLinkDto { var result []*PublishedGiLinkDto for _, gi := range giSlice { result = append(result, &PublishedGiLinkDto{Id: gi.ID, Name: gi.Name, Category: gi.Category, Type: gi.Type}) } return result }