- comment moved from skuname to sku.

This commit is contained in:
gazebo
2018-10-19 14:24:13 +08:00
parent 507fcf16d8
commit 850dced8a6
5 changed files with 13 additions and 16 deletions

View File

@@ -154,7 +154,7 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
sqlParams := make([]interface{}, 0)
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.comment LIKE ?"
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t2.comment LIKE ?"
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike)
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
@@ -241,7 +241,6 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
t1.deleted_at,
t1.prefix,
t1.name,
t1.comment,
t1.brand_id,
t1.category_id,
t1.is_global,
@@ -260,7 +259,6 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
t1.deleted_at,
t1.prefix,
t1.name,
t1.comment,
t1.brand_id,
t1.category_id,
t1.is_global,
@@ -268,7 +266,7 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
t1.price,
t1.img,
t1.elm_img_hash_code,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"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, '","weight":', t2.weight, ',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, "}")), "]") skus_str,
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, '","weight":', t2.weight, ',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, "}")), "]") skus_str,
CONCAT("[", GROUP_CONCAT(DISTINCT t3.place_code), "]") places_str
` + sql + `
ORDER BY t1.id

View File

@@ -83,7 +83,7 @@ func GetStoreSkus(storeID int, isFocus bool, keyword string, params map[string]i
}
if keyword != "" {
keywordLike := "%" + keyword + "%"
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t1.comment LIKE ?"
sql += " AND (t1.name LIKE ? OR t1.prefix LIKE ? OR t2.comment LIKE ?"
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike)
if keywordInt64, err2 := strconv.ParseInt(keyword, 10, 64); err2 == nil {
@@ -155,7 +155,6 @@ func GetStoreSkus(storeID int, isFocus bool, keyword string, params map[string]i
t1.deleted_at,
t1.prefix,
t1.name,
t1.comment,
t1.brand_id,
t1.category_id,
t1.is_global,
@@ -174,7 +173,6 @@ func GetStoreSkus(storeID int, isFocus bool, keyword string, params map[string]i
t1.deleted_at,
t1.prefix,
t1.name,
t1.comment,
t1.brand_id,
t1.category_id,
t1.is_global,
@@ -182,7 +180,7 @@ func GetStoreSkus(storeID int, isFocus bool, keyword string, params map[string]i
t1.price,
t1.img,
t1.elm_img_hash_code,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"status":', t2.status, ',"createdAt":"',
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"id":', t2.id, ',"comment":"', t2.comment, '","status":', t2.status, ',"createdAt":"',
CONCAT(REPLACE(IF(t4.created_at IS NULL, '1970-01-01 00:00:00', t4.created_at)," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(IF(t4.updated_at IS NULL, '1970-01-01 00:00:00', t4.updated_at)," ","T"),"+08:00"),
'","lastOperator":"', IF(t4.last_operator IS NULL, '', t4.last_operator), '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight,
',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, ',"subStoreID":', IF(t4.sub_store_id IS NULL, 0, t4.sub_store_id),

View File

@@ -150,9 +150,8 @@ func (*SkuCategory) TableUnique() [][]string {
type SkuName struct {
ModelIDCULD
Prefix string `orm:"size(255)" json:"prefix"`
Name string `orm:"size(255);index" json:"name"`
Comment string `orm:"size(255)" json:"comment"`
Prefix string `orm:"size(255)" json:"prefix"`
Name string `orm:"size(255);index" json:"name"`
BrandID int `orm:"column(brand_id);default(0)" json:"brandID"` // todo此属性暂时没有使用且有问题应该是不同平台都有一个brandid
CategoryID int `orm:"column(category_id);index" json:"categoryID"` // 标准类别
@@ -175,6 +174,7 @@ type Sku struct {
CategoryID int `orm:"column(category_id)" json:"categoryID"` // 特殊类别,一般用于秒杀,特价之类的特殊类别
NameID int `orm:"column(name_id)" json:"nameID"` // todo 这个索引应该要求唯一
Comment string `orm:"size(255)" json:"comment"`
SpecQuality float32 `json:"specQuality"`
SpecUnit string `orm:"size(8)" json:"specUnit"` // 质量或容量
Weight int `json:"weight"` // 重量/质量单位为克当相应的SkuName的SpecUnit为g或kg时必须等于SpecQuality

View File

@@ -92,7 +92,7 @@ func (p *PurchaseHandler) syncOneStoreSkus(db *dao.DaoDB, storeID int, skuIDs []
}
sql := `
SELECT t1.*, t2.spec_quality, t2.spec_unit, t2.weight, t2.status sku_status,
t3.prefix, t3.name, t3.comment, t3.is_global, t3.unit, t3.img,
t3.prefix, t3.name, t2.comment, t3.is_global, t3.unit, t3.img,
t4.name cat_name,
t4.id cat_id, t4.level cat_level, t5.ebai_id cat_ebai_id,
t4p.id parent_cat_id, t5p.ebai_id parent_cat_ebai_id, t5p.ebai_sync_status parent_cat_ebai_sync_status,

View File

@@ -21,9 +21,10 @@ const (
type tSkuInfoExt struct {
model.SkuName
JdID int64 `orm:"column(jd_id)"` // 商家类别
JdCategoryID int `orm:"column(jd_category_id)"` // 到家类别
SkuCatID int64 `orm:"column(sku_cat_id)"` // 商家特殊类别
JdID int64 `orm:"column(jd_id)"` // 商家类别
JdCategoryID int `orm:"column(jd_category_id)"` // 到家类别
SkuCatID int64 `orm:"column(sku_cat_id)"` // 商家特殊类别
Comment string `orm:"size(255)" json:"comment"`
}
func (p *PurchaseHandler) CreateCategory(db *dao.DaoDB, cat *model.SkuCategory, userName string) (err error) {
@@ -178,7 +179,6 @@ func (p *PurchaseHandler) ReadSku(vendorSkuID string) (skuNameExt *model.SkuName
}
skuNameExt.Prefix = prefix
skuNameExt.Name = name
skuNameExt.Comment = comment
skuNameExt.Unit = unit
skuNameExt.Price = int(utils.MustInterface2Int64(mapData["skuPrice"]))
skuNameExt.Skus = []*model.Sku{
@@ -188,6 +188,7 @@ func (p *PurchaseHandler) ReadSku(vendorSkuID string) (skuNameExt *model.SkuName
Weight: jxutils.FloatWeight2Int(float32(utils.MustInterface2Float64(mapData["weight"]))),
JdID: utils.MustInterface2Int64(mapData["skuId"]),
Status: jdStatus2jxStatus(int(utils.MustInterface2Int64(mapData["fixedStatus"]))),
Comment: comment,
},
}
skuNameExt.Skus[0].ID = int(utils.Str2Int64(utils.Interface2String(mapData["outSkuId"])))