商品分类及属性接口修改
This commit is contained in:
@@ -2,6 +2,7 @@ package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.dto.PmsProductAttributeParam;
|
||||
import com.macro.mall.dto.ProductAttrInfo;
|
||||
import com.macro.mall.model.PmsProductAttribute;
|
||||
import com.macro.mall.service.PmsProductAttributeService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -83,4 +84,12 @@ public class PmsProductAttributeController {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("根据商品分类的id获取商品属性及属性分类")
|
||||
@RequestMapping(value = "/attrInfo/{productCategoryId}",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getAttrInfo(@PathVariable Long productCategoryId){
|
||||
List<ProductAttrInfo> productAttrInfoList = productAttributeService.getProductAttrInfo(productCategoryId);
|
||||
return new CommonResult().success(productAttrInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsProductCategoryController",description = "商品分类管理")
|
||||
@Api(tags = "PmsProductCategoryController", description = "商品分类管理")
|
||||
@RequestMapping("/productCategory")
|
||||
public class PmsProductCategoryController {
|
||||
@Autowired
|
||||
@@ -30,9 +30,9 @@ public class PmsProductCategoryController {
|
||||
@ApiOperation("添加产品分类")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@Validated @RequestBody PmsProductCategoryParam pmsProductCategoryParam,
|
||||
public Object create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam,
|
||||
BindingResult result) {
|
||||
int count = productCategoryService.create(pmsProductCategoryParam);
|
||||
int count = productCategoryService.create(productCategoryParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
@@ -45,9 +45,9 @@ public class PmsProductCategoryController {
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id,
|
||||
@Validated
|
||||
@RequestBody PmsProductCategoryParam pmsProductCategoryParam,
|
||||
@RequestBody PmsProductCategoryParam productCategoryParam,
|
||||
BindingResult result) {
|
||||
int count = productCategoryService.update(id, pmsProductCategoryParam);
|
||||
int count = productCategoryService.update(id, productCategoryParam);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
@@ -59,8 +59,8 @@ public class PmsProductCategoryController {
|
||||
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(@PathVariable Long parentId,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<PmsProductCategory> productCategoryList = productCategoryService.getList(parentId, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(productCategoryList);
|
||||
}
|
||||
@@ -84,4 +84,28 @@ public class PmsProductCategoryController {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改导航栏显示状态")
|
||||
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
|
||||
int count = productCategoryService.updateNavStatus(ids, navStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("修改显示状态")
|
||||
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
|
||||
int count = productCategoryService.updateShowStatus(ids, showStatus);
|
||||
if (count > 0) {
|
||||
return new CommonResult().success(count);
|
||||
} else {
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user