商品库增加全国中位价

This commit is contained in:
苏尹岚
2020-03-26 14:12:38 +08:00
parent 64e2898769
commit 3b0d554985
2 changed files with 11 additions and 6 deletions

View File

@@ -392,9 +392,11 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
FROM sku_name t1
LEFT JOIN sku t2 ON t1.id = t2.name_id AND t2.deleted_at = ?
LEFT JOIN sku_name_place_bind t3 ON t1.id = t3.name_id
LEFT JOIN price_refer_snapshot t4 ON t4.city_code = ? AND t4.snapshot_at = ? AND t4.sku_id = t2.id
WHERE t1.deleted_at = ?`
sqlParams := []interface{}{
utils.DefaultTimeValue,
0, utils.Time2Date(time.Now().AddDate(0, 0, -1)),
utils.DefaultTimeValue,
}
if keyword != "" {
@@ -561,7 +563,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
t1.upc,
t1.ex_prefix,
t1.ex_prefix_begin,
t1.ex_prefix_end`
t1.ex_prefix_end,
t4.mid_unit_price`
if isBySku {
sql += `,
t2.id`
@@ -595,6 +598,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
t1.ex_prefix,
t1.ex_prefix_begin,
t1.ex_prefix_end,
t4.mid_unit_price,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"comment":"', t2.comment, '","status":', t2.status,
',"createdAt":"', CONCAT(REPLACE(t2.created_at," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(t2.updated_at," ","T"),"+08:00"),
'","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit,

View File

@@ -282,9 +282,10 @@ type SkuWithVendor struct {
type SkuNameExt struct {
SkuName
Skus []*SkuWithVendor `orm:"-" json:"skus"`
SkusStr string `json:"-"`
FullName string `json:"fullName"`
Places []int `orm:"-" json:"places"`
PlacesStr string `json:"-"`
Skus []*SkuWithVendor `orm:"-" json:"skus"`
SkusStr string `json:"-"`
FullName string `json:"fullName"`
Places []int `orm:"-" json:"places"`
PlacesStr string `json:"-"`
MidUnitPrice int `json:"midUnitPrice"`
}