refactor(utils): 修复密码哈希比较逻辑错误 feat(user): 新增按状态筛选优惠券接口 docs: 添加虚拟发货与任务中心相关文档 fix(wechat): 修正Code2Session上下文传递问题 test: 补充订单折扣与积分转换测试用例 build: 更新配置文件与构建脚本 style: 清理多余的空行与注释
345 lines
9.3 KiB
Go
345 lines
9.3 KiB
Go
// 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 newSystemConfigs(db *gorm.DB, opts ...gen.DOOption) systemConfigs {
|
|
_systemConfigs := systemConfigs{}
|
|
|
|
_systemConfigs.systemConfigsDo.UseDB(db, opts...)
|
|
_systemConfigs.systemConfigsDo.UseModel(&model.SystemConfigs{})
|
|
|
|
tableName := _systemConfigs.systemConfigsDo.TableName()
|
|
_systemConfigs.ALL = field.NewAsterisk(tableName)
|
|
_systemConfigs.ID = field.NewInt64(tableName, "id")
|
|
_systemConfigs.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_systemConfigs.UpdatedAt = field.NewTime(tableName, "updated_at")
|
|
_systemConfigs.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
_systemConfigs.ConfigKey = field.NewString(tableName, "config_key")
|
|
_systemConfigs.ConfigValue = field.NewString(tableName, "config_value")
|
|
_systemConfigs.Remark = field.NewString(tableName, "remark")
|
|
|
|
_systemConfigs.fillFieldMap()
|
|
|
|
return _systemConfigs
|
|
}
|
|
|
|
// systemConfigs 系统配置KV
|
|
type systemConfigs struct {
|
|
systemConfigsDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Int64
|
|
CreatedAt field.Time
|
|
UpdatedAt field.Time
|
|
DeletedAt field.Field
|
|
ConfigKey field.String
|
|
ConfigValue field.String
|
|
Remark field.String
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (s systemConfigs) Table(newTableName string) *systemConfigs {
|
|
s.systemConfigsDo.UseTable(newTableName)
|
|
return s.updateTableName(newTableName)
|
|
}
|
|
|
|
func (s systemConfigs) As(alias string) *systemConfigs {
|
|
s.systemConfigsDo.DO = *(s.systemConfigsDo.As(alias).(*gen.DO))
|
|
return s.updateTableName(alias)
|
|
}
|
|
|
|
func (s *systemConfigs) updateTableName(table string) *systemConfigs {
|
|
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.DeletedAt = field.NewField(table, "deleted_at")
|
|
s.ConfigKey = field.NewString(table, "config_key")
|
|
s.ConfigValue = field.NewString(table, "config_value")
|
|
s.Remark = field.NewString(table, "remark")
|
|
|
|
s.fillFieldMap()
|
|
|
|
return s
|
|
}
|
|
|
|
func (s *systemConfigs) 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 *systemConfigs) fillFieldMap() {
|
|
s.fieldMap = make(map[string]field.Expr, 7)
|
|
s.fieldMap["id"] = s.ID
|
|
s.fieldMap["created_at"] = s.CreatedAt
|
|
s.fieldMap["updated_at"] = s.UpdatedAt
|
|
s.fieldMap["deleted_at"] = s.DeletedAt
|
|
s.fieldMap["config_key"] = s.ConfigKey
|
|
s.fieldMap["config_value"] = s.ConfigValue
|
|
s.fieldMap["remark"] = s.Remark
|
|
}
|
|
|
|
func (s systemConfigs) clone(db *gorm.DB) systemConfigs {
|
|
s.systemConfigsDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return s
|
|
}
|
|
|
|
func (s systemConfigs) replaceDB(db *gorm.DB) systemConfigs {
|
|
s.systemConfigsDo.ReplaceDB(db)
|
|
return s
|
|
}
|
|
|
|
type systemConfigsDo struct{ gen.DO }
|
|
|
|
func (s systemConfigsDo) Debug() *systemConfigsDo {
|
|
return s.withDO(s.DO.Debug())
|
|
}
|
|
|
|
func (s systemConfigsDo) WithContext(ctx context.Context) *systemConfigsDo {
|
|
return s.withDO(s.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (s systemConfigsDo) ReadDB() *systemConfigsDo {
|
|
return s.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (s systemConfigsDo) WriteDB() *systemConfigsDo {
|
|
return s.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (s systemConfigsDo) Session(config *gorm.Session) *systemConfigsDo {
|
|
return s.withDO(s.DO.Session(config))
|
|
}
|
|
|
|
func (s systemConfigsDo) Clauses(conds ...clause.Expression) *systemConfigsDo {
|
|
return s.withDO(s.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Returning(value interface{}, columns ...string) *systemConfigsDo {
|
|
return s.withDO(s.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Not(conds ...gen.Condition) *systemConfigsDo {
|
|
return s.withDO(s.DO.Not(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Or(conds ...gen.Condition) *systemConfigsDo {
|
|
return s.withDO(s.DO.Or(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Select(conds ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Select(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Where(conds ...gen.Condition) *systemConfigsDo {
|
|
return s.withDO(s.DO.Where(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Order(conds ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Order(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Distinct(cols ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Omit(cols ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Omit(cols...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Join(table schema.Tabler, on ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Join(table, on...))
|
|
}
|
|
|
|
func (s systemConfigsDo) LeftJoin(table schema.Tabler, on ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (s systemConfigsDo) RightJoin(table schema.Tabler, on ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Group(cols ...field.Expr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Group(cols...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Having(conds ...gen.Condition) *systemConfigsDo {
|
|
return s.withDO(s.DO.Having(conds...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Limit(limit int) *systemConfigsDo {
|
|
return s.withDO(s.DO.Limit(limit))
|
|
}
|
|
|
|
func (s systemConfigsDo) Offset(offset int) *systemConfigsDo {
|
|
return s.withDO(s.DO.Offset(offset))
|
|
}
|
|
|
|
func (s systemConfigsDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *systemConfigsDo {
|
|
return s.withDO(s.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Unscoped() *systemConfigsDo {
|
|
return s.withDO(s.DO.Unscoped())
|
|
}
|
|
|
|
func (s systemConfigsDo) Create(values ...*model.SystemConfigs) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Create(values)
|
|
}
|
|
|
|
func (s systemConfigsDo) CreateInBatches(values []*model.SystemConfigs, 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 systemConfigsDo) Save(values ...*model.SystemConfigs) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return s.DO.Save(values)
|
|
}
|
|
|
|
func (s systemConfigsDo) First() (*model.SystemConfigs, error) {
|
|
if result, err := s.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SystemConfigs), nil
|
|
}
|
|
}
|
|
|
|
func (s systemConfigsDo) Take() (*model.SystemConfigs, error) {
|
|
if result, err := s.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SystemConfigs), nil
|
|
}
|
|
}
|
|
|
|
func (s systemConfigsDo) Last() (*model.SystemConfigs, error) {
|
|
if result, err := s.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SystemConfigs), nil
|
|
}
|
|
}
|
|
|
|
func (s systemConfigsDo) Find() ([]*model.SystemConfigs, error) {
|
|
result, err := s.DO.Find()
|
|
return result.([]*model.SystemConfigs), err
|
|
}
|
|
|
|
func (s systemConfigsDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.SystemConfigs, err error) {
|
|
buf := make([]*model.SystemConfigs, 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 systemConfigsDo) FindInBatches(result *[]*model.SystemConfigs, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return s.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (s systemConfigsDo) Attrs(attrs ...field.AssignExpr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Assign(attrs ...field.AssignExpr) *systemConfigsDo {
|
|
return s.withDO(s.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (s systemConfigsDo) Joins(fields ...field.RelationField) *systemConfigsDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Joins(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s systemConfigsDo) Preload(fields ...field.RelationField) *systemConfigsDo {
|
|
for _, _f := range fields {
|
|
s = *s.withDO(s.DO.Preload(_f))
|
|
}
|
|
return &s
|
|
}
|
|
|
|
func (s systemConfigsDo) FirstOrInit() (*model.SystemConfigs, error) {
|
|
if result, err := s.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SystemConfigs), nil
|
|
}
|
|
}
|
|
|
|
func (s systemConfigsDo) FirstOrCreate() (*model.SystemConfigs, error) {
|
|
if result, err := s.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*model.SystemConfigs), nil
|
|
}
|
|
}
|
|
|
|
func (s systemConfigsDo) FindByPage(offset int, limit int) (result []*model.SystemConfigs, 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 systemConfigsDo) 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 systemConfigsDo) Scan(result interface{}) (err error) {
|
|
return s.DO.Scan(result)
|
|
}
|
|
|
|
func (s systemConfigsDo) Delete(models ...*model.SystemConfigs) (result gen.ResultInfo, err error) {
|
|
return s.DO.Delete(models)
|
|
}
|
|
|
|
func (s *systemConfigsDo) withDO(do gen.Dao) *systemConfigsDo {
|
|
s.DO = *do.(*gen.DO)
|
|
return s
|
|
}
|