use of com.paascloud.provider.model.vo.MdcCategoryVo in project paascloud-master by paascloud.
the class MdcProductCategoryMainController method queryCategoryVoById.
/**
* 根据ID获取商品分类信息.
*
* @param id the id
*
* @return the wrapper
*/
@PostMapping(value = "/queryById/{id}")
@ApiOperation(httpMethod = "POST", value = "根据ID获取商品分类信息")
public Wrapper<MdcCategoryVo> queryCategoryVoById(@ApiParam(name = "id", value = "商品分类id") @PathVariable Long id) {
logger.info("根据Id查询商品分类信息, categoryId={}", id);
MdcCategoryVo mdcCategoryVo = mdcProductCategoryService.getMdcCategoryVoById(id);
return WrapMapper.ok(mdcCategoryVo);
}
use of com.paascloud.provider.model.vo.MdcCategoryVo in project paascloud-master by paascloud.
the class MdcProductCategoryServiceImpl method getMdcCategoryVoById.
@Override
public MdcCategoryVo getMdcCategoryVoById(final Long categoryId) {
MdcProductCategory category = mdcProductCategoryMapper.selectByPrimaryKey(categoryId);
if (category == null) {
logger.error("找不到数据字典信息id={}", categoryId);
throw new MdcBizException(ErrorCodeEnum.MDC10023001, categoryId);
}
// 获取父级菜单信息
MdcProductCategory parentCategory = mdcProductCategoryMapper.selectByPrimaryKey(category.getPid());
ModelMapper modelMapper = new ModelMapper();
MdcCategoryVo categoryVo = modelMapper.map(category, MdcCategoryVo.class);
categoryVo.setId(category.getId());
categoryVo.setPid(category.getPid());
if (parentCategory != null) {
categoryVo.setParentCategoryName(parentCategory.getName());
}
return categoryVo;
}
Aggregations