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;
}
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);
}
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);
}
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;
}
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);
}
Aggregations