2024-06-17 16:29:39 +08:00
|
|
|
|
package ordersmodel
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/qit-team/snow-core/db"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
once sync.Once
|
|
|
|
|
m *OrdersModel
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 实体
|
|
|
|
|
type Orders struct {
|
2024-06-19 18:32:34 +08:00
|
|
|
|
Id int `xorm:"'id' UNSIGNED INT pk autoincr"`
|
|
|
|
|
OrderNo string `xorm:"'order_no' varchar(50)"`
|
|
|
|
|
OrgTxnSeq string `xorm:"'orgTxnSeq' varchar(255)"`
|
|
|
|
|
UserId int `xorm:"'user_id' int(0)"`
|
2024-06-25 10:12:48 +08:00
|
|
|
|
CustNo string `xorm:"'custNo' varchar(50)"`
|
2024-06-19 18:32:34 +08:00
|
|
|
|
ProductId int `xorm:"'product_id' int(0)"`
|
|
|
|
|
ProductName string `xorm:"'product_name' varchar(50)"`
|
|
|
|
|
Price string `xorm:"'price' decimal(10,2)"`
|
|
|
|
|
State int `xorm:"'state' UNSIGNED TINYINT"`
|
2024-08-05 16:10:20 +08:00
|
|
|
|
VoucherId string `xorm:"'voucher_id' int(0)"`
|
2024-06-19 18:32:34 +08:00
|
|
|
|
VoucherLink string `xorm:"'voucher_link' varchar(255)"`
|
|
|
|
|
RefundOrderNo string `xorm:"'refundOrderNo' varchar(255)"`
|
|
|
|
|
RefundOrderSta string `xorm:"'refundOrderSta' varchar(20)"`
|
2024-06-24 11:44:38 +08:00
|
|
|
|
RefundTime time.Time `xorm:"'refund_time' datetime"`
|
2024-06-19 18:32:34 +08:00
|
|
|
|
CreateTime time.Time `xorm:"'create_time' datetime"`
|
|
|
|
|
UpdateTime time.Time `xorm:"'update_time' datetime"`
|
|
|
|
|
ExchangeTime time.Time `xorm:"'exchange_time' datetime"`
|
|
|
|
|
Deleted time.Time `xorm:"'Deleted' datetime"`
|
2024-06-17 16:29:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-24 11:44:38 +08:00
|
|
|
|
type OrdersProductsList struct {
|
|
|
|
|
Orders `xorm:"extends"`
|
|
|
|
|
MainImage string `xorm:"'main_image' varchar(255)"`
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-17 16:29:39 +08:00
|
|
|
|
// 表名
|
|
|
|
|
func (m *Orders) TableName() string {
|
|
|
|
|
return "Orders"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 私有化,防止被外部new
|
|
|
|
|
type OrdersModel struct {
|
|
|
|
|
db.Model //组合基础Model,集成基础Model的属性和方法
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 单例模式
|
|
|
|
|
func GetInstance() *OrdersModel {
|
|
|
|
|
once.Do(func() {
|
|
|
|
|
m = new(OrdersModel)
|
2024-08-05 16:10:20 +08:00
|
|
|
|
m.GetDb().ShowSQL(true)
|
2024-06-17 16:29:39 +08:00
|
|
|
|
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
|
|
|
|
})
|
|
|
|
|
return m
|
|
|
|
|
}
|