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

65 lines
2.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
import (
"joylink.club/bj-rtsts-server/db/model"
"joylink.club/bj-rtsts-server/dto/state_proto"
)
type PageProjectRunConfigReqDto struct {
PageQueryDto
Name string `json:"name" form:"name"`
}
type ProjectRunConfigReqDto struct {
Id int32 `json:"id" form:"id"`
Name string `json:"name" form:"name" binding:"required"`
Description string `json:"description" form:"description"`
ConfigContent string `json:"config" form:"config" binding:"required"`
}
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"`
}
type RunConfigDescription struct {
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"`
}
type TrainConnTypeConfigDto struct {
TypeName string `json:"typeName" form:"typeName"` // 连接名称; //连接名称
ConnType state_proto.TrainConnState_TrainConnType `json:"connType" form:"connType"` // NONE = 0 未知连接 ;VOBC = 1; //半实物PC_SIM = 2; //PC仿真
}
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
}