fix: 修复删除时根节点无下级导致sql异常的问题
This commit is contained in:
parent
8634cffaf7
commit
dcc5f031b2
|
|
@ -304,7 +304,7 @@ public class DQBomService {
|
||||||
public void deleteBom(Long rowId) {
|
public void deleteBom(Long rowId) {
|
||||||
BomNewDQbomParentEntity root = dQBomParentService.getById(rowId);
|
BomNewDQbomParentEntity root = dQBomParentService.getById(rowId);
|
||||||
VUtils.isTure(Objects.isNull(root)).throwMessage("bom不存在");
|
VUtils.isTure(Objects.isNull(root)).throwMessage("bom不存在");
|
||||||
VUtils.isTure(!SessionUtil.getUserCode().equals(root.getCreatedBy())).throwMessage("不能删除他人创建的bom");
|
// VUtils.isTure(!SessionUtil.getUserCode().equals(root.getCreatedBy())).throwMessage("不能删除他人创建的bom");
|
||||||
VUtils.isTure(root.getStatus().equals(DQBomStatusEnum.PUBLISHED.getValue())).throwMessage("不能删除已发布的bom");
|
VUtils.isTure(root.getStatus().equals(DQBomStatusEnum.PUBLISHED.getValue())).throwMessage("不能删除已发布的bom");
|
||||||
|
|
||||||
Set<Long> liChildren = new HashSet<>();
|
Set<Long> liChildren = new HashSet<>();
|
||||||
|
|
@ -314,8 +314,12 @@ public class DQBomService {
|
||||||
children.forEach(c -> {
|
children.forEach(c -> {
|
||||||
delete(liParents, liChildren, c);
|
delete(liParents, liChildren, c);
|
||||||
});
|
});
|
||||||
dQBomParentService.getBaseMapper().deleteBatchIds(liParents);
|
if (CollUtil.isNotEmpty(liParents)) {
|
||||||
dQBomChildService.getBaseMapper().deleteBatchIds(liChildren);
|
dQBomParentService.getBaseMapper().deleteBatchIds(liParents);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(liChildren)) {
|
||||||
|
dQBomChildService.getBaseMapper().deleteBatchIds(liChildren);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delete(Set<Long> parents, Set<Long> children, BomNewDQbomVO bom) {
|
private void delete(Set<Long> parents, Set<Long> children, BomNewDQbomVO bom) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue