bindbox-game/internal/repository/mysql/dao/system_item_cards.gen.go
邹方成 1ab39d2f5a
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 25s
refactor: 重构项目结构并重命名模块
feat(admin): 新增工会管理功能
feat(activity): 添加活动管理相关服务
feat(user): 实现用户道具卡和积分管理
feat(guild): 新增工会成员管理功能

fix: 修复数据库连接配置
fix: 修正jwtoken导入路径
fix: 解决端口冲突问题

style: 统一代码格式和注释风格
style: 更新项目常量命名

docs: 添加项目框架和开发规范文档
docs: 更新接口文档注释

chore: 移除无用代码和文件
chore: 更新Makefile和配置文件
chore: 清理日志文件

test: 添加道具卡测试脚本
2025-11-14 21:10:00 +08:00

393 lines
13 KiB
Go
Raw 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.

// 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 dao
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"bindbox-game/internal/repository/mysql/model"
)
func newSystemItemCards(db *gorm.DB, opts ...gen.DOOption) systemItemCards {
_systemItemCards := systemItemCards{}
_systemItemCards.systemItemCardsDo.UseDB(db, opts...)
_systemItemCards.systemItemCardsDo.UseModel(&model.SystemItemCards{})
tableName := _systemItemCards.systemItemCardsDo.TableName()
_systemItemCards.ALL = field.NewAsterisk(tableName)
_systemItemCards.ID = field.NewInt64(tableName, "id")
_systemItemCards.CreatedAt = field.NewTime(tableName, "created_at")
_systemItemCards.UpdatedAt = field.NewTime(tableName, "updated_at")
_systemItemCards.Name = field.NewString(tableName, "name")
_systemItemCards.Status = field.NewInt32(tableName, "status")
_systemItemCards.CardType = field.NewInt32(tableName, "card_type")
_systemItemCards.ScopeType = field.NewInt32(tableName, "scope_type")
_systemItemCards.ActivityCategoryID = field.NewInt64(tableName, "activity_category_id")
_systemItemCards.ActivityID = field.NewInt64(tableName, "activity_id")
_systemItemCards.IssueID = field.NewInt64(tableName, "issue_id")
_systemItemCards.Price = field.NewInt64(tableName, "price")
_systemItemCards.ValidStart = field.NewTime(tableName, "valid_start")
_systemItemCards.ValidEnd = field.NewTime(tableName, "valid_end")
_systemItemCards.EffectType = field.NewInt32(tableName, "effect_type")
_systemItemCards.RewardMultiplierX1000 = field.NewInt32(tableName, "reward_multiplier_x1000")
_systemItemCards.BoostRateX1000 = field.NewInt32(tableName, "boost_rate_x1000")
_systemItemCards.StackingStrategy = field.NewInt32(tableName, "stacking_strategy")
_systemItemCards.MaxEffectValueX1000 = field.NewInt32(tableName, "max_effect_value_x1000")
_systemItemCards.Remark = field.NewString(tableName, "remark")
_systemItemCards.fillFieldMap()
return _systemItemCards
}
// systemItemCards 道具卡模板
type systemItemCards struct {
systemItemCardsDo
ALL field.Asterisk
ID field.Int64 // 主键ID
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
Name field.String // 卡名称
Status field.Int32 // 状态1启用 2停用
CardType field.Int32 // 卡类型1双倍奖励 2概率提升 等
ScopeType field.Int32 // 适用范围1全局 2活动分类 3活动 4期
ActivityCategoryID field.Int64 // 指定活动分类ID可空
ActivityID field.Int64 // 指定活动ID可空
IssueID field.Int64 // 指定期ID可空
Price field.Int64 // 售卖价格(分)
ValidStart field.Time // 有效期开始
ValidEnd field.Time // 有效期结束
EffectType field.Int32 // 效果类型1奖励倍数 2概率提升 等
RewardMultiplierX1000 field.Int32 // 奖励倍数千分比×2=2000
BoostRateX1000 field.Int32 // 概率提升(千分比,+20%=200
StackingStrategy field.Int32 // 叠加策略1禁止 2同类叠加-上限 3取最大值 4乘法叠加
MaxEffectValueX1000 field.Int32 // 效果上限(千分比)
Remark field.String // 备注
fieldMap map[string]field.Expr
}
func (s systemItemCards) Table(newTableName string) *systemItemCards {
s.systemItemCardsDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s systemItemCards) As(alias string) *systemItemCards {
s.systemItemCardsDo.DO = *(s.systemItemCardsDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *systemItemCards) updateTableName(table string) *systemItemCards {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.Name = field.NewString(table, "name")
s.Status = field.NewInt32(table, "status")
s.CardType = field.NewInt32(table, "card_type")
s.ScopeType = field.NewInt32(table, "scope_type")
s.ActivityCategoryID = field.NewInt64(table, "activity_category_id")
s.ActivityID = field.NewInt64(table, "activity_id")
s.IssueID = field.NewInt64(table, "issue_id")
s.Price = field.NewInt64(table, "price")
s.ValidStart = field.NewTime(table, "valid_start")
s.ValidEnd = field.NewTime(table, "valid_end")
s.EffectType = field.NewInt32(table, "effect_type")
s.RewardMultiplierX1000 = field.NewInt32(table, "reward_multiplier_x1000")
s.BoostRateX1000 = field.NewInt32(table, "boost_rate_x1000")
s.StackingStrategy = field.NewInt32(table, "stacking_strategy")
s.MaxEffectValueX1000 = field.NewInt32(table, "max_effect_value_x1000")
s.Remark = field.NewString(table, "remark")
s.fillFieldMap()
return s
}
func (s *systemItemCards) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *systemItemCards) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 19)
s.fieldMap["id"] = s.ID
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["name"] = s.Name
s.fieldMap["status"] = s.Status
s.fieldMap["card_type"] = s.CardType
s.fieldMap["scope_type"] = s.ScopeType
s.fieldMap["activity_category_id"] = s.ActivityCategoryID
s.fieldMap["activity_id"] = s.ActivityID
s.fieldMap["issue_id"] = s.IssueID
s.fieldMap["price"] = s.Price
s.fieldMap["valid_start"] = s.ValidStart
s.fieldMap["valid_end"] = s.ValidEnd
s.fieldMap["effect_type"] = s.EffectType
s.fieldMap["reward_multiplier_x1000"] = s.RewardMultiplierX1000
s.fieldMap["boost_rate_x1000"] = s.BoostRateX1000
s.fieldMap["stacking_strategy"] = s.StackingStrategy
s.fieldMap["max_effect_value_x1000"] = s.MaxEffectValueX1000
s.fieldMap["remark"] = s.Remark
}
func (s systemItemCards) clone(db *gorm.DB) systemItemCards {
s.systemItemCardsDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s systemItemCards) replaceDB(db *gorm.DB) systemItemCards {
s.systemItemCardsDo.ReplaceDB(db)
return s
}
type systemItemCardsDo struct{ gen.DO }
func (s systemItemCardsDo) Debug() *systemItemCardsDo {
return s.withDO(s.DO.Debug())
}
func (s systemItemCardsDo) WithContext(ctx context.Context) *systemItemCardsDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s systemItemCardsDo) ReadDB() *systemItemCardsDo {
return s.Clauses(dbresolver.Read)
}
func (s systemItemCardsDo) WriteDB() *systemItemCardsDo {
return s.Clauses(dbresolver.Write)
}
func (s systemItemCardsDo) Session(config *gorm.Session) *systemItemCardsDo {
return s.withDO(s.DO.Session(config))
}
func (s systemItemCardsDo) Clauses(conds ...clause.Expression) *systemItemCardsDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s systemItemCardsDo) Returning(value interface{}, columns ...string) *systemItemCardsDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s systemItemCardsDo) Not(conds ...gen.Condition) *systemItemCardsDo {
return s.withDO(s.DO.Not(conds...))
}
func (s systemItemCardsDo) Or(conds ...gen.Condition) *systemItemCardsDo {
return s.withDO(s.DO.Or(conds...))
}
func (s systemItemCardsDo) Select(conds ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Select(conds...))
}
func (s systemItemCardsDo) Where(conds ...gen.Condition) *systemItemCardsDo {
return s.withDO(s.DO.Where(conds...))
}
func (s systemItemCardsDo) Order(conds ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Order(conds...))
}
func (s systemItemCardsDo) Distinct(cols ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s systemItemCardsDo) Omit(cols ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s systemItemCardsDo) Join(table schema.Tabler, on ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s systemItemCardsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s systemItemCardsDo) RightJoin(table schema.Tabler, on ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s systemItemCardsDo) Group(cols ...field.Expr) *systemItemCardsDo {
return s.withDO(s.DO.Group(cols...))
}
func (s systemItemCardsDo) Having(conds ...gen.Condition) *systemItemCardsDo {
return s.withDO(s.DO.Having(conds...))
}
func (s systemItemCardsDo) Limit(limit int) *systemItemCardsDo {
return s.withDO(s.DO.Limit(limit))
}
func (s systemItemCardsDo) Offset(offset int) *systemItemCardsDo {
return s.withDO(s.DO.Offset(offset))
}
func (s systemItemCardsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *systemItemCardsDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s systemItemCardsDo) Unscoped() *systemItemCardsDo {
return s.withDO(s.DO.Unscoped())
}
func (s systemItemCardsDo) Create(values ...*model.SystemItemCards) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s systemItemCardsDo) CreateInBatches(values []*model.SystemItemCards, batchSize int) error {
return s.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 (s systemItemCardsDo) Save(values ...*model.SystemItemCards) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s systemItemCardsDo) First() (*model.SystemItemCards, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.SystemItemCards), nil
}
}
func (s systemItemCardsDo) Take() (*model.SystemItemCards, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.SystemItemCards), nil
}
}
func (s systemItemCardsDo) Last() (*model.SystemItemCards, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.SystemItemCards), nil
}
}
func (s systemItemCardsDo) Find() ([]*model.SystemItemCards, error) {
result, err := s.DO.Find()
return result.([]*model.SystemItemCards), err
}
func (s systemItemCardsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SystemItemCards, err error) {
buf := make([]*model.SystemItemCards, 0, batchSize)
err = s.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 (s systemItemCardsDo) FindInBatches(result *[]*model.SystemItemCards, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s systemItemCardsDo) Attrs(attrs ...field.AssignExpr) *systemItemCardsDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s systemItemCardsDo) Assign(attrs ...field.AssignExpr) *systemItemCardsDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s systemItemCardsDo) Joins(fields ...field.RelationField) *systemItemCardsDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s systemItemCardsDo) Preload(fields ...field.RelationField) *systemItemCardsDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s systemItemCardsDo) FirstOrInit() (*model.SystemItemCards, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.SystemItemCards), nil
}
}
func (s systemItemCardsDo) FirstOrCreate() (*model.SystemItemCards, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.SystemItemCards), nil
}
}
func (s systemItemCardsDo) FindByPage(offset int, limit int) (result []*model.SystemItemCards, count int64, err error) {
result, err = s.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 = s.Offset(-1).Limit(-1).Count()
return
}
func (s systemItemCardsDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s systemItemCardsDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s systemItemCardsDo) Delete(models ...*model.SystemItemCards) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *systemItemCardsDo) withDO(do gen.Dao) *systemItemCardsDo {
s.DO = *do.(*gen.DO)
return s
}