实现奖励类型的增删改查

This commit is contained in:
2025-06-17 16:25:04 +08:00
parent 3dceeeddb7
commit 427e70f94e
29 changed files with 1175 additions and 1 deletions

View File

@ -0,0 +1,89 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// RewardTypesDao is the data access object for the table reward_types.
type RewardTypesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
}
// RewardTypesColumns defines and stores column names for the table reward_types.
type RewardTypesColumns struct {
Id string // 奖励类型ID
Name string // 奖励类型名称(如积分、优惠券)
Description string // 奖励类型描述
Source string // 来源1=系统默认2=门店自定义
StoreId string // 门店ID系统默认类型为NULL
Status string // 状态1=正常0=禁用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// rewardTypesColumns holds the columns for the table reward_types.
var rewardTypesColumns = RewardTypesColumns{
Id: "id",
Name: "name",
Description: "description",
Source: "source",
StoreId: "store_id",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewRewardTypesDao creates and returns a new DAO object for table data access.
func NewRewardTypesDao() *RewardTypesDao {
return &RewardTypesDao{
group: "default",
table: "reward_types",
columns: rewardTypesColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RewardTypesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RewardTypesDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RewardTypesDao) Columns() RewardTypesColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RewardTypesDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *RewardTypesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -0,0 +1,93 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// RewardsDao is the data access object for the table rewards.
type RewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardsColumns // columns contains all the column names of Table for convenient usage.
}
// RewardsColumns defines and stores column names for the table rewards.
type RewardsColumns struct {
Id string // 奖励ID
RewardTypeId string // 奖励类型ID
Name string // 奖励名称如100积分、5元优惠券
Description string // 奖励描述
Source string // 来源1=系统内置2=门店自定义
StoreId string // 门店ID系统内置奖励为NULL
Value string // 奖励值(如积分数额、优惠金额)
Status string // 状态1=正常0=禁用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// rewardsColumns holds the columns for the table rewards.
var rewardsColumns = RewardsColumns{
Id: "id",
RewardTypeId: "reward_type_id",
Name: "name",
Description: "description",
Source: "source",
StoreId: "store_id",
Value: "value",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewRewardsDao creates and returns a new DAO object for table data access.
func NewRewardsDao() *RewardsDao {
return &RewardsDao{
group: "default",
table: "rewards",
columns: rewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RewardsDao) Columns() RewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RewardsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *RewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -0,0 +1,89 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// StoreTaskRewardsDao is the data access object for the table store_task_rewards.
type StoreTaskRewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
}
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
type StoreTaskRewardsColumns struct {
Id string // 任务奖励关联ID
TaskId string // 门店任务ID
RewardId string // 奖励ID
StoreId string // 门店ID
Quantity string // 奖励数量(如发放多少个奖励)
Status string // 状态1=正常0=禁用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// storeTaskRewardsColumns holds the columns for the table store_task_rewards.
var storeTaskRewardsColumns = StoreTaskRewardsColumns{
Id: "id",
TaskId: "task_id",
RewardId: "reward_id",
StoreId: "store_id",
Quantity: "quantity",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
return &StoreTaskRewardsDao{
group: "default",
table: "store_task_rewards",
columns: storeTaskRewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *StoreTaskRewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *StoreTaskRewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *StoreTaskRewardsDao) Columns() StoreTaskRewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *StoreTaskRewardsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *StoreTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -0,0 +1,27 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalRewardTypesDao is an internal type for wrapping the internal DAO implementation.
type internalRewardTypesDao = *internal.RewardTypesDao
// rewardTypesDao is the data access object for the table reward_types.
// You can define custom methods on it to extend its functionality as needed.
type rewardTypesDao struct {
internalRewardTypesDao
}
var (
// RewardTypes is a globally accessible object for table reward_types operations.
RewardTypes = rewardTypesDao{
internal.NewRewardTypesDao(),
}
)
// Add your custom methods and functionality below.

27
internal/dao/rewards.go Normal file
View File

@ -0,0 +1,27 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalRewardsDao = *internal.RewardsDao
// rewardsDao is the data access object for the table rewards.
// You can define custom methods on it to extend its functionality as needed.
type rewardsDao struct {
internalRewardsDao
}
var (
// Rewards is a globally accessible object for table rewards operations.
Rewards = rewardsDao{
internal.NewRewardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -0,0 +1,27 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalStoreTaskRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalStoreTaskRewardsDao = *internal.StoreTaskRewardsDao
// storeTaskRewardsDao is the data access object for the table store_task_rewards.
// You can define custom methods on it to extend its functionality as needed.
type storeTaskRewardsDao struct {
internalStoreTaskRewardsDao
}
var (
// StoreTaskRewards is a globally accessible object for table store_task_rewards operations.
StoreTaskRewards = storeTaskRewardsDao{
internal.NewStoreTaskRewardsDao(),
}
)
// Add your custom methods and functionality below.