From 7f230979766d1c91598ee962a294a28f66c5a08d Mon Sep 17 00:00:00 2001 From: chy <2463300564@qq.com> Date: Fri, 4 Jul 2025 16:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E4=BC=9A=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/store/store.go | 1 + api/store/v1/store.go | 12 +++ .../store/store_v1_store_member_level.go | 14 +++ internal/dao/internal/admins.go | 22 +++-- internal/dao/internal/feedbacks.go | 22 +++-- internal/dao/internal/games.go | 22 +++-- internal/dao/internal/merchant_admins.go | 22 +++-- internal/dao/internal/merchants.go | 22 +++-- internal/dao/internal/notices.go | 22 +++-- internal/dao/internal/reward_callback.go | 22 +++-- internal/dao/internal/reward_types.go | 22 +++-- internal/dao/internal/reward_waters.go | 22 +++-- internal/dao/internal/rewards.go | 22 +++-- internal/dao/internal/roles.go | 22 +++-- internal/dao/internal/store_admins.go | 22 +++-- internal/dao/internal/store_areas.go | 89 +++++++++++++++++ internal/dao/internal/store_clients.go | 93 ++++++++++++++++++ .../dao/internal/store_desktop_settings.go | 22 +++-- internal/dao/internal/store_ips.go | 22 +++-- internal/dao/internal/store_member_levels.go | 97 +++++++++++++++++++ .../dao/internal/store_netfee_area_level.go | 22 +++-- internal/dao/internal/store_roles.go | 22 +++-- internal/dao/internal/stores.go | 22 +++-- internal/dao/internal/task_rewards.go | 22 +++-- internal/dao/internal/tasks.go | 22 +++-- internal/dao/internal/user_task_rewards.go | 22 +++-- internal/dao/internal/user_tasks.go | 22 +++-- internal/dao/internal/users.go | 22 +++-- internal/dao/store_areas.go | 22 +++++ internal/dao/store_clients.go | 22 +++++ internal/dao/store_member_levels.go | 22 +++++ internal/logic/store/store.go | 5 + internal/model/StoreMemberlevel.go | 27 ++++++ internal/model/do/store_areas.go | 21 ++++ internal/model/do/store_clients.go | 23 +++++ internal/model/do/store_member_levels.go | 25 +++++ internal/model/entity/store_areas.go | 19 ++++ internal/model/entity/store_clients.go | 21 ++++ internal/model/entity/store_member_levels.go | 23 +++++ 39 files changed, 844 insertions(+), 176 deletions(-) create mode 100644 internal/controller/store/store_v1_store_member_level.go create mode 100644 internal/dao/internal/store_areas.go create mode 100644 internal/dao/internal/store_clients.go create mode 100644 internal/dao/internal/store_member_levels.go create mode 100644 internal/dao/store_areas.go create mode 100644 internal/dao/store_clients.go create mode 100644 internal/dao/store_member_levels.go create mode 100644 internal/model/StoreMemberlevel.go create mode 100644 internal/model/do/store_areas.go create mode 100644 internal/model/do/store_clients.go create mode 100644 internal/model/do/store_member_levels.go create mode 100644 internal/model/entity/store_areas.go create mode 100644 internal/model/entity/store_clients.go create mode 100644 internal/model/entity/store_member_levels.go diff --git a/api/store/store.go b/api/store/store.go index 5ca3005..8d1447c 100644 --- a/api/store/store.go +++ b/api/store/store.go @@ -20,4 +20,5 @@ type IStoreV1 interface { UpdateIp(ctx context.Context, req *v1.UpdateIpReq) (res *v1.UpdateIpRes, err error) GetIpList(ctx context.Context, req *v1.GetIpListReq) (res *v1.GetIpListRes, err error) Detail(ctx context.Context, req *v1.DetailReq) (res *v1.DetailRes, err error) + StoreMemberLevel(ctx context.Context, req *v1.StoreMemberLevelReq) (res *v1.StoreMemberLevelRes, err error) } diff --git a/api/store/v1/store.go b/api/store/v1/store.go index 1599c26..9040669 100644 --- a/api/store/v1/store.go +++ b/api/store/v1/store.go @@ -93,3 +93,15 @@ type DetailReq struct { type DetailRes struct { Id int64 `json:"id" dc:"门店ID"` } + +type StoreMemberLevelReq struct { + g.Meta `path:"/store/memberLevel" method:"get" tags:"Backend/Store" summary:"(系统、商户门店后台)门店会员等级"` + StoreId int64 `json:"storeId" dc:"门店ID"` + Page int `json:"page" v:"required" dc:"页数"` + Size int `json:"size" v:"required" dc:"每页数量"` +} + +type StoreMemberLevelRes struct { + List interface{} `json:"list"` + Total int64 `json:"total"` +} diff --git a/internal/controller/store/store_v1_store_member_level.go b/internal/controller/store/store_v1_store_member_level.go new file mode 100644 index 0000000..ec7d5cc --- /dev/null +++ b/internal/controller/store/store_v1_store_member_level.go @@ -0,0 +1,14 @@ +package store + +import ( + "context" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + + "server/api/store/v1" +) + +func (c *ControllerV1) StoreMemberLevel(ctx context.Context, req *v1.StoreMemberLevelReq) (res *v1.StoreMemberLevelRes, err error) { + return nil, gerror.NewCode(gcode.CodeNotImplemented) +} diff --git a/internal/dao/internal/admins.go b/internal/dao/internal/admins.go index 7c3f2be..dc72d15 100644 --- a/internal/dao/internal/admins.go +++ b/internal/dao/internal/admins.go @@ -13,9 +13,10 @@ import ( // AdminsDao is the data access object for the table admins. type AdminsDao 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 AdminsColumns // columns contains all the column names of Table for convenient usage. + 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 AdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // AdminsColumns defines and stores column names for the table admins. @@ -49,11 +50,12 @@ var adminsColumns = AdminsColumns{ } // NewAdminsDao creates and returns a new DAO object for table data access. -func NewAdminsDao() *AdminsDao { +func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao { return &AdminsDao{ - group: "default", - table: "admins", - columns: adminsColumns, + group: "default", + table: "admins", + columns: adminsColumns, + handlers: handlers, } } @@ -79,7 +81,11 @@ func (dao *AdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/feedbacks.go b/internal/dao/internal/feedbacks.go index d67a1e5..7a8d085 100644 --- a/internal/dao/internal/feedbacks.go +++ b/internal/dao/internal/feedbacks.go @@ -13,9 +13,10 @@ import ( // FeedbacksDao is the data access object for the table feedbacks. type FeedbacksDao 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 FeedbacksColumns // columns contains all the column names of Table for convenient usage. + 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 FeedbacksColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // FeedbacksColumns defines and stores column names for the table feedbacks. @@ -51,11 +52,12 @@ var feedbacksColumns = FeedbacksColumns{ } // NewFeedbacksDao creates and returns a new DAO object for table data access. -func NewFeedbacksDao() *FeedbacksDao { +func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao { return &FeedbacksDao{ - group: "default", - table: "feedbacks", - columns: feedbacksColumns, + group: "default", + table: "feedbacks", + columns: feedbacksColumns, + handlers: handlers, } } @@ -81,7 +83,11 @@ func (dao *FeedbacksDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/games.go b/internal/dao/internal/games.go index b53dd54..dac75c7 100644 --- a/internal/dao/internal/games.go +++ b/internal/dao/internal/games.go @@ -13,9 +13,10 @@ import ( // GamesDao is the data access object for the table games. type GamesDao 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 GamesColumns // columns contains all the column names of Table for convenient usage. + 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 GamesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // GamesColumns defines and stores column names for the table games. @@ -45,11 +46,12 @@ var gamesColumns = GamesColumns{ } // NewGamesDao creates and returns a new DAO object for table data access. -func NewGamesDao() *GamesDao { +func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao { return &GamesDao{ - group: "default", - table: "games", - columns: gamesColumns, + group: "default", + table: "games", + columns: gamesColumns, + handlers: handlers, } } @@ -75,7 +77,11 @@ func (dao *GamesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/merchant_admins.go b/internal/dao/internal/merchant_admins.go index 51ac691..64533e1 100644 --- a/internal/dao/internal/merchant_admins.go +++ b/internal/dao/internal/merchant_admins.go @@ -13,9 +13,10 @@ import ( // MerchantAdminsDao is the data access object for the table merchant_admins. type MerchantAdminsDao 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 MerchantAdminsColumns // columns contains all the column names of Table for convenient usage. + 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 MerchantAdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // MerchantAdminsColumns defines and stores column names for the table merchant_admins. @@ -57,11 +58,12 @@ var merchantAdminsColumns = MerchantAdminsColumns{ } // NewMerchantAdminsDao creates and returns a new DAO object for table data access. -func NewMerchantAdminsDao() *MerchantAdminsDao { +func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao { return &MerchantAdminsDao{ - group: "default", - table: "merchant_admins", - columns: merchantAdminsColumns, + group: "default", + table: "merchant_admins", + columns: merchantAdminsColumns, + handlers: handlers, } } @@ -87,7 +89,11 @@ func (dao *MerchantAdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/merchants.go b/internal/dao/internal/merchants.go index 6dd5d05..717f855 100644 --- a/internal/dao/internal/merchants.go +++ b/internal/dao/internal/merchants.go @@ -13,9 +13,10 @@ import ( // MerchantsDao is the data access object for the table merchants. type MerchantsDao 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 MerchantsColumns // columns contains all the column names of Table for convenient usage. + 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 MerchantsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // MerchantsColumns defines and stores column names for the table merchants. @@ -71,11 +72,12 @@ var merchantsColumns = MerchantsColumns{ } // NewMerchantsDao creates and returns a new DAO object for table data access. -func NewMerchantsDao() *MerchantsDao { +func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao { return &MerchantsDao{ - group: "default", - table: "merchants", - columns: merchantsColumns, + group: "default", + table: "merchants", + columns: merchantsColumns, + handlers: handlers, } } @@ -101,7 +103,11 @@ func (dao *MerchantsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/notices.go b/internal/dao/internal/notices.go index 5cc451a..9c2cfce 100644 --- a/internal/dao/internal/notices.go +++ b/internal/dao/internal/notices.go @@ -13,9 +13,10 @@ import ( // NoticesDao is the data access object for the table notices. type NoticesDao 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 NoticesColumns // columns contains all the column names of Table for convenient usage. + 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 NoticesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // NoticesColumns defines and stores column names for the table notices. @@ -49,11 +50,12 @@ var noticesColumns = NoticesColumns{ } // NewNoticesDao creates and returns a new DAO object for table data access. -func NewNoticesDao() *NoticesDao { +func NewNoticesDao(handlers ...gdb.ModelHandler) *NoticesDao { return &NoticesDao{ - group: "default", - table: "notices", - columns: noticesColumns, + group: "default", + table: "notices", + columns: noticesColumns, + handlers: handlers, } } @@ -79,7 +81,11 @@ func (dao *NoticesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *NoticesDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/reward_callback.go b/internal/dao/internal/reward_callback.go index 3cc67a2..d148d1c 100644 --- a/internal/dao/internal/reward_callback.go +++ b/internal/dao/internal/reward_callback.go @@ -13,9 +13,10 @@ import ( // RewardCallbackDao is the data access object for the table reward_callback. type RewardCallbackDao 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 RewardCallbackColumns // columns contains all the column names of Table for convenient usage. + 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 RewardCallbackColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RewardCallbackColumns defines and stores column names for the table reward_callback. @@ -49,11 +50,12 @@ var rewardCallbackColumns = RewardCallbackColumns{ } // NewRewardCallbackDao creates and returns a new DAO object for table data access. -func NewRewardCallbackDao() *RewardCallbackDao { +func NewRewardCallbackDao(handlers ...gdb.ModelHandler) *RewardCallbackDao { return &RewardCallbackDao{ - group: "default", - table: "reward_callback", - columns: rewardCallbackColumns, + group: "default", + table: "reward_callback", + columns: rewardCallbackColumns, + handlers: handlers, } } @@ -79,7 +81,11 @@ func (dao *RewardCallbackDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *RewardCallbackDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/reward_types.go b/internal/dao/internal/reward_types.go index b79610a..c035828 100644 --- a/internal/dao/internal/reward_types.go +++ b/internal/dao/internal/reward_types.go @@ -13,9 +13,10 @@ import ( // 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. + 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. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RewardTypesColumns defines and stores column names for the table reward_types. @@ -45,11 +46,12 @@ var rewardTypesColumns = RewardTypesColumns{ } // NewRewardTypesDao creates and returns a new DAO object for table data access. -func NewRewardTypesDao() *RewardTypesDao { +func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao { return &RewardTypesDao{ - group: "default", - table: "reward_types", - columns: rewardTypesColumns, + group: "default", + table: "reward_types", + columns: rewardTypesColumns, + handlers: handlers, } } @@ -75,7 +77,11 @@ func (dao *RewardTypesDao) Group() string { // 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) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/reward_waters.go b/internal/dao/internal/reward_waters.go index 593f014..83c4803 100644 --- a/internal/dao/internal/reward_waters.go +++ b/internal/dao/internal/reward_waters.go @@ -13,9 +13,10 @@ import ( // RewardWatersDao is the data access object for the table reward_waters. type RewardWatersDao 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 RewardWatersColumns // columns contains all the column names of Table for convenient usage. + 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 RewardWatersColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RewardWatersColumns defines and stores column names for the table reward_waters. @@ -47,11 +48,12 @@ var rewardWatersColumns = RewardWatersColumns{ } // NewRewardWatersDao creates and returns a new DAO object for table data access. -func NewRewardWatersDao() *RewardWatersDao { +func NewRewardWatersDao(handlers ...gdb.ModelHandler) *RewardWatersDao { return &RewardWatersDao{ - group: "default", - table: "reward_waters", - columns: rewardWatersColumns, + group: "default", + table: "reward_waters", + columns: rewardWatersColumns, + handlers: handlers, } } @@ -77,7 +79,11 @@ func (dao *RewardWatersDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *RewardWatersDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/rewards.go b/internal/dao/internal/rewards.go index 6b91001..dd33c89 100644 --- a/internal/dao/internal/rewards.go +++ b/internal/dao/internal/rewards.go @@ -13,9 +13,10 @@ import ( // 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. + 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. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RewardsColumns defines and stores column names for the table rewards. @@ -75,11 +76,12 @@ var rewardsColumns = RewardsColumns{ } // NewRewardsDao creates and returns a new DAO object for table data access. -func NewRewardsDao() *RewardsDao { +func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao { return &RewardsDao{ - group: "default", - table: "rewards", - columns: rewardsColumns, + group: "default", + table: "rewards", + columns: rewardsColumns, + handlers: handlers, } } @@ -105,7 +107,11 @@ func (dao *RewardsDao) Group() string { // 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) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/roles.go b/internal/dao/internal/roles.go index 9eab304..b540549 100644 --- a/internal/dao/internal/roles.go +++ b/internal/dao/internal/roles.go @@ -13,9 +13,10 @@ import ( // RolesDao is the data access object for the table roles. type RolesDao 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 RolesColumns // columns contains all the column names of Table for convenient usage. + 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 RolesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // RolesColumns defines and stores column names for the table roles. @@ -47,11 +48,12 @@ var rolesColumns = RolesColumns{ } // NewRolesDao creates and returns a new DAO object for table data access. -func NewRolesDao() *RolesDao { +func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao { return &RolesDao{ - group: "default", - table: "roles", - columns: rolesColumns, + group: "default", + table: "roles", + columns: rolesColumns, + handlers: handlers, } } @@ -77,7 +79,11 @@ func (dao *RolesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/store_admins.go b/internal/dao/internal/store_admins.go index 7bcffcc..538322c 100644 --- a/internal/dao/internal/store_admins.go +++ b/internal/dao/internal/store_admins.go @@ -13,9 +13,10 @@ import ( // StoreAdminsDao is the data access object for the table store_admins. type StoreAdminsDao 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 StoreAdminsColumns // columns contains all the column names of Table for convenient usage. + 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 StoreAdminsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreAdminsColumns defines and stores column names for the table store_admins. @@ -57,11 +58,12 @@ var storeAdminsColumns = StoreAdminsColumns{ } // NewStoreAdminsDao creates and returns a new DAO object for table data access. -func NewStoreAdminsDao() *StoreAdminsDao { +func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao { return &StoreAdminsDao{ - group: "default", - table: "store_admins", - columns: storeAdminsColumns, + group: "default", + table: "store_admins", + columns: storeAdminsColumns, + handlers: handlers, } } @@ -87,7 +89,11 @@ func (dao *StoreAdminsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/store_areas.go b/internal/dao/internal/store_areas.go new file mode 100644 index 0000000..96110ad --- /dev/null +++ b/internal/dao/internal/store_areas.go @@ -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" +) + +// StoreAreasDao is the data access object for the table store_areas. +type StoreAreasDao 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 StoreAreasColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// StoreAreasColumns defines and stores column names for the table store_areas. +type StoreAreasColumns struct { + Id string // 区域ID + StoreId string // 所属门店ID + AreaName string // 区域名称 + CreatedAt string // + UpdatedAt string // + DeletedAt string // +} + +// storeAreasColumns holds the columns for the table store_areas. +var storeAreasColumns = StoreAreasColumns{ + Id: "id", + StoreId: "store_id", + AreaName: "area_name", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreAreasDao creates and returns a new DAO object for table data access. +func NewStoreAreasDao(handlers ...gdb.ModelHandler) *StoreAreasDao { + return &StoreAreasDao{ + group: "default", + table: "store_areas", + columns: storeAreasColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreAreasDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreAreasDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreAreasDao) Columns() StoreAreasColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreAreasDao) 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 *StoreAreasDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.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 *StoreAreasDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_clients.go b/internal/dao/internal/store_clients.go new file mode 100644 index 0000000..4cde1d8 --- /dev/null +++ b/internal/dao/internal/store_clients.go @@ -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" +) + +// StoreClientsDao is the data access object for the table store_clients. +type StoreClientsDao 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 StoreClientsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// StoreClientsColumns defines and stores column names for the table store_clients. +type StoreClientsColumns struct { + Id string // 客户机ID + StoreId string // 所属门店ID + ClientName string // 客户机名称 + Status string // 状态:1=空闲,2=禁用,3=上机中等 + AreaId string // 所属区域ID + CreatedAt string // + UpdatedAt string // + DeletedAt string // +} + +// storeClientsColumns holds the columns for the table store_clients. +var storeClientsColumns = StoreClientsColumns{ + Id: "id", + StoreId: "store_id", + ClientName: "client_name", + Status: "status", + AreaId: "area_id", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreClientsDao creates and returns a new DAO object for table data access. +func NewStoreClientsDao(handlers ...gdb.ModelHandler) *StoreClientsDao { + return &StoreClientsDao{ + group: "default", + table: "store_clients", + columns: storeClientsColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreClientsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreClientsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreClientsDao) Columns() StoreClientsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreClientsDao) 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 *StoreClientsDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.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 *StoreClientsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_desktop_settings.go b/internal/dao/internal/store_desktop_settings.go index dec1ba9..88c9cb5 100644 --- a/internal/dao/internal/store_desktop_settings.go +++ b/internal/dao/internal/store_desktop_settings.go @@ -13,9 +13,10 @@ import ( // StoreDesktopSettingsDao is the data access object for the table store_desktop_settings. type StoreDesktopSettingsDao 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 StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage. + 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 StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings. @@ -33,11 +34,12 @@ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{ } // NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access. -func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao { +func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao { return &StoreDesktopSettingsDao{ - group: "default", - table: "store_desktop_settings", - columns: storeDesktopSettingsColumns, + group: "default", + table: "store_desktop_settings", + columns: storeDesktopSettingsColumns, + handlers: handlers, } } @@ -63,7 +65,11 @@ func (dao *StoreDesktopSettingsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreDesktopSettingsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/store_ips.go b/internal/dao/internal/store_ips.go index 20197cb..dfdfd58 100644 --- a/internal/dao/internal/store_ips.go +++ b/internal/dao/internal/store_ips.go @@ -13,9 +13,10 @@ import ( // StoreIpsDao is the data access object for the table store_ips. type StoreIpsDao 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 StoreIpsColumns // columns contains all the column names of Table for convenient usage. + 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 StoreIpsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreIpsColumns defines and stores column names for the table store_ips. @@ -41,11 +42,12 @@ var storeIpsColumns = StoreIpsColumns{ } // NewStoreIpsDao creates and returns a new DAO object for table data access. -func NewStoreIpsDao() *StoreIpsDao { +func NewStoreIpsDao(handlers ...gdb.ModelHandler) *StoreIpsDao { return &StoreIpsDao{ - group: "default", - table: "store_ips", - columns: storeIpsColumns, + group: "default", + table: "store_ips", + columns: storeIpsColumns, + handlers: handlers, } } @@ -71,7 +73,11 @@ func (dao *StoreIpsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreIpsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/store_member_levels.go b/internal/dao/internal/store_member_levels.go new file mode 100644 index 0000000..ded56eb --- /dev/null +++ b/internal/dao/internal/store_member_levels.go @@ -0,0 +1,97 @@ +// ========================================================================== +// 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" +) + +// StoreMemberLevelsDao is the data access object for the table store_member_levels. +type StoreMemberLevelsDao 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 StoreMemberLevelsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. +} + +// StoreMemberLevelsColumns defines and stores column names for the table store_member_levels. +type StoreMemberLevelsColumns struct { + Id string // 主键ID + StoreId string // 所属门店ID + LevelId string // 会员等级ID(如0表示临时卡) + LevelName string // 等级名称 + Level string // 等级顺序,值越大等级越高 + OlType string // 在线类型(例如:1=线上) + Status string // 状态:1=启用,2=禁用 + CreatedAt string // 创建时间 + UpdatedAt string // 更新时间 + DeletedAt string // 软删除时间戳 +} + +// storeMemberLevelsColumns holds the columns for the table store_member_levels. +var storeMemberLevelsColumns = StoreMemberLevelsColumns{ + Id: "id", + StoreId: "store_id", + LevelId: "level_id", + LevelName: "level_name", + Level: "level", + OlType: "ol_type", + Status: "status", + CreatedAt: "created_at", + UpdatedAt: "updated_at", + DeletedAt: "deleted_at", +} + +// NewStoreMemberLevelsDao creates and returns a new DAO object for table data access. +func NewStoreMemberLevelsDao(handlers ...gdb.ModelHandler) *StoreMemberLevelsDao { + return &StoreMemberLevelsDao{ + group: "default", + table: "store_member_levels", + columns: storeMemberLevelsColumns, + handlers: handlers, + } +} + +// DB retrieves and returns the underlying raw database management object of the current DAO. +func (dao *StoreMemberLevelsDao) DB() gdb.DB { + return g.DB(dao.group) +} + +// Table returns the table name of the current DAO. +func (dao *StoreMemberLevelsDao) Table() string { + return dao.table +} + +// Columns returns all column names of the current DAO. +func (dao *StoreMemberLevelsDao) Columns() StoreMemberLevelsColumns { + return dao.columns +} + +// Group returns the database configuration group name of the current DAO. +func (dao *StoreMemberLevelsDao) 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 *StoreMemberLevelsDao) Ctx(ctx context.Context) *gdb.Model { + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.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 *StoreMemberLevelsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { + return dao.Ctx(ctx).Transaction(ctx, f) +} diff --git a/internal/dao/internal/store_netfee_area_level.go b/internal/dao/internal/store_netfee_area_level.go index e2a43a6..ffa209a 100644 --- a/internal/dao/internal/store_netfee_area_level.go +++ b/internal/dao/internal/store_netfee_area_level.go @@ -13,9 +13,10 @@ import ( // StoreNetfeeAreaLevelDao is the data access object for the table store_netfee_area_level. type StoreNetfeeAreaLevelDao 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 StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage. + 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 StoreNetfeeAreaLevelColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreNetfeeAreaLevelColumns defines and stores column names for the table store_netfee_area_level. @@ -49,11 +50,12 @@ var storeNetfeeAreaLevelColumns = StoreNetfeeAreaLevelColumns{ } // NewStoreNetfeeAreaLevelDao creates and returns a new DAO object for table data access. -func NewStoreNetfeeAreaLevelDao() *StoreNetfeeAreaLevelDao { +func NewStoreNetfeeAreaLevelDao(handlers ...gdb.ModelHandler) *StoreNetfeeAreaLevelDao { return &StoreNetfeeAreaLevelDao{ - group: "default", - table: "store_netfee_area_level", - columns: storeNetfeeAreaLevelColumns, + group: "default", + table: "store_netfee_area_level", + columns: storeNetfeeAreaLevelColumns, + handlers: handlers, } } @@ -79,7 +81,11 @@ func (dao *StoreNetfeeAreaLevelDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreNetfeeAreaLevelDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/store_roles.go b/internal/dao/internal/store_roles.go index 8528459..137e1fa 100644 --- a/internal/dao/internal/store_roles.go +++ b/internal/dao/internal/store_roles.go @@ -13,9 +13,10 @@ import ( // StoreRolesDao is the data access object for the table store_roles. type StoreRolesDao 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 StoreRolesColumns // columns contains all the column names of Table for convenient usage. + 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 StoreRolesColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoreRolesColumns defines and stores column names for the table store_roles. @@ -39,11 +40,12 @@ var storeRolesColumns = StoreRolesColumns{ } // NewStoreRolesDao creates and returns a new DAO object for table data access. -func NewStoreRolesDao() *StoreRolesDao { +func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao { return &StoreRolesDao{ - group: "default", - table: "store_roles", - columns: storeRolesColumns, + group: "default", + table: "store_roles", + columns: storeRolesColumns, + handlers: handlers, } } @@ -69,7 +71,11 @@ func (dao *StoreRolesDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoreRolesDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/stores.go b/internal/dao/internal/stores.go index 8bbdc42..69ed619 100644 --- a/internal/dao/internal/stores.go +++ b/internal/dao/internal/stores.go @@ -13,9 +13,10 @@ import ( // StoresDao is the data access object for the table stores. type StoresDao 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 StoresColumns // columns contains all the column names of Table for convenient usage. + 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 StoresColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // StoresColumns defines and stores column names for the table stores. @@ -51,11 +52,12 @@ var storesColumns = StoresColumns{ } // NewStoresDao creates and returns a new DAO object for table data access. -func NewStoresDao() *StoresDao { +func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao { return &StoresDao{ - group: "default", - table: "stores", - columns: storesColumns, + group: "default", + table: "stores", + columns: storesColumns, + handlers: handlers, } } @@ -81,7 +83,11 @@ func (dao *StoresDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/task_rewards.go b/internal/dao/internal/task_rewards.go index d745649..adf18fb 100644 --- a/internal/dao/internal/task_rewards.go +++ b/internal/dao/internal/task_rewards.go @@ -13,9 +13,10 @@ import ( // TaskRewardsDao is the data access object for the table task_rewards. type TaskRewardsDao 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 TaskRewardsColumns // columns contains all the column names of Table for convenient usage. + 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 TaskRewardsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // TaskRewardsColumns defines and stores column names for the table task_rewards. @@ -35,11 +36,12 @@ var taskRewardsColumns = TaskRewardsColumns{ } // NewTaskRewardsDao creates and returns a new DAO object for table data access. -func NewTaskRewardsDao() *TaskRewardsDao { +func NewTaskRewardsDao(handlers ...gdb.ModelHandler) *TaskRewardsDao { return &TaskRewardsDao{ - group: "default", - table: "task_rewards", - columns: taskRewardsColumns, + group: "default", + table: "task_rewards", + columns: taskRewardsColumns, + handlers: handlers, } } @@ -65,7 +67,11 @@ func (dao *TaskRewardsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TaskRewardsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/tasks.go b/internal/dao/internal/tasks.go index ced9c75..72333ac 100644 --- a/internal/dao/internal/tasks.go +++ b/internal/dao/internal/tasks.go @@ -13,9 +13,10 @@ import ( // TasksDao is the data access object for the table tasks. type TasksDao 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 TasksColumns // columns contains all the column names of Table for convenient usage. + 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 TasksColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // TasksColumns defines and stores column names for the table tasks. @@ -45,11 +46,12 @@ var tasksColumns = TasksColumns{ } // NewTasksDao creates and returns a new DAO object for table data access. -func NewTasksDao() *TasksDao { +func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao { return &TasksDao{ - group: "default", - table: "tasks", - columns: tasksColumns, + group: "default", + table: "tasks", + columns: tasksColumns, + handlers: handlers, } } @@ -75,7 +77,11 @@ func (dao *TasksDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/user_task_rewards.go b/internal/dao/internal/user_task_rewards.go index 3aaa431..aff73a2 100644 --- a/internal/dao/internal/user_task_rewards.go +++ b/internal/dao/internal/user_task_rewards.go @@ -13,9 +13,10 @@ import ( // UserTaskRewardsDao is the data access object for the table user_task_rewards. type UserTaskRewardsDao 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage. + 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 UserTaskRewardsColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // UserTaskRewardsColumns defines and stores column names for the table user_task_rewards. @@ -57,11 +58,12 @@ var userTaskRewardsColumns = UserTaskRewardsColumns{ } // NewUserTaskRewardsDao creates and returns a new DAO object for table data access. -func NewUserTaskRewardsDao() *UserTaskRewardsDao { +func NewUserTaskRewardsDao(handlers ...gdb.ModelHandler) *UserTaskRewardsDao { return &UserTaskRewardsDao{ - group: "default", - table: "user_task_rewards", - columns: userTaskRewardsColumns, + group: "default", + table: "user_task_rewards", + columns: userTaskRewardsColumns, + handlers: handlers, } } @@ -87,7 +89,11 @@ func (dao *UserTaskRewardsDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *UserTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/user_tasks.go b/internal/dao/internal/user_tasks.go index a9c2e7f..8b66fba 100644 --- a/internal/dao/internal/user_tasks.go +++ b/internal/dao/internal/user_tasks.go @@ -13,9 +13,10 @@ import ( // UserTasksDao is the data access object for the table user_tasks. type UserTasksDao 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 UserTasksColumns // columns contains all the column names of Table for convenient usage. + 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 UserTasksColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // UserTasksColumns defines and stores column names for the table user_tasks. @@ -53,11 +54,12 @@ var userTasksColumns = UserTasksColumns{ } // NewUserTasksDao creates and returns a new DAO object for table data access. -func NewUserTasksDao() *UserTasksDao { +func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao { return &UserTasksDao{ - group: "default", - table: "user_tasks", - columns: userTasksColumns, + group: "default", + table: "user_tasks", + columns: userTasksColumns, + handlers: handlers, } } @@ -83,7 +85,11 @@ func (dao *UserTasksDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/internal/users.go b/internal/dao/internal/users.go index 55d0eda..2922a48 100644 --- a/internal/dao/internal/users.go +++ b/internal/dao/internal/users.go @@ -13,9 +13,10 @@ import ( // UsersDao is the data access object for the table users. type UsersDao 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 UsersColumns // columns contains all the column names of Table for convenient usage. + 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 UsersColumns // columns contains all the column names of Table for convenient usage. + handlers []gdb.ModelHandler // handlers for customized model modification. } // UsersColumns defines and stores column names for the table users. @@ -61,11 +62,12 @@ var usersColumns = UsersColumns{ } // NewUsersDao creates and returns a new DAO object for table data access. -func NewUsersDao() *UsersDao { +func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao { return &UsersDao{ - group: "default", - table: "users", - columns: usersColumns, + group: "default", + table: "users", + columns: usersColumns, + handlers: handlers, } } @@ -91,7 +93,11 @@ func (dao *UsersDao) Group() string { // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) + model := dao.DB().Model(dao.table) + for _, handler := range dao.handlers { + model = handler(model) + } + return model.Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. diff --git a/internal/dao/store_areas.go b/internal/dao/store_areas.go new file mode 100644 index 0000000..7082416 --- /dev/null +++ b/internal/dao/store_areas.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// storeAreasDao is the data access object for the table store_areas. +// You can define custom methods on it to extend its functionality as needed. +type storeAreasDao struct { + *internal.StoreAreasDao +} + +var ( + // StoreAreas is a globally accessible object for table store_areas operations. + StoreAreas = storeAreasDao{internal.NewStoreAreasDao()} +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/store_clients.go b/internal/dao/store_clients.go new file mode 100644 index 0000000..26425d9 --- /dev/null +++ b/internal/dao/store_clients.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// storeClientsDao is the data access object for the table store_clients. +// You can define custom methods on it to extend its functionality as needed. +type storeClientsDao struct { + *internal.StoreClientsDao +} + +var ( + // StoreClients is a globally accessible object for table store_clients operations. + StoreClients = storeClientsDao{internal.NewStoreClientsDao()} +) + +// Add your custom methods and functionality below. diff --git a/internal/dao/store_member_levels.go b/internal/dao/store_member_levels.go new file mode 100644 index 0000000..41bdb45 --- /dev/null +++ b/internal/dao/store_member_levels.go @@ -0,0 +1,22 @@ +// ================================================================================= +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// ================================================================================= + +package dao + +import ( + "server/internal/dao/internal" +) + +// storeMemberLevelsDao is the data access object for the table store_member_levels. +// You can define custom methods on it to extend its functionality as needed. +type storeMemberLevelsDao struct { + *internal.StoreMemberLevelsDao +} + +var ( + // StoreMemberLevels is a globally accessible object for table store_member_levels operations. + StoreMemberLevels = storeMemberLevelsDao{internal.NewStoreMemberLevelsDao()} +) + +// Add your custom methods and functionality below. diff --git a/internal/logic/store/store.go b/internal/logic/store/store.go index 6303050..084a97c 100644 --- a/internal/logic/store/store.go +++ b/internal/logic/store/store.go @@ -276,3 +276,8 @@ func (s *sStore) Detail(ctx context.Context, in *model.StoreDetailIn) (out *mode Id: one[dao.Stores.Columns().Id].Int64(), }, nil } + +//func (s *sStore) GetStoreMemberList(ctx context.Context, in *model.StoreMemberLevelsListIn) (out *model.StoreMemberLevelsListOut, error) { +// +// return nil, nil +//} diff --git a/internal/model/StoreMemberlevel.go b/internal/model/StoreMemberlevel.go new file mode 100644 index 0000000..485c92a --- /dev/null +++ b/internal/model/StoreMemberlevel.go @@ -0,0 +1,27 @@ +package model + +import "github.com/gogf/gf/v2/os/gtime" + +type StoreMemberLevels struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + LevelId int `json:"levelId" orm:"level_id" description:"会员等级ID(如0表示临时卡)"` // 会员等级ID(如0表示临时卡) + LevelName string `json:"levelName" orm:"level_name" description:"等级名称"` // 等级名称 + Level int `json:"level" orm:"level" description:"等级顺序,值越大等级越高"` // 等级顺序,值越大等级越高 + OlType int `json:"olType" orm:"ol_type" description:"在线类型(例如:1=线上)"` // 在线类型(例如:1=线上) + Status int `json:"status" orm:"status" description:"状态:1=启用,2=禁用"` // 状态:1=启用,2=禁用 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +} + +type StoreMemberLevelsListIn struct { + Page int + Size int + StoreId int64 +} + +type StoreMemberLevelsListOut struct { + List []StoreMemberLevels + Total int +} diff --git a/internal/model/do/store_areas.go b/internal/model/do/store_areas.go new file mode 100644 index 0000000..4eac367 --- /dev/null +++ b/internal/model/do/store_areas.go @@ -0,0 +1,21 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreAreas is the golang structure of table store_areas for DAO operations like Where/Data. +type StoreAreas struct { + g.Meta `orm:"table:store_areas, do:true"` + Id interface{} // 区域ID + StoreId interface{} // 所属门店ID + AreaName interface{} // 区域名称 + CreatedAt *gtime.Time // + UpdatedAt *gtime.Time // + DeletedAt *gtime.Time // +} diff --git a/internal/model/do/store_clients.go b/internal/model/do/store_clients.go new file mode 100644 index 0000000..02c9637 --- /dev/null +++ b/internal/model/do/store_clients.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreClients is the golang structure of table store_clients for DAO operations like Where/Data. +type StoreClients struct { + g.Meta `orm:"table:store_clients, do:true"` + Id interface{} // 客户机ID + StoreId interface{} // 所属门店ID + ClientName interface{} // 客户机名称 + Status interface{} // 状态:1=空闲,2=禁用,3=上机中等 + AreaId interface{} // 所属区域ID + CreatedAt *gtime.Time // + UpdatedAt *gtime.Time // + DeletedAt *gtime.Time // +} diff --git a/internal/model/do/store_member_levels.go b/internal/model/do/store_member_levels.go new file mode 100644 index 0000000..415a402 --- /dev/null +++ b/internal/model/do/store_member_levels.go @@ -0,0 +1,25 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package do + +import ( + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreMemberLevels is the golang structure of table store_member_levels for DAO operations like Where/Data. +type StoreMemberLevels struct { + g.Meta `orm:"table:store_member_levels, do:true"` + Id interface{} // 主键ID + StoreId interface{} // 所属门店ID + LevelId interface{} // 会员等级ID(如0表示临时卡) + LevelName interface{} // 等级名称 + Level interface{} // 等级顺序,值越大等级越高 + OlType interface{} // 在线类型(例如:1=线上) + Status interface{} // 状态:1=启用,2=禁用 + CreatedAt *gtime.Time // 创建时间 + UpdatedAt *gtime.Time // 更新时间 + DeletedAt *gtime.Time // 软删除时间戳 +} diff --git a/internal/model/entity/store_areas.go b/internal/model/entity/store_areas.go new file mode 100644 index 0000000..f4aa197 --- /dev/null +++ b/internal/model/entity/store_areas.go @@ -0,0 +1,19 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreAreas is the golang structure for table store_areas. +type StoreAreas struct { + Id int64 `json:"id" orm:"id" description:"区域ID"` // 区域ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + AreaName string `json:"areaName" orm:"area_name" description:"区域名称"` // 区域名称 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` // + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` // + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` // +} diff --git a/internal/model/entity/store_clients.go b/internal/model/entity/store_clients.go new file mode 100644 index 0000000..240649e --- /dev/null +++ b/internal/model/entity/store_clients.go @@ -0,0 +1,21 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreClients is the golang structure for table store_clients. +type StoreClients struct { + Id int64 `json:"id" orm:"id" description:"客户机ID"` // 客户机ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + ClientName string `json:"clientName" orm:"client_name" description:"客户机名称"` // 客户机名称 + Status int `json:"status" orm:"status" description:"状态:1=空闲,2=禁用,3=上机中等"` // 状态:1=空闲,2=禁用,3=上机中等 + AreaId int64 `json:"areaId" orm:"area_id" description:"所属区域ID"` // 所属区域ID + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` // + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` // + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:""` // +} diff --git a/internal/model/entity/store_member_levels.go b/internal/model/entity/store_member_levels.go new file mode 100644 index 0000000..950ce90 --- /dev/null +++ b/internal/model/entity/store_member_levels.go @@ -0,0 +1,23 @@ +// ================================================================================= +// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. +// ================================================================================= + +package entity + +import ( + "github.com/gogf/gf/v2/os/gtime" +) + +// StoreMemberLevels is the golang structure for table store_member_levels. +type StoreMemberLevels struct { + Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID + StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID + LevelId int `json:"levelId" orm:"level_id" description:"会员等级ID(如0表示临时卡)"` // 会员等级ID(如0表示临时卡) + LevelName string `json:"levelName" orm:"level_name" description:"等级名称"` // 等级名称 + Level int `json:"level" orm:"level" description:"等级顺序,值越大等级越高"` // 等级顺序,值越大等级越高 + OlType int `json:"olType" orm:"ol_type" description:"在线类型(例如:1=线上)"` // 在线类型(例如:1=线上) + Status int `json:"status" orm:"status" description:"状态:1=启用,2=禁用"` // 状态:1=启用,2=禁用 + CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间 + UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间 + DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳 +}