init dev
This commit is contained in:
parent
d53da43015
commit
505d744bf5
|
|
@ -1,4 +0,0 @@
|
|||
package bo
|
||||
|
||||
type OrderBo struct {
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package bo
|
||||
|
||||
import "time"
|
||||
|
||||
// OrderBo 领域实体Bo结构,字段和模型字段保持一致
|
||||
type OrderBo struct {
|
||||
ID int32
|
||||
OrderNo string
|
||||
OutBizNo string
|
||||
ProductNo string
|
||||
Account string
|
||||
AccountType bool
|
||||
Status bool
|
||||
AppID string
|
||||
MerchantNo string
|
||||
Channel bool
|
||||
CreateTime time.Time
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"voucher/internal/biz/bo"
|
||||
)
|
||||
|
||||
type OrderRepo interface {
|
||||
// Create 创建 Order
|
||||
Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderBo, error)
|
||||
// GetByID 根据 ID 获取 Order
|
||||
GetByID(ctx context.Context, id int32) (*bo.OrderBo, error)
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// 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 TableNameOrder = "order"
|
||||
|
||||
// Order mapped from table <order>
|
||||
type Order struct {
|
||||
ID int64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
OrderNo string `gorm:"column:order_no;not null" json:"order_no"`
|
||||
OutBizNo string `gorm:"column:out_biz_no;not null;comment:外部交易号" json:"out_biz_no"` // 外部交易号
|
||||
ProductNo string `gorm:"column:product_no;not null;comment:商品编号" json:"product_no"` // 商品编号
|
||||
Account string `gorm:"column:account;not null;comment:充值账号" json:"account"` // 充值账号
|
||||
AccountType uint8 `gorm:"column:account_type;not null;comment:1:oepnid/userid 2:手机号" json:"account_type"` // 1:oepnid/userid 2:手机号
|
||||
Status uint8 `gorm:"column:status;not null;comment:1:待发放 2:发放中 3:发放成功 4:发放失败" json:"status"` // 1:待发放 2:发放中 3:发放成功 4:发放失败
|
||||
AppID string `gorm:"column:app_id;not null;comment:批次所属应用" json:"app_id"` // 批次所属应用
|
||||
MerchantNo string `gorm:"column:merchant_no;not null;comment:创建批次号的商户号" json:"merchant_no"` // 创建批次号的商户号
|
||||
Channel uint8 `gorm:"column:channel;not null;comment:1:微信 2:支付宝" json:"channel"` // 1:微信 2:支付宝
|
||||
CreateTime *time.Time `gorm:"column:create_time" json:"create_time"`
|
||||
}
|
||||
|
||||
// TableName Order's table name
|
||||
func (*Order) TableName() string {
|
||||
return TableNameOrder
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package repoimpl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"voucher/internal/biz/bo"
|
||||
"voucher/internal/biz/repository"
|
||||
"voucher/internal/data/model"
|
||||
)
|
||||
|
||||
// OrderRepoImpl 定义了针对 Order 表的 CRUD 操作
|
||||
type OrderRepoImpl struct {
|
||||
Base[model.Order, bo.OrderBo]
|
||||
}
|
||||
|
||||
// NewOrderRepoImpl 创建一个新的 OrderRepoImpl 实例
|
||||
func NewOrderRepoImpl() repository.OrderRepo {
|
||||
return &OrderRepoImpl{}
|
||||
}
|
||||
|
||||
func (r *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderBo, error) {
|
||||
// todo 待实现
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetByID 根据 ID 获取 Order
|
||||
func (r *OrderRepoImpl) GetByID(ctx context.Context, id int32) (*bo.OrderBo, error) {
|
||||
var item model.Order
|
||||
// todo 待实现
|
||||
return r.ToBo(&item), nil
|
||||
}
|
||||
Loading…
Reference in New Issue