Search in sources :

Example 6 with MdcProductCategory

use of com.paascloud.provider.model.domain.MdcProductCategory in project paascloud-master by paascloud.

the class MdcProductCategoryServiceImpl method checkCategoryHasChildCategory.

@Override
public boolean checkCategoryHasChildCategory(final Long categoryId) {
    logger.info("检查数据字典id={}是否存在生效节点", categoryId);
    MdcProductCategory uacMenu = new MdcProductCategory();
    uacMenu.setStatus(MdcCategoryStatusEnum.ENABLE.getType());
    uacMenu.setPid(categoryId);
    return mapper.selectCount(uacMenu) > 0;
}
Also used : MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory)

Example 7 with MdcProductCategory

use of com.paascloud.provider.model.domain.MdcProductCategory in project paascloud-master by paascloud.

the class MdcProductCategoryServiceImpl method getByCategoryId.

@Override
public MdcProductCategory getByCategoryId(Long categoryId) {
    Preconditions.checkArgument(categoryId != null, "分类ID不能为空");
    MdcProductCategory query = new MdcProductCategory();
    query.setId(categoryId);
    return mdcProductCategoryMapper.selectOne(query);
}
Also used : MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory)

Example 8 with MdcProductCategory

use of com.paascloud.provider.model.domain.MdcProductCategory in project paascloud-master by paascloud.

the class MdcProductCategoryServiceImpl method updateMdcCategoryStatusById.

@Override
public void updateMdcCategoryStatusById(final UpdateStatusDto updateStatusDto, final LoginAuthDto loginAuthDto) {
    Long id = updateStatusDto.getId();
    Integer status = updateStatusDto.getStatus();
    // 要处理的菜单集合
    List<MdcProductCategory> mdcCategoryList = Lists.newArrayList();
    int result;
    if (status.equals(MdcCategoryStatusEnum.DISABLE.getType())) {
        // 获取菜单以及子菜单
        mdcCategoryList = this.getAllCategoryFolder(id, MdcCategoryStatusEnum.ENABLE.getType());
    } else {
        // 获取菜单、其子菜单以及父菜单
        MdcProductCategory uacMenu = new MdcProductCategory();
        uacMenu.setPid(id);
        result = this.selectCount(uacMenu);
        // 此菜单含有子菜单
        if (result > 0) {
            mdcCategoryList = this.getAllCategoryFolder(id, MdcCategoryStatusEnum.DISABLE.getType());
        }
        List<MdcProductCategory> categoryListTemp = this.getAllParentCategoryFolderByMenuId(id);
        for (MdcProductCategory category : categoryListTemp) {
            if (!mdcCategoryList.contains(category)) {
                mdcCategoryList.add(category);
            }
        }
    }
    this.updateCategoryStatus(mdcCategoryList, loginAuthDto, status);
}
Also used : MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory)

Example 9 with MdcProductCategory

use of com.paascloud.provider.model.domain.MdcProductCategory 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)

Example 10 with MdcProductCategory

use of com.paascloud.provider.model.domain.MdcProductCategory in project paascloud-master by paascloud.

the class MdcProductCategoryServiceImpl method getProductCategoryListByPid.

@Override
public List<MdcProductCategory> getProductCategoryListByPid(Long pid) {
    Preconditions.checkArgument(pid != null, "pid is null");
    MdcProductCategory query = new MdcProductCategory();
    query.setPid(pid);
    return mdcProductCategoryMapper.select(query);
}
Also used : MdcProductCategory(com.paascloud.provider.model.domain.MdcProductCategory)

Aggregations

MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)17 MdcBizException (com.paascloud.provider.exceptions.MdcBizException)3 ApiOperation (io.swagger.annotations.ApiOperation)2 PageInfo (com.github.pagehelper.PageInfo)1 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 MdcProduct (com.paascloud.provider.model.domain.MdcProduct)1 ProductDto (com.paascloud.provider.model.dto.ProductDto)1 OptGetUrlRequest (com.paascloud.provider.model.dto.oss.OptGetUrlRequest)1 MdcCategoryVo (com.paascloud.provider.model.vo.MdcCategoryVo)1 ProductDetailVo (com.paascloud.provider.model.vo.ProductDetailVo)1 ModelMapper (org.modelmapper.ModelMapper)1