优质代码二
2022-10-21 10:53 ly772186472 阅读(17) 评论(0) 编辑 收藏 举报@Override public void deleteRelation(AttrGroupRelationVo vos) { //将我们接受数据的对象转为一个 entity List<AttrAttrgroupRelationEntity> list = Arrays.asList(vos).stream().map((item) -> { AttrAttrgroupRelationEntity entity = new AttrAttrgroupRelationEntity(); BeanUtils.copyProperties(item, entity); return entity; }).collect(Collectors.toList()); //批量的删关联表中的数据 attrAttrgroupRelationDao.removeBatchRelation(list); }
通过一个ID 获取其父级别 组装为 [1,2,4]
@Override public Long[] findCatelogPath(Long catelogId) { List<Long> paths = new ArrayList<>(); List<Long> parentPath = findParentPath(catelogId,paths); Collections.reverse(parentPath); return parentPath.toArray(new Long[parentPath.size()]); } private List<Long> findParentPath(Long catelogId, List<Long> paths) { paths.add(catelogId); CategoryEntity entity = this.getById(catelogId); if(entity.getParentCid() != 0){ findParentPath(entity.getParentCid(),paths); } return paths; }
调试代码多个不同 服务的事务 --
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
ES 优质代码:
远程调用---优质代码