package models import ( "fmt" "github.com/ouxuanserver/osmanthuswine/src/core" "time" ) const CustomerOrderSubTN = TableNamePrefix + "customer_order_sub" type CustomerOrderSub struct { Id int64 `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"` IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('软删除') TINYINT(1)"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` OutTradeNo string `json:"out_trade_no" xorm:"not null default 0 comment('订单号') VARCHAR(128)"` GoodsId int64 `json:"goods_id" xorm:"not null default 0 comment('商品id') INT(11)"` GoodsNum int `json:"goods_num" xorm:"not null default 0 comment('商品数量') INT(11)"` GoodName string `json:"good_name" xorm:"not null default '' comment('商品名字') VARCHAR(128)"` GoodPrice float64 `json:"good_price" xorm:"not null default 0.00 comment('商品价格') DECIMAL(18)"` } func (t *CustomerOrderSub) TableName() string { return CustomerOrderSubTN } func (t *CustomerOrderSub) Alias(n string) string { return fmt.Sprintf("%s as %s", t.TableName(), n) } func GetCustomerOrderSubByOutTradeNos(outTradeNos []string) (subs []*CustomerOrderSub, err error) { err = core.GetXormAuto().Where("is_delete=0").In("out_trade_no", outTradeNos). Asc("created_at").Find(&subs) return }