Commit 96fc15e0 authored by zhh's avatar zhh
Browse files

商品分类接口修改

parent aba49c58
......@@ -65,8 +65,16 @@ public class PmsProductCategoryController {
return new CommonResult().pageSuccess(productCategoryList);
}
@ApiOperation("根据id获取商品分类")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public Object getItem(@PathVariable Long id) {
PmsProductCategory productCategory = productCategoryService.getItem(id);
return new CommonResult().success(productCategory);
}
@ApiOperation("删除商品分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public Object delete(@PathVariable Long id) {
int count = productCategoryService.delete(id);
......
......@@ -20,4 +20,5 @@ public interface PmsProductCategoryService {
List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum);
int delete(Long id);
PmsProductCategory getItem(Long id);
}
......@@ -29,6 +29,7 @@ public class PmsProductCategoryServiceImpl implements PmsProductCategoryService
@Override
public int create(PmsProductCategoryParam pmsProductCategoryParam) {
PmsProductCategory productCategory = new PmsProductCategory();
productCategory.setProductCount(0);
BeanUtils.copyProperties(pmsProductCategoryParam, productCategory);
//没有父分类时为一级分类
setCategoryLevel(productCategory);
......@@ -64,6 +65,11 @@ public class PmsProductCategoryServiceImpl implements PmsProductCategoryService
return productCategoryMapper.deleteByPrimaryKey(id);
}
@Override
public PmsProductCategory getItem(Long id) {
return productCategoryMapper.selectByPrimaryKey(id);
}
/**
* 根据分类的parentId设置分类的level
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment