46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package orderexceptionmodel
|
||
|
||
import (
|
||
"sync"
|
||
"time"
|
||
|
||
"github.com/qit-team/snow-core/db"
|
||
)
|
||
|
||
var (
|
||
once sync.Once
|
||
m *OrderExceptionModel
|
||
)
|
||
|
||
// 实体
|
||
type OrderException struct {
|
||
Id int64
|
||
OrderId int64 `xorm:"'order_id' bigint(20)"`
|
||
OutTradeNo string `xorm:"'out_trade_no' varchar(50)"`
|
||
ExceptionType int `xorm:"'exception_type' TINYINT"`
|
||
ExceptionDesc string `xorm:"'exception_desc' varchar(50)"`
|
||
CreateTime time.Time `xorm:"'create_time' datetime created"`
|
||
UpdateTime time.Time `xorm:"'update_time' timestamp updated"`
|
||
Status int `xorm:"'status' TINYINT"`
|
||
DeleteTime time.Time `xorm:"'delete_time' timestamp deleted"`
|
||
}
|
||
|
||
// 表名
|
||
func (m *OrderException) TableName() string {
|
||
return "order_exceptions"
|
||
}
|
||
|
||
// 私有化,防止被外部new
|
||
type OrderExceptionModel struct {
|
||
db.Model //组合基础Model,集成基础Model的属性和方法
|
||
}
|
||
|
||
// 单例模式
|
||
func GetInstance() *OrderExceptionModel {
|
||
once.Do(func() {
|
||
m = new(OrderExceptionModel)
|
||
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
||
})
|
||
return m
|
||
}
|