2023-08-25 10:41:13 +08:00
|
|
|
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"`
|
2023-09-18 15:19:07 +08:00
|
|
|
Type int32 `json:"type" form:"type"`
|
2023-08-25 10:41:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func ConvertProjectLink(gi *model.Project) *ProjectLinkRspDto {
|
|
|
|
return &ProjectLinkRspDto{
|
|
|
|
Pid: gi.ID,
|
|
|
|
Name: gi.Name,
|
|
|
|
Code: gi.Code,
|
|
|
|
PublishedGiLinks: []*PublishedGiLinkDto{},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-17 16:22:22 +08:00
|
|
|
func ConvertFromPublishedGiLink(giSlice []*model.Published) []*PublishedGiLinkDto {
|
2023-08-25 10:41:13 +08:00
|
|
|
var result []*PublishedGiLinkDto
|
|
|
|
for _, gi := range giSlice {
|
2023-11-17 16:22:22 +08:00
|
|
|
result = append(result, &PublishedGiLinkDto{Id: gi.ID, Name: gi.Code, Category: gi.Category, Type: gi.Type})
|
2023-08-25 10:41:13 +08:00
|
|
|
}
|
|
|
|
return result
|
|
|
|
}
|