From 66f89161b834d6457858ea758b851df62a46a82d Mon Sep 17 00:00:00 2001 From: yf001217 <834502597@qq.com> Date: Sat, 18 Apr 2026 19:32:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E5=87=86=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E3=80=81=E4=BE=9B=E5=BA=94=E5=95=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QmsStandardDefectControllerService.java | 45 ------------------- .../pojo/qo/QmsStandardDefectUpdateQO.java | 11 ----- .../mapper/QmsSupplierSqeMapMapper.xml | 16 ++----- 3 files changed, 3 insertions(+), 69 deletions(-) diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsStandardDefectControllerService.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsStandardDefectControllerService.java index e264537a..5011c4f9 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsStandardDefectControllerService.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsStandardDefectControllerService.java @@ -147,37 +147,6 @@ public class QmsStandardDefectControllerService { updateChain.set(QmsStandardDefect::getRemark, request.getRemark()); } - // 父级变更:仅当 changeParent=true 时处理 - boolean parentChanged = false; - Long oldParentId = exist.getParentId(); - if (Boolean.TRUE.equals(request.getChangeParent())) { - Long newParentId = null; - String newParentCode = null; - Short newLevel; - - if (StrUtil.isBlank(request.getParentName())) { - // 改为顶级 - newLevel = 1; - } else { - QmsStandardDefect newParent = getParentByName(request.getParentName()); - newParentId = newParent.getId(); - newParentCode = newParent.getDefectCode(); - newLevel = (short) (newParent.getLevel() + 1); - // 新父级若是叶子节点,改为非叶子 - if (Boolean.TRUE.equals(newParent.getIsLeaf())) { - defectService.lambdaUpdate() - .eq(QmsStandardDefect::getId, newParent.getId()) - .set(QmsStandardDefect::getIsLeaf, false) - .update(); - } - } - - parentChanged = !Objects.equals(oldParentId, newParentId); - updateChain.set(QmsStandardDefect::getParentId, newParentId) - .set(QmsStandardDefect::getParentCode, newParentCode) - .set(QmsStandardDefect::getLevel, newLevel); - } - updateChain.set(QmsStandardDefect::getUpdateBy, operator) .set(QmsStandardDefect::getUpdateTime, now) .update(); @@ -186,20 +155,6 @@ public class QmsStandardDefectControllerService { if (Objects.nonNull(request.getEnable())) { updateDescendantsEnable(request.getId(), request.getEnable(), operator, now); } - - // 若父级变更,检查旧父级是否还有未删除子节点,没有则恢复 isLeaf=true - if (parentChanged && Objects.nonNull(oldParentId)) { - boolean hasChildren = defectService.lambdaQuery() - .eq(QmsStandardDefect::getParentId, oldParentId) - .eq(QmsStandardDefect::getDeleted, false) - .exists(); - if (!hasChildren) { - defectService.lambdaUpdate() - .eq(QmsStandardDefect::getId, oldParentId) - .set(QmsStandardDefect::getIsLeaf, true) - .update(); - } - } } // ========================= 删除(逻辑删除) ========================= diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmsStandardDefectUpdateQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmsStandardDefectUpdateQO.java index 0f24dcb6..cbbb10b6 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmsStandardDefectUpdateQO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmsStandardDefectUpdateQO.java @@ -15,17 +15,6 @@ public class QmsStandardDefectUpdateQO { @NotNull(message = "ID不能为空") private Long id; - /** - * 父级缺陷名称(传 null 表示顶级;变更父级时自动处理旧父级 isLeaf;不传则不修改父级) - */ - private String parentName; - - /** - * 是否修改父级(true=修改父级关系,false=不修改) - * 用于区分"不传parentName"是顶级还是不修改 - */ - private Boolean changeParent; - /** * 缺陷代码(不传则不修改) */ diff --git a/nflg-wms-repository/src/main/resources/mapper/QmsSupplierSqeMapMapper.xml b/nflg-wms-repository/src/main/resources/mapper/QmsSupplierSqeMapMapper.xml index b9d32b5a..abd19a14 100644 --- a/nflg-wms-repository/src/main/resources/mapper/QmsSupplierSqeMapMapper.xml +++ b/nflg-wms-repository/src/main/resources/mapper/QmsSupplierSqeMapMapper.xml @@ -5,24 +5,13 @@