XinYeYouKu/app/models/ordermodel/order.go

53 lines
1.5 KiB
Go
Raw Normal View History

2024-06-13 14:30:06 +08:00
package ordermodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *OrderModel
)
// 实体
type Order struct {
2024-06-13 14:50:26 +08:00
Id int `xorm:"'id' UNSIGNED INT pk autoincr"`
2024-06-13 14:30:06 +08:00
OrderNo string `xorm:"'order_no' varchar(50)"`
UserId int `xorm:"'user_id' int(0)"`
2024-06-13 18:45:49 +08:00
XinYeUserId string `xorm:"'xinye_user_id' int(0)"`
2024-06-13 14:30:06 +08:00
UserName string `xorm:"'user_name' varchar(11)"`
Mobile string `xorm:"'mobile' varchar(13)"`
ProductId int `xorm:"'product_id' int(0)"`
ProductName string `xorm:"'product_name' varchar(50)"`
2024-06-13 18:45:49 +08:00
Price string `xorm:"'price' decimal(10,2)"`
2024-06-13 14:30:06 +08:00
ActivityId int `xorm:"'activity_id' UNSIGNED INT"`
State int `xorm:"'state' UNSIGNED TINYINT"`
VoucherId int `xorm:"'voucher_id' int(0)"`
VoucherLink string `xorm:"'voucher_link' varchar(255)"`
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"`
}
// 表名
func (m *Order) TableName() string {
return "order"
}
// 私有化防止被外部new
type OrderModel struct {
db.Model //组合基础Model集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *OrderModel {
once.Do(func() {
m = new(OrderModel)
//m.DiName = "" //设置数据库实例连接默认db.SingletonMain
})
return m
}