diff --git a/internal/biz/bo/order_wechat_bo.go b/internal/biz/bo/order_wechat_bo.go new file mode 100644 index 0000000..25869ec --- /dev/null +++ b/internal/biz/bo/order_wechat_bo.go @@ -0,0 +1,19 @@ +package bo + +import "time" + +// OrderWechatBo 领域实体Bo结构,字段和模型字段保持一致 +type OrderWechatBo struct { + ID int32 + OrderNo string + OutRequestNo string + AppID string + StockCreatorMchid string + OpenID string + StockID string + Status bool + CouponID string + Remark string + CreateTime *time.Time + UpdateTime *time.Time +} diff --git a/internal/biz/repo/order_wechat.go b/internal/biz/repo/order_wechat.go new file mode 100644 index 0000000..3a1332f --- /dev/null +++ b/internal/biz/repo/order_wechat.go @@ -0,0 +1,13 @@ +package repo + +import ( + "context" + "voucher/internal/biz/bo" +) + +type OrderWechatRepo interface { + // Create 创建 OrderWechat + Create(ctx context.Context, req *bo.OrderWechatBo) (*bo.OrderWechatBo, error) + // GetByID 根据 ID 获取 OrderWechat + GetByID(ctx context.Context, id int32) (*bo.OrderWechatBo, error) +} diff --git a/internal/data/model/order_wechat.gen.go b/internal/data/model/order_wechat.gen.go new file mode 100644 index 0000000..54edd96 --- /dev/null +++ b/internal/data/model/order_wechat.gen.go @@ -0,0 +1,32 @@ +// 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 model + +import ( + "time" +) + +const TableNameOrderWechat = "order_wechat" + +// OrderWechat mapped from table +type OrderWechat struct { + ID int64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` + OrderNo string `gorm:"column:order_no;not null;comment:订单号" json:"order_no"` // 订单号 + OutRequestNo string `gorm:"column:out_request_no;not null;comment:请求单号" json:"out_request_no"` // 请求单号 + AppID string `gorm:"column:app_id;not null;comment:微信应用id" json:"app_id"` // 微信应用id + StockCreatorMchid string `gorm:"column:stock_creator_mchid;not null;comment:批次创建方商户号\n" json:"stock_creator_mchid"` // 批次创建方商户号 + OpenID string `gorm:"column:open_id;not null;comment:微信openid" json:"open_id"` // 微信openid + StockID string `gorm:"column:stock_id;not null;comment:批次id" json:"stock_id"` // 批次id + Status uint8 `gorm:"column:status;not null;comment:1:发放中 2:发放成功 3:发放失败" json:"status"` // 1:发放中 2:发放成功 3:发放失败 + CouponID string `gorm:"column:coupon_id;not null;comment:微信为代金券唯一分配的id" json:"coupon_id"` // 微信为代金券唯一分配的id + Remark string `gorm:"column:remark;not null;comment:备注说明" json:"remark"` // 备注说明 + CreateTime *time.Time `gorm:"column:create_time;not null" json:"create_time"` + UpdateTime *time.Time `gorm:"column:update_time" json:"update_time"` +} + +// TableName OrderWechat's table name +func (*OrderWechat) TableName() string { + return TableNameOrderWechat +} diff --git a/internal/data/repoimpl/order_wechat.go b/internal/data/repoimpl/order_wechat.go new file mode 100644 index 0000000..c8ecccd --- /dev/null +++ b/internal/data/repoimpl/order_wechat.go @@ -0,0 +1,30 @@ +package repoimpl + +import ( + "context" + "voucher/internal/biz/bo" + "voucher/internal/biz/repo" + "voucher/internal/data/model" +) + +// OrderWechatRepoImpl . +type OrderWechatRepoImpl struct { + Base[model.OrderWechat, bo.OrderWechatBo] +} + +// NewOrderWechatRepoImpl . +func NewOrderWechatRepoImpl() repo.OrderWechatRepo { + return &OrderWechatRepoImpl{} +} + +func (r *OrderWechatRepoImpl) Create(ctx context.Context, req *bo.OrderWechatBo) (*bo.OrderWechatBo, error) { + // todo 待实现 + return nil, nil +} + +// GetByID 根据 ID 获取 OrderWechat +func (r *OrderWechatRepoImpl) GetByID(ctx context.Context, id int32) (*bo.OrderWechatBo, error) { + var item model.OrderWechat + // todo 待实现 + return r.ToBo(&item), nil +}