2023-10-24 16:37:27 +08:00
|
|
|
|
package dto
|
|
|
|
|
|
2024-03-15 17:50:18 +08:00
|
|
|
|
import (
|
|
|
|
|
"joylink.club/bj-rtsts-server/db/model"
|
|
|
|
|
"joylink.club/bj-rtsts-server/dto/state_proto"
|
|
|
|
|
)
|
2023-10-24 16:37:27 +08:00
|
|
|
|
|
|
|
|
|
type PageProjectRunConfigReqDto struct {
|
|
|
|
|
PageQueryDto
|
|
|
|
|
Name string `json:"name" form:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ProjectRunConfigReqDto struct {
|
|
|
|
|
Id int32 `json:"id" form:"id"`
|
2023-10-27 14:57:37 +08:00
|
|
|
|
Name string `json:"name" form:"name" binding:"required"`
|
2023-10-24 16:37:27 +08:00
|
|
|
|
Description string `json:"description" form:"description"`
|
2023-10-27 14:57:37 +08:00
|
|
|
|
ConfigContent string `json:"config" form:"config" binding:"required"`
|
2023-10-24 16:37:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ProjectRunConfigDto struct {
|
|
|
|
|
Id int32 `json:"id" form:"id"`
|
|
|
|
|
Name string `json:"name" form:"name"`
|
|
|
|
|
Description string `json:"description" form:"description"`
|
|
|
|
|
ConfigContent string `json:"config" form:"config"`
|
|
|
|
|
CreatedAt JsonTime `json:"createdAt" time_format:"2006-01-02 15:04:05"`
|
|
|
|
|
UpdateAt JsonTime `json:"updateAt" time_format:"2006-01-02 15:04:05"`
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-31 18:08:17 +08:00
|
|
|
|
type RunConfigDescription struct {
|
2023-12-13 11:22:30 +08:00
|
|
|
|
FieldName string `json:"fieldName" form:"fieldName"`
|
|
|
|
|
Description string `json:"description" form:"description"`
|
|
|
|
|
Type string `json:"type" form:"type"`
|
|
|
|
|
DefaultValue string `json:"defaultValue" form:"defaultValue"`
|
|
|
|
|
SelectOptions []*RunConfigSelectOption `json:"selectOptions" form:"selectOptions"`
|
|
|
|
|
ItemTypeFields []*RunConfigDescription `json:"itemTypeFields" form:"itemTypeFields"`
|
|
|
|
|
}
|
|
|
|
|
type RunConfigSelectOption struct {
|
|
|
|
|
Label string `json:"label" form:"label"`
|
|
|
|
|
Value int32 `json:"value" form:"value"`
|
2023-10-31 18:08:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-15 17:50:18 +08:00
|
|
|
|
type TrainConnTypeConfigDto struct {
|
|
|
|
|
ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` // NONE = 0 未知连接 ;VOBC = 1; //半实物;PC_SIM = 2; //PC仿真
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-24 16:37:27 +08:00
|
|
|
|
func ConvertToRunConfigDto(gi *model.ProjectRunConfig) *ProjectRunConfigDto {
|
|
|
|
|
return &ProjectRunConfigDto{
|
|
|
|
|
Id: gi.ID,
|
|
|
|
|
Name: gi.Name,
|
|
|
|
|
Description: gi.Description,
|
|
|
|
|
ConfigContent: gi.ConfigContent,
|
|
|
|
|
CreatedAt: JsonTime(gi.CreateTime),
|
|
|
|
|
UpdateAt: JsonTime(gi.UpdateTime),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ConvertToRunConfigFromSlice(giSlice []*model.ProjectRunConfig) []*ProjectRunConfigDto {
|
|
|
|
|
var result []*ProjectRunConfigDto
|
|
|
|
|
for _, gi := range giSlice {
|
|
|
|
|
result = append(result, ConvertToRunConfigDto(gi))
|
|
|
|
|
}
|
|
|
|
|
return result
|
|
|
|
|
}
|