You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
901 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package sku
import "github.com/towgo/towgo/dao/basedboperat"
func (SKU) TableName() string {
return "sku"
}
// SKU 表示SKU属性
type SKU struct {
ID int64 `json:"id"` // SKU的唯一标识符
Name string `json:"name"` // SKU的名称
PID int64 `json:"pid"` // 父ID表示SKU属性
GoodsID int64 `json:"goods_id"` // 关联商品的ID
Weigh int64 `json:"weigh"` // SKU的权重
Content []SKU `json:"content" xorm:"-"` // SKU内容列表
}
func (sku *SKU) AfterQuery(session basedboperat.DbTransactionSession) error {
var qSku SKU
var qSkus []SKU
var listSkus basedboperat.List
listSkus.Limit = -1
listSkus.Where = append(listSkus.Where, basedboperat.Condition{
Field: "pid",
Operator: "=",
Value: sku.ID,
})
session.ListScan(&listSkus, &qSku, &qSkus)
sku.Content = qSkus
return nil
}