feat:多项功能优化

This commit is contained in:
zhoujianjin
2026-09-18 18:54:54 +08:00
parent 672cd23329
commit 543655d441
48 changed files with 1289 additions and 447 deletions
+50
View File
@@ -82,6 +82,34 @@ func (_c *StationCreate) SetNillableStatus(v *string) *StationCreate {
return _c
}
// SetIsBuiltin sets the "isBuiltin" field.
func (_c *StationCreate) SetIsBuiltin(v bool) *StationCreate {
_c.mutation.SetIsBuiltin(v)
return _c
}
// SetNillableIsBuiltin sets the "isBuiltin" field if the given value is not nil.
func (_c *StationCreate) SetNillableIsBuiltin(v *bool) *StationCreate {
if v != nil {
_c.SetIsBuiltin(*v)
}
return _c
}
// SetHasDock sets the "hasDock" field.
func (_c *StationCreate) SetHasDock(v bool) *StationCreate {
_c.mutation.SetHasDock(v)
return _c
}
// SetNillableHasDock sets the "hasDock" field if the given value is not nil.
func (_c *StationCreate) SetNillableHasDock(v *bool) *StationCreate {
if v != nil {
_c.SetHasDock(*v)
}
return _c
}
// SetCreatedAt sets the "createdAt" field.
func (_c *StationCreate) SetCreatedAt(v time.Time) *StationCreate {
_c.mutation.SetCreatedAt(v)
@@ -149,6 +177,14 @@ func (_c *StationCreate) defaults() {
v := station.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.IsBuiltin(); !ok {
v := station.DefaultIsBuiltin
_c.mutation.SetIsBuiltin(v)
}
if _, ok := _c.mutation.HasDock(); !ok {
v := station.DefaultHasDock
_c.mutation.SetHasDock(v)
}
if _, ok := _c.mutation.CreatedAt(); !ok {
v := station.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
@@ -184,6 +220,12 @@ func (_c *StationCreate) check() error {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Station.status": %w`, err)}
}
}
if _, ok := _c.mutation.IsBuiltin(); !ok {
return &ValidationError{Name: "isBuiltin", err: errors.New(`ent: missing required field "Station.isBuiltin"`)}
}
if _, ok := _c.mutation.HasDock(); !ok {
return &ValidationError{Name: "hasDock", err: errors.New(`ent: missing required field "Station.hasDock"`)}
}
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "Station.createdAt"`)}
}
@@ -244,6 +286,14 @@ func (_c *StationCreate) createSpec() (*Station, *sqlgraph.CreateSpec) {
_spec.SetField(station.FieldStatus, field.TypeString, value)
_node.Status = value
}
if value, ok := _c.mutation.IsBuiltin(); ok {
_spec.SetField(station.FieldIsBuiltin, field.TypeBool, value)
_node.IsBuiltin = value
}
if value, ok := _c.mutation.HasDock(); ok {
_spec.SetField(station.FieldHasDock, field.TypeBool, value)
_node.HasDock = value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(station.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value