fix: 修复删除时根节点无下级导致sql异常的问题
This commit is contained in:
parent
8634cffaf7
commit
dcc5f031b2
|
|
@ -304,7 +304,7 @@ public class DQBomService {
|
|||
public void deleteBom(Long rowId) {
|
||||
BomNewDQbomParentEntity root = dQBomParentService.getById(rowId);
|
||||
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");
|
||||
|
||||
Set<Long> liChildren = new HashSet<>();
|
||||
|
|
@ -314,9 +314,13 @@ public class DQBomService {
|
|||
children.forEach(c -> {
|
||||
delete(liParents, liChildren, c);
|
||||
});
|
||||
if (CollUtil.isNotEmpty(liParents)) {
|
||||
dQBomParentService.getBaseMapper().deleteBatchIds(liParents);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(liChildren)) {
|
||||
dQBomChildService.getBaseMapper().deleteBatchIds(liChildren);
|
||||
}
|
||||
}
|
||||
|
||||
private void delete(Set<Long> parents, Set<Long> children, BomNewDQbomVO bom) {
|
||||
children.add(bom.getRowId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue