| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.vo.CompanyTree; |
| | | import com.doumee.dao.web.vo.CategoryVO; |
| | | import com.doumee.dao.web.vo.CategoryVOTree; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.Managers; |
| | | import com.doumee.dao.business.vo.CategoryTree; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | .eq(category.getType() != null, Category::getType, category.getType()) |
| | | .eq(category.getParentId() != null, Category::getParentId, category.getParentId()) |
| | | .eq(category.getNamePath() != null, Category::getNamePath, category.getNamePath()) |
| | | .isNull(category.getIsRoot() != null &&category.getIsRoot().equals(Constants.ONE), Category::getParentId) |
| | | .eq(category.getIdPath() != null, Category::getIdPath, category.getIdPath()) |
| | | .orderByAsc( Category::getSortnum); |
| | | return categoryMapper.selectJoinList(Category.class,queryWrapper); |
| | |
| | | return companyList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CategoryVO> getCategoryVOTree(String categoryType){ |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |
| | | .in(Objects.nonNull(categoryType),Category::getType,categoryType.split(",")) |
| | | .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){ |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().lambda() |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |
| | | .eq(Objects.nonNull(categoryType),Category::getType,categoryType) |
| | | .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); |
| | | } |
| | | } |
| | | return categoryVOList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |