优化[删除标签接口]性能
This commit is contained in:
+3
-6
@@ -117,7 +117,7 @@ public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEn
|
|||||||
//编辑标签
|
//编辑标签
|
||||||
//不能设置上级标签为自己
|
//不能设置上级标签为自己
|
||||||
if (entity.getParentId().equals(entity.getId())) {
|
if (entity.getParentId().equals(entity.getId())) {
|
||||||
throw new AdcDaBaseException("不能设置上级标签为自身");
|
throw new AdcDaBaseException("不能设置上级标签为自身");
|
||||||
}
|
}
|
||||||
TreeLabelEntity treeLabelEntity = treeLabelDao.selectById(entity.getId());
|
TreeLabelEntity treeLabelEntity = treeLabelDao.selectById(entity.getId());
|
||||||
if (Objects.nonNull(treeLabelEntity)) {
|
if (Objects.nonNull(treeLabelEntity)) {
|
||||||
@@ -156,11 +156,8 @@ public class ITreeLabelServiceImpl extends ServiceImpl<TreeLabelDao, TreeLabelEn
|
|||||||
public boolean deleteById(String id) {
|
public boolean deleteById(String id) {
|
||||||
List<String> nodeAndChildrenIds = findNodeAndChildrenIds(getTreeLabelRoot(), id).stream().distinct().collect(Collectors.toList());
|
List<String> nodeAndChildrenIds = findNodeAndChildrenIds(getTreeLabelRoot(), id).stream().distinct().collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ReportLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
nodeAndChildrenIds.forEach(labelLd -> {
|
wrapper.in(ReportLabelEntity::getLabelId, nodeAndChildrenIds);
|
||||||
wrapper.eq(ReportLabelEntity::getLabelId, labelLd);
|
reportLabelDao.delete(wrapper);
|
||||||
reportLabelDao.delete(wrapper);
|
|
||||||
});
|
|
||||||
|
|
||||||
int i = treeLabelDao.deleteBatchIds(nodeAndChildrenIds);
|
int i = treeLabelDao.deleteBatchIds(nodeAndChildrenIds);
|
||||||
return i != 0;
|
return i != 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user