| | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.vo.CompanyTree; |
| | | import com.doumee.dao.web.vo.CategoryVO; |
| | | import com.doumee.dao.web.vo.CategoryVOTree; |
| | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 分类信息表Service实现 |
| | |
| | | if(parent == null || Constants.equalsInteger(parent.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,父级信息不存在~"); |
| | | } |
| | | |
| | | if(Constants.equalsInteger(parent.getType(),Constants.FOUR) && parent.getParentId()!=null){ |
| | | //如果是二级CDA主题,自己为观察项 |
| | | category.setType(Constants.SIX); |
| | | } |
| | | idPath = parent.getIdPath(); |
| | | category.setIdPath(parent.getIdPath()+category.getId()+"/"); |
| | | category.setNamePath(parent.getNamePath()+"/"+category.getName()); |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<CategoryVO> getCategoryVOForGCXTree(Integer categoryId){ |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |
| | | .eq(Category::getType, Constants.FOUR) |
| | | .and( ms->ms.eq(Category::getId,categoryId).or().eq(Category::getParentId,categoryId)) |
| | | .orderByAsc(Category::getSortnum,Category::getId) |
| | | ); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryList)){ |
| | | categoryList.addAll( |
| | | categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |
| | | .eq(Category::getType, Constants.SIX) |
| | | .in(Category::getParentId,categoryList.stream().map(i->i.getId()).collect(Collectors.toList())) |
| | | .orderByAsc(Category::getSortnum,Category::getId)) |
| | | ); |
| | | } |
| | | List<CategoryVO> categoryVOList = new ArrayList<>(); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categoryList)){ |
| | | for (Category category:categoryList) { |
| | | CategoryVO categoryVO = new CategoryVO(); |
| | | categoryVO.setId(category.getId()); |
| | | categoryVO.setName(category.getName()); |
| | | categoryVO.setParentId(category.getParentId()); |
| | | categoryVOList.add(categoryVO); |
| | | } |
| | | CategoryVOTree treeBuild = new CategoryVOTree(categoryVOList); |
| | | categoryVOList = treeBuild.buildTree(); |
| | | } |
| | | return categoryVOList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CategoryVO> getCategoryVOList(Integer categoryType,Integer isRoot){ |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |