- param isBySku added for GetSkuNames
This commit is contained in:
@@ -192,7 +192,7 @@ func DeleteCategoryMap(ctx *jxcontext.Context, db *dao.DaoDB, categoryID int) (n
|
||||
})
|
||||
}
|
||||
|
||||
func GetSkuNames(ctx *jxcontext.Context, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *SkuNamesInfo, err error) {
|
||||
func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *SkuNamesInfo, err error) {
|
||||
db := dao.GetDB()
|
||||
sql := `
|
||||
FROM sku_name t1
|
||||
@@ -346,8 +346,11 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, params map[string]inter
|
||||
t1.status,
|
||||
t1.is_spu,
|
||||
t1.img_hash_code,
|
||||
t1.upc
|
||||
`
|
||||
t1.upc`
|
||||
if isBySku {
|
||||
sql += `,
|
||||
t2.id`
|
||||
}
|
||||
sqlData := `
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
@@ -476,7 +479,7 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
tmpInfo, err := GetSkuNames(ctx, "", utils.Params2Map("nameID", skuNameExt.SkuName.ID), 0, 1)
|
||||
tmpInfo, err := GetSkuNames(ctx, "", false, utils.Params2Map("nameID", skuNameExt.SkuName.ID), 0, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -597,7 +600,7 @@ func AddSku(ctx *jxcontext.Context, nameID int, sku *model.Sku, userName string)
|
||||
sku.NameID = nameID
|
||||
sku.JdID = jxutils.GenFakeID()
|
||||
if err = dao.CreateEntity(db, sku); err == nil {
|
||||
result, err2 := GetSkuNames(ctx, "", utils.Params2Map("skuID", sku.ID), 0, 0)
|
||||
result, err2 := GetSkuNames(ctx, "", false, utils.Params2Map("skuID", sku.ID), 0, 0)
|
||||
if err = err2; err == nil {
|
||||
if result.TotalCount == 1 {
|
||||
outSkuNameExt = result.SkuNames[0]
|
||||
|
||||
@@ -147,12 +147,13 @@ func (c *SkuController) SyncCategory() {
|
||||
// @Param toStatus query int false "查询起始状态(0:下架,1:正常)"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Param isBySku query bool false "是否将sku拆开,缺省为false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetSkuNames [get]
|
||||
func (c *SkuController) GetSkuNames() {
|
||||
c.callGetSkuNames(func(params *tSkuGetSkuNamesParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetSkuNames(params.Ctx, params.Keyword, params.MapData, params.Offset, params.PageSize)
|
||||
retVal, err = cms.GetSkuNames(params.Ctx, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user