| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mzl.flower.base.Node; |
| | | import com.mzl.flower.base.cache.CategoryPriceCacheClient; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | |
| | | public Long updateCategory(FlowerCategoryUpdateDTO dto){ |
| | | Long id = dto.getId(); |
| | | FlowerCategory g = categoryMapper.selectById(id); |
| | | |
| | | Boolean shown = g.getShown(); |
| | | BeanUtils.copyProperties(dto, g); |
| | | g.setShown(shown); |
| | | g.setSortBy(dto.getSortBy() == null ? 0 : dto.getSortBy()); |
| | | g.update(SecurityUtils.getUserId()); |
| | | |
| | |
| | | public List<FlowerCategoryTreeDTO> selectCategoryTree(FlowerCategoryQueryDTO dto) { |
| | | List<FlowerCategoryTreeDTO> treeList = categoryMapper.selectTreeList(dto); |
| | | treeList = (List<FlowerCategoryTreeDTO>) TreeBuilderUtil.buildListToTree(treeList); |
| | | if(treeList != null && treeList.size() > 0){ |
| | | for(FlowerCategoryTreeDTO t : treeList){ |
| | | List<Node> cLs = t.getChildren(); |
| | | String ll = t.getLevelLimit(); |
| | | if(cLs != null && cLs.size() > 0){ |
| | | for(Node c : cLs){ |
| | | FlowerCategoryTreeDTO cc = (FlowerCategoryTreeDTO)c; |
| | | cc.setLevelLimit(ll); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return treeList; |
| | | } |
| | | |