Search in sources :

Example 1 with MdcCategoryVo

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);
}
Also used : MdcCategoryVo(com.paascloud.provider.model.vo.MdcCategoryVo) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with 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;
}
Also used : MdcBizException(com.paascloud.provider.exceptions.MdcBizException) MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory) MdcCategoryVo(com.paascloud.provider.model.vo.MdcCategoryVo) ModelMapper(org.modelmapper.ModelMapper)

Aggregations

MdcCategoryVo (com.paascloud.provider.model.vo.MdcCategoryVo)2 MdcBizException (com.paascloud.provider.exceptions.MdcBizException)1 MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ModelMapper (org.modelmapper.ModelMapper)1