fix: 优化逻辑

This commit is contained in:
tangwei 2026-07-06 18:10:59 +08:00
parent d30d873fa4
commit 85b4a1fdbd

View File

@ -74,7 +74,7 @@ public class MapLegendServiceImpl extends ServiceImpl<MsMaplegendBMapper, MsMapl
// 判断父级是否存在 // 判断父级是否存在
if (StrUtil.isBlank(legend.getParentId())) { if (StrUtil.isBlank(legend.getParentId())) {
this.removeById(id); // 逻辑删除 this.removeById(id); // 逻辑删除
return; continue;
} }
// 删除数据 // 删除数据
@ -85,7 +85,8 @@ public class MapLegendServiceImpl extends ServiceImpl<MsMaplegendBMapper, MsMapl
MsMaplegendB parent = this.getById(legend.getParentId()); MsMaplegendB parent = this.getById(legend.getParentId());
if (parent != null) { if (parent != null) {
LambdaQueryWrapper<MsMaplegendB> siblingWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MsMaplegendB> siblingWrapper = new LambdaQueryWrapper<>();
siblingWrapper.eq(MsMaplegendB::getParentId, parent.getId()); siblingWrapper.eq(MsMaplegendB::getParentId, parent.getId())
.eq(MsMaplegendB::getIsDeleted, 0);
List<MsMaplegendB> siblings = this.list(siblingWrapper); List<MsMaplegendB> siblings = this.list(siblingWrapper);
if (siblings.size() == 1 && id.equals(siblings.get(0).getId())) { if (siblings.size() == 1 && id.equals(siblings.get(0).getId())) {
MsMaplegendB updateParent = new MsMaplegendB(); MsMaplegendB updateParent = new MsMaplegendB();