商品分类接口修改
This commit is contained in:
parent
aba49c58cb
commit
96fc15e003
@ -65,8 +65,16 @@ public class PmsProductCategoryController {
|
|||||||
return new CommonResult().pageSuccess(productCategoryList);
|
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("删除商品分类")
|
@ApiOperation("删除商品分类")
|
||||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object delete(@PathVariable Long id) {
|
public Object delete(@PathVariable Long id) {
|
||||||
int count = productCategoryService.delete(id);
|
int count = productCategoryService.delete(id);
|
||||||
|
@ -20,4 +20,5 @@ public interface PmsProductCategoryService {
|
|||||||
List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum);
|
List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum);
|
||||||
|
|
||||||
int delete(Long id);
|
int delete(Long id);
|
||||||
|
PmsProductCategory getItem(Long id);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ public class PmsProductCategoryServiceImpl implements PmsProductCategoryService
|
|||||||
@Override
|
@Override
|
||||||
public int create(PmsProductCategoryParam pmsProductCategoryParam) {
|
public int create(PmsProductCategoryParam pmsProductCategoryParam) {
|
||||||
PmsProductCategory productCategory = new PmsProductCategory();
|
PmsProductCategory productCategory = new PmsProductCategory();
|
||||||
|
productCategory.setProductCount(0);
|
||||||
BeanUtils.copyProperties(pmsProductCategoryParam, productCategory);
|
BeanUtils.copyProperties(pmsProductCategoryParam, productCategory);
|
||||||
//没有父分类时为一级分类
|
//没有父分类时为一级分类
|
||||||
setCategoryLevel(productCategory);
|
setCategoryLevel(productCategory);
|
||||||
@ -64,6 +65,11 @@ public class PmsProductCategoryServiceImpl implements PmsProductCategoryService
|
|||||||
return productCategoryMapper.deleteByPrimaryKey(id);
|
return productCategoryMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PmsProductCategory getItem(Long id) {
|
||||||
|
return productCategoryMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分类的parentId设置分类的level
|
* 根据分类的parentId设置分类的level
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user