【修改循环引用,草稿model重新生成】

This commit is contained in:
weizhihong 2023-08-25 15:14:37 +08:00
parent bb512bd703
commit f2409f5b1f
10 changed files with 67 additions and 478 deletions

View File

@ -3,12 +3,13 @@ package calculate
import (
"errors"
"fmt"
"math"
"strconv"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/memory"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/device"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/ref"
"math"
"strconv"
)
// CalculateLinkPositionAndDirection 根据起始link位置、偏移量、偏移方向计算偏移后的位置及方向。偏移方向上的剩余距离不够会返回error
@ -143,13 +144,13 @@ func calculateLen(start *ref.DevicePosition[*device.LinkModel], end *ref.DeviceP
var lps []*ref.DevicePosition[*device.LinkModel]
if turnoutPort != nil {
turnoutModel := start.Device.BRelatedSwitchRef.SwitchDevice.(*device.SwitchDeviceModel)
ref.ConvertFromDevicePort(turnoutModel.BLinkPort)
device.ConvertFromDevicePort(turnoutModel.BLinkPort)
switch turnoutPort.Port {
case face.A:
lps = append(lps, ref.ConvertFromDevicePort(turnoutModel.BLinkPort))
lps = append(lps, ref.ConvertFromDevicePort(turnoutModel.CLinkPort))
lps = append(lps, device.ConvertFromDevicePort(turnoutModel.BLinkPort))
lps = append(lps, device.ConvertFromDevicePort(turnoutModel.CLinkPort))
case face.B | face.C:
lps = append(lps, ref.ConvertFromDevicePort(turnoutModel.ALinkPort))
lps = append(lps, device.ConvertFromDevicePort(turnoutModel.ALinkPort))
}
}
for _, lp := range lps {

View File

@ -284,9 +284,9 @@ func decoderVobcTrainState(buf []byte) *state.TrainVobcState {
trainVobcInfo.TractionSafetyCircuit = (b3 & (1 << 4)) != 0
trainVobcInfo.ParkingBrakeStatus = (b3 & (1 << 5)) != 0
trainVobcInfo.MaintainBrakeStatus = (b3 & (1 << 6)) != 0
trainVobcInfo.TractionForce = int64(binary.BigEndian.Uint16(buf[4:6]))
trainVobcInfo.BrakeForce = int64(binary.BigEndian.Uint16(buf[6:8]))
trainVobcInfo.TrainLoad = int64(binary.BigEndian.Uint16(buf[8:10]))
trainVobcInfo.TractionForce = int64(binary.BigEndian.Uint16(buf[4:6]) / 100)
trainVobcInfo.BrakeForce = int64(binary.BigEndian.Uint16(buf[6:8]) / 100)
trainVobcInfo.TrainLoad = int64(binary.BigEndian.Uint16(buf[8:10]) / 100)
b4 := buf[15]
trainVobcInfo.LeftDoorOpenCommand = (b4 & 1) != 0
trainVobcInfo.RightDoorOpenCommand = (b4 & (1 << 1)) != 0

View File

@ -470,7 +470,8 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
SwitchDevice: modeller,
Port: port,
}
turnoutModel := modeller.(*device.SwitchDeviceModel)
turnoutModel, ok := modeller.(*device.SwitchDeviceModel)
if ok {
linkPort := &ref.DevicePort[*device.LinkModel]{
Device: linkModel,
Port: face.A,
@ -484,6 +485,7 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
turnoutModel.CLinkPort = linkPort
}
}
}
if link.BRelatedRef != nil {
modeller := deviceIdMap[link.ARelatedRef.Id]
port := face.GetPortEnum(int8(link.ARelatedRef.DevicePort))
@ -491,7 +493,8 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
SwitchDevice: deviceIdMap[link.BRelatedRef.Id],
Port: face.GetPortEnum(int8(link.BRelatedRef.DevicePort)),
}
turnoutModel := modeller.(*device.SwitchDeviceModel)
turnoutModel, ok := modeller.(*device.SwitchDeviceModel)
if ok {
linkPort := &ref.DevicePort[*device.LinkModel]{
Device: linkModel,
Port: face.B,
@ -505,6 +508,7 @@ func initLinks(links []*graphicData.CalculateLink, vs *VerifyStructure, dataMap
turnoutModel.CLinkPort = linkPort
}
}
}
vs.LinkModelMap[link.Index] = linkModel
dataMap.CalcLinkMap[link.Index] = link
//构建DevicePositionDP切片

View File

@ -16,3 +16,14 @@ type LinkModel struct {
//Link上的设备及位置(包括A、B端的设备)(按offset排序)
DevicePositions []*ref.DevicePosition[face.DeviceModeller]
}
func ConvertFromDevicePort(dp *ref.DevicePort[*LinkModel]) *ref.DevicePosition[*LinkModel] {
var offset int32 = 0
if dp.Port == face.B {
offset = dp.Device.Length
}
return &ref.DevicePosition[*LinkModel]{
Device: dp.Device,
Offset: offset,
}
}

View File

@ -2,8 +2,8 @@ package ref
import (
"fmt"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/face"
"joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/model/device"
)
type DevicePosition[T face.DeviceModeller] struct {
@ -14,14 +14,3 @@ type DevicePosition[T face.DeviceModeller] struct {
func (dp *DevicePosition[T]) String() string {
return fmt.Sprintf("%s-%d", dp.Device.GetIndex(), dp.Offset)
}
func ConvertFromDevicePort(dp *DevicePort[*device.LinkModel]) *DevicePosition[*device.LinkModel] {
var offset int32 = 0
if dp.Port == face.B {
offset = dp.Device.Length
}
return &DevicePosition[*device.LinkModel]{
Device: dp.Device,
Offset: offset,
}
}

View File

@ -29,11 +29,12 @@ func newDrafting(db *gorm.DB, opts ...gen.DOOption) drafting {
_drafting.ALL = field.NewAsterisk(tableName)
_drafting.ID = field.NewInt32(tableName, "id")
_drafting.Name = field.NewString(tableName, "name")
_drafting.Category = field.NewString(tableName, "category")
_drafting.Type = field.NewString(tableName, "type")
_drafting.Proto = field.NewBytes(tableName, "proto")
_drafting.CreatorID = field.NewInt32(tableName, "creator_id")
_drafting.CreatedAt = field.NewTime(tableName, "created_at")
_drafting.UpdateAt = field.NewTime(tableName, "update_at")
_drafting.Category = field.NewString(tableName, "category")
_drafting.fillFieldMap()
@ -46,11 +47,12 @@ type drafting struct {
ALL field.Asterisk
ID field.Int32 // id
Name field.String // 草稿图名称
Category field.String // 厂家编码
Type field.String // 数据类型
Proto field.Bytes // 绘图数据
CreatorID field.Int32 // 创建人id
CreatedAt field.Time // 创建时间
UpdateAt field.Time // 修改时间
Category field.String // 厂家编码
fieldMap map[string]field.Expr
}
@ -69,11 +71,12 @@ func (d *drafting) updateTableName(table string) *drafting {
d.ALL = field.NewAsterisk(table)
d.ID = field.NewInt32(table, "id")
d.Name = field.NewString(table, "name")
d.Category = field.NewString(table, "category")
d.Type = field.NewString(table, "type")
d.Proto = field.NewBytes(table, "proto")
d.CreatorID = field.NewInt32(table, "creator_id")
d.CreatedAt = field.NewTime(table, "created_at")
d.UpdateAt = field.NewTime(table, "update_at")
d.Category = field.NewString(table, "category")
d.fillFieldMap()
@ -90,14 +93,15 @@ func (d *drafting) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
}
func (d *drafting) fillFieldMap() {
d.fieldMap = make(map[string]field.Expr, 7)
d.fieldMap = make(map[string]field.Expr, 8)
d.fieldMap["id"] = d.ID
d.fieldMap["name"] = d.Name
d.fieldMap["category"] = d.Category
d.fieldMap["type"] = d.Type
d.fieldMap["proto"] = d.Proto
d.fieldMap["creator_id"] = d.CreatorID
d.fieldMap["created_at"] = d.CreatedAt
d.fieldMap["update_at"] = d.UpdateAt
d.fieldMap["category"] = d.Category
}
func (d drafting) clone(db *gorm.DB) drafting {

View File

@ -1,396 +0,0 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package dbquery
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"joylink.club/bj-rtsts-server/db/model"
)
func newTrainGroup(db *gorm.DB, opts ...gen.DOOption) trainGroup {
_trainGroup := trainGroup{}
_trainGroup.trainGroupDo.UseDB(db, opts...)
_trainGroup.trainGroupDo.UseModel(&model.TrainGroup{})
tableName := _trainGroup.trainGroupDo.TableName()
_trainGroup.ALL = field.NewAsterisk(tableName)
_trainGroup.ID = field.NewInt32(tableName, "id")
_trainGroup.Name = field.NewString(tableName, "name")
_trainGroup.CarriageLength = field.NewInt32(tableName, "carriage_length")
_trainGroup.CreatedAt = field.NewTime(tableName, "created_at")
_trainGroup.UpdateAt = field.NewTime(tableName, "update_at")
_trainGroup.fillFieldMap()
return _trainGroup
}
type trainGroup struct {
trainGroupDo
ALL field.Asterisk
ID field.Int32
Name field.String // 组次名称
CarriageLength field.Int32 // 单个车厢长度
CreatedAt field.Time // 创建时间
UpdateAt field.Time // 更新时间
fieldMap map[string]field.Expr
}
func (t trainGroup) Table(newTableName string) *trainGroup {
t.trainGroupDo.UseTable(newTableName)
return t.updateTableName(newTableName)
}
func (t trainGroup) As(alias string) *trainGroup {
t.trainGroupDo.DO = *(t.trainGroupDo.As(alias).(*gen.DO))
return t.updateTableName(alias)
}
func (t *trainGroup) updateTableName(table string) *trainGroup {
t.ALL = field.NewAsterisk(table)
t.ID = field.NewInt32(table, "id")
t.Name = field.NewString(table, "name")
t.CarriageLength = field.NewInt32(table, "carriage_length")
t.CreatedAt = field.NewTime(table, "created_at")
t.UpdateAt = field.NewTime(table, "update_at")
t.fillFieldMap()
return t
}
func (t *trainGroup) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := t.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (t *trainGroup) fillFieldMap() {
t.fieldMap = make(map[string]field.Expr, 5)
t.fieldMap["id"] = t.ID
t.fieldMap["name"] = t.Name
t.fieldMap["carriage_length"] = t.CarriageLength
t.fieldMap["created_at"] = t.CreatedAt
t.fieldMap["update_at"] = t.UpdateAt
}
func (t trainGroup) clone(db *gorm.DB) trainGroup {
t.trainGroupDo.ReplaceConnPool(db.Statement.ConnPool)
return t
}
func (t trainGroup) replaceDB(db *gorm.DB) trainGroup {
t.trainGroupDo.ReplaceDB(db)
return t
}
type trainGroupDo struct{ gen.DO }
type ITrainGroupDo interface {
gen.SubQuery
Debug() ITrainGroupDo
WithContext(ctx context.Context) ITrainGroupDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() ITrainGroupDo
WriteDB() ITrainGroupDo
As(alias string) gen.Dao
Session(config *gorm.Session) ITrainGroupDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) ITrainGroupDo
Not(conds ...gen.Condition) ITrainGroupDo
Or(conds ...gen.Condition) ITrainGroupDo
Select(conds ...field.Expr) ITrainGroupDo
Where(conds ...gen.Condition) ITrainGroupDo
Order(conds ...field.Expr) ITrainGroupDo
Distinct(cols ...field.Expr) ITrainGroupDo
Omit(cols ...field.Expr) ITrainGroupDo
Join(table schema.Tabler, on ...field.Expr) ITrainGroupDo
LeftJoin(table schema.Tabler, on ...field.Expr) ITrainGroupDo
RightJoin(table schema.Tabler, on ...field.Expr) ITrainGroupDo
Group(cols ...field.Expr) ITrainGroupDo
Having(conds ...gen.Condition) ITrainGroupDo
Limit(limit int) ITrainGroupDo
Offset(offset int) ITrainGroupDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) ITrainGroupDo
Unscoped() ITrainGroupDo
Create(values ...*model.TrainGroup) error
CreateInBatches(values []*model.TrainGroup, batchSize int) error
Save(values ...*model.TrainGroup) error
First() (*model.TrainGroup, error)
Take() (*model.TrainGroup, error)
Last() (*model.TrainGroup, error)
Find() ([]*model.TrainGroup, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TrainGroup, err error)
FindInBatches(result *[]*model.TrainGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.TrainGroup) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) ITrainGroupDo
Assign(attrs ...field.AssignExpr) ITrainGroupDo
Joins(fields ...field.RelationField) ITrainGroupDo
Preload(fields ...field.RelationField) ITrainGroupDo
FirstOrInit() (*model.TrainGroup, error)
FirstOrCreate() (*model.TrainGroup, error)
FindByPage(offset int, limit int) (result []*model.TrainGroup, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) ITrainGroupDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (t trainGroupDo) Debug() ITrainGroupDo {
return t.withDO(t.DO.Debug())
}
func (t trainGroupDo) WithContext(ctx context.Context) ITrainGroupDo {
return t.withDO(t.DO.WithContext(ctx))
}
func (t trainGroupDo) ReadDB() ITrainGroupDo {
return t.Clauses(dbresolver.Read)
}
func (t trainGroupDo) WriteDB() ITrainGroupDo {
return t.Clauses(dbresolver.Write)
}
func (t trainGroupDo) Session(config *gorm.Session) ITrainGroupDo {
return t.withDO(t.DO.Session(config))
}
func (t trainGroupDo) Clauses(conds ...clause.Expression) ITrainGroupDo {
return t.withDO(t.DO.Clauses(conds...))
}
func (t trainGroupDo) Returning(value interface{}, columns ...string) ITrainGroupDo {
return t.withDO(t.DO.Returning(value, columns...))
}
func (t trainGroupDo) Not(conds ...gen.Condition) ITrainGroupDo {
return t.withDO(t.DO.Not(conds...))
}
func (t trainGroupDo) Or(conds ...gen.Condition) ITrainGroupDo {
return t.withDO(t.DO.Or(conds...))
}
func (t trainGroupDo) Select(conds ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Select(conds...))
}
func (t trainGroupDo) Where(conds ...gen.Condition) ITrainGroupDo {
return t.withDO(t.DO.Where(conds...))
}
func (t trainGroupDo) Order(conds ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Order(conds...))
}
func (t trainGroupDo) Distinct(cols ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Distinct(cols...))
}
func (t trainGroupDo) Omit(cols ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Omit(cols...))
}
func (t trainGroupDo) Join(table schema.Tabler, on ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Join(table, on...))
}
func (t trainGroupDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.LeftJoin(table, on...))
}
func (t trainGroupDo) RightJoin(table schema.Tabler, on ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.RightJoin(table, on...))
}
func (t trainGroupDo) Group(cols ...field.Expr) ITrainGroupDo {
return t.withDO(t.DO.Group(cols...))
}
func (t trainGroupDo) Having(conds ...gen.Condition) ITrainGroupDo {
return t.withDO(t.DO.Having(conds...))
}
func (t trainGroupDo) Limit(limit int) ITrainGroupDo {
return t.withDO(t.DO.Limit(limit))
}
func (t trainGroupDo) Offset(offset int) ITrainGroupDo {
return t.withDO(t.DO.Offset(offset))
}
func (t trainGroupDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITrainGroupDo {
return t.withDO(t.DO.Scopes(funcs...))
}
func (t trainGroupDo) Unscoped() ITrainGroupDo {
return t.withDO(t.DO.Unscoped())
}
func (t trainGroupDo) Create(values ...*model.TrainGroup) error {
if len(values) == 0 {
return nil
}
return t.DO.Create(values)
}
func (t trainGroupDo) CreateInBatches(values []*model.TrainGroup, batchSize int) error {
return t.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (t trainGroupDo) Save(values ...*model.TrainGroup) error {
if len(values) == 0 {
return nil
}
return t.DO.Save(values)
}
func (t trainGroupDo) First() (*model.TrainGroup, error) {
if result, err := t.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.TrainGroup), nil
}
}
func (t trainGroupDo) Take() (*model.TrainGroup, error) {
if result, err := t.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.TrainGroup), nil
}
}
func (t trainGroupDo) Last() (*model.TrainGroup, error) {
if result, err := t.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.TrainGroup), nil
}
}
func (t trainGroupDo) Find() ([]*model.TrainGroup, error) {
result, err := t.DO.Find()
return result.([]*model.TrainGroup), err
}
func (t trainGroupDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TrainGroup, err error) {
buf := make([]*model.TrainGroup, 0, batchSize)
err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (t trainGroupDo) FindInBatches(result *[]*model.TrainGroup, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return t.DO.FindInBatches(result, batchSize, fc)
}
func (t trainGroupDo) Attrs(attrs ...field.AssignExpr) ITrainGroupDo {
return t.withDO(t.DO.Attrs(attrs...))
}
func (t trainGroupDo) Assign(attrs ...field.AssignExpr) ITrainGroupDo {
return t.withDO(t.DO.Assign(attrs...))
}
func (t trainGroupDo) Joins(fields ...field.RelationField) ITrainGroupDo {
for _, _f := range fields {
t = *t.withDO(t.DO.Joins(_f))
}
return &t
}
func (t trainGroupDo) Preload(fields ...field.RelationField) ITrainGroupDo {
for _, _f := range fields {
t = *t.withDO(t.DO.Preload(_f))
}
return &t
}
func (t trainGroupDo) FirstOrInit() (*model.TrainGroup, error) {
if result, err := t.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.TrainGroup), nil
}
}
func (t trainGroupDo) FirstOrCreate() (*model.TrainGroup, error) {
if result, err := t.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.TrainGroup), nil
}
}
func (t trainGroupDo) FindByPage(offset int, limit int) (result []*model.TrainGroup, count int64, err error) {
result, err = t.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = t.Offset(-1).Limit(-1).Count()
return
}
func (t trainGroupDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = t.Count()
if err != nil {
return
}
err = t.Offset(offset).Limit(limit).Scan(result)
return
}
func (t trainGroupDo) Scan(result interface{}) (err error) {
return t.DO.Scan(result)
}
func (t trainGroupDo) Delete(models ...*model.TrainGroup) (result gen.ResultInfo, err error) {
return t.DO.Delete(models)
}
func (t *trainGroupDo) withDO(do gen.Dao) *trainGroupDo {
t.DO = *do.(*gen.DO)
return t
}

View File

@ -14,11 +14,12 @@ const TableNameDrafting = "drafting"
type Drafting struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:id" json:"id"` // id
Name string `gorm:"column:name;not null;comment:草稿图名称" json:"name"` // 草稿图名称
Category string `gorm:"column:category;comment:厂家编码" json:"category"` // 厂家编码
Type string `gorm:"column:type;comment:数据类型" json:"type"` // 数据类型
Proto []byte `gorm:"column:proto;comment:绘图数据" json:"proto"` // 绘图数据
CreatorID int32 `gorm:"column:creator_id;not null;comment:创建人id" json:"creator_id"` // 创建人id
CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"` // 创建时间
UpdateAt time.Time `gorm:"column:update_at;comment:修改时间" json:"update_at"` // 修改时间
Category string `gorm:"column:category;comment:厂家编码" json:"category"` // 厂家编码
}
// TableName Drafting's table name

View File

@ -1,25 +0,0 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
)
const TableNameTrainGroup = "train_group"
// TrainGroup mapped from table <train_group>
type TrainGroup struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Name string `gorm:"column:name;comment:组次名称" json:"name"` // 组次名称
CarriageLength int32 `gorm:"column:carriage_length;comment:单个车厢长度" json:"carriage_length"` // 单个车厢长度
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"created_at"` // 创建时间
UpdateAt time.Time `gorm:"column:update_at;comment:更新时间" json:"update_at"` // 更新时间
}
// TableName TrainGroup's table name
func (*TrainGroup) TableName() string {
return TableNameTrainGroup
}

View File

@ -19,8 +19,8 @@ type TrainModelDto struct {
type TrainSizeDto struct {
Id int32 `json:"id" form:"id"`
Name string `json:"name" form:"name"`
CarriageLength int32 `json:"carriageLength" form:"carriageLength"`
TotalLength int32 `json:"totalLength" form:"totalLength"`
CarriageLength int32 `json:"carriage_length" form:"carriage_length"`
TotalLength int32 `json:"total_length" form:"total_length"`
Description string `json:"description" form:"description"`
}
@ -42,8 +42,8 @@ type TrainWheelDiameterDto struct {
Id int32 `json:"id" form:"id"`
Name string `json:"name" form:"name"`
Diameter int32 `json:"diameter" form:"diameter"`
MinDiameter int32 `json:"minDiameter" form:"minDiameter"`
MaxDiameter int32 `json:"maxDiameter" form:"maxDiameter"`
AxialPosition int32 `json:"AxialPosition" form:"AxialPosition"`
InstallDirection string `json:"installDirection" form:"installDirection"`
MinDiameter int32 `json:"min_diameter" form:"min_diameter"`
MaxDiameter int32 `json:"max_diameter" form:"max_diameter"`
AxialPosition int32 `json:"axial_position" form:"axial_position"`
InstallDirection string `json:"install_direction" form:"install_direction"`
}