- param isBySku added for GetStoreSkus

This commit is contained in:
gazebo
2019-03-08 09:22:36 +08:00
parent ce109a60b3
commit 9a071dcbbe
2 changed files with 8 additions and 4 deletions

View File

@@ -87,7 +87,7 @@ type StoreOpRequestInfo struct {
// 商品不可售,直接排除
// 如果门店商品是可售状态,那么会忽略区域限制。否则有区域限制
func GetStoreSkus(ctx *jxcontext.Context, storeID int, isFocus bool, keyword string, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
func GetStoreSkus(ctx *jxcontext.Context, storeID int, isFocus bool, keyword string, isBySku bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
db := dao.GetDB()
sql := `
FROM sku_name t1
@@ -212,8 +212,11 @@ func GetStoreSkus(ctx *jxcontext.Context, storeID int, isFocus bool, keyword str
t1.unit,
t1.price,
t1.img,
t1.elm_img_hash_code
`
t1.elm_img_hash_code`
if isBySku {
sql += `,
t2.id`
}
sqlData := `
SELECT
SQL_CALC_FOUND_ROWS

View File

@@ -39,12 +39,13 @@ type StoreSkuController struct {
// @Param isGetOpRequest query bool false "是否返回相应的待审核变动请求缺省为false不返回"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50-1表示全部"
// @Param isBySku query bool false "是否按SKU分拆"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetStoreSkus [get]
func (c *StoreSkuController) GetStoreSkus() {
c.callGetStoreSkus(func(params *tStoreSkuGetStoreSkusParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStoreSkus(params.Ctx, params.StoreID, params.IsFocus, params.Keyword, params.MapData, params.Offset, params.PageSize)
retVal, err = cms.GetStoreSkus(params.Ctx, params.StoreID, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
return retVal, "", err
})
}