fix: shop_players 关系表主键与模型对齐

This commit is contained in:
zetaloop
2026-04-04 06:25:49 +08:00
parent 3a81aec527
commit 7dc088eadf
18 changed files with 91 additions and 310 deletions
@@ -74,12 +74,6 @@ func (_c *ShopPlayersCreate) SetNillableLeftAt(v *time.Time) *ShopPlayersCreate
return _c
}
// SetID sets the "id" field.
func (_c *ShopPlayersCreate) SetID(v int64) *ShopPlayersCreate {
_c.mutation.SetID(v)
return _c
}
// Mutation returns the ShopPlayersMutation object of the builder.
func (_c *ShopPlayersCreate) Mutation() *ShopPlayersMutation {
return _c.mutation
@@ -150,11 +144,6 @@ func (_c *ShopPlayersCreate) sqlSave(ctx context.Context) (*ShopPlayers, error)
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = int64(id)
}
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
@@ -162,12 +151,8 @@ func (_c *ShopPlayersCreate) sqlSave(ctx context.Context) (*ShopPlayers, error)
func (_c *ShopPlayersCreate) createSpec() (*ShopPlayers, *sqlgraph.CreateSpec) {
var (
_node = &ShopPlayers{config: _c.config}
_spec = sqlgraph.NewCreateSpec(shopplayers.Table, sqlgraph.NewFieldSpec(shopplayers.FieldID, field.TypeInt64))
_spec = sqlgraph.NewCreateSpec(shopplayers.Table, nil)
)
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := _c.mutation.ShopID(); ok {
_spec.SetField(shopplayers.FieldShopID, field.TypeInt64, value)
_node.ShopID = value
@@ -235,11 +220,6 @@ func (_c *ShopPlayersCreateBulk) Save(ctx context.Context) ([]*ShopPlayers, erro
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = int64(id)
}
mutation.done = true
return nodes[i], nil
})