|
@ -22,7 +22,7 @@ type CustomerOrderSub struct { |
|
|
GoodPrice float64 `json:"good_price" xorm:"not null default 0.00 comment('商品价格') DECIMAL(18,2)"` |
|
|
GoodPrice float64 `json:"good_price" xorm:"not null default 0.00 comment('商品价格') DECIMAL(18,2)"` |
|
|
|
|
|
|
|
|
// 无关变量
|
|
|
// 无关变量
|
|
|
GoodsPicUrl string `json:"goods_pic_url" xorm:"extends"` |
|
|
|
|
|
|
|
|
GoodsPicUrl interface{} `json:"goods_pic_url" xorm:"extends"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (t *CustomerOrderSub) TableName() string { |
|
|
func (t *CustomerOrderSub) TableName() string { |
|
@ -33,7 +33,16 @@ func (t *CustomerOrderSub) Alias(n string) string { |
|
|
return fmt.Sprintf("%s as %s", t.TableName(), n) |
|
|
return fmt.Sprintf("%s as %s", t.TableName(), n) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func GetCustomerOrderSubsByOrderIds(orderIds interface{}) (subs []map[string]string, err error) { |
|
|
|
|
|
|
|
|
type SubOrderResult struct { |
|
|
|
|
|
OrderId int `json:"order_id"` |
|
|
|
|
|
GoodsId int `json:"goods_id"` |
|
|
|
|
|
GoodsNum int `json:"goods_num"` |
|
|
|
|
|
GoodName string `json:"good_name"` |
|
|
|
|
|
GoodPrice float64 `json:"good_price"` |
|
|
|
|
|
GoodsPicUrl []interface{} `json:"goods_pic_url"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func GetCustomerOrderSubsByOrderIds(orderIds interface{}) (subs []*SubOrderResult, err error) { |
|
|
err = core.GetXormAuto().Table(new(CustomerOrderSub)).Alias("s"). |
|
|
err = core.GetXormAuto().Table(new(CustomerOrderSub)).Alias("s"). |
|
|
Select("s.order_id, s.goods_id, s.goods_num, s.good_name, s.good_price, g.goods_pic_url"). |
|
|
Select("s.order_id, s.goods_id, s.goods_num, s.good_name, s.good_price, g.goods_pic_url"). |
|
|
Join("left", new(CustomerGoods).Alias("g"), "g.id=s.goods_id"). |
|
|
Join("left", new(CustomerGoods).Alias("g"), "g.id=s.goods_id"). |
|
|