Merge branch 'qms/yf' into qms/develop

This commit is contained in:
yf001217 2026-04-18 17:48:41 +08:00
commit 5f8eb1058a
3 changed files with 16 additions and 9 deletions

View File

@ -44,7 +44,7 @@ public class QmsStandardDefectControllerService {
/**
* 新增缺陷
* 父级通过 parentName 查询自动赋值 parentId/parentCode/level
* 前端传 parentId自动赋值 parentCode/level
* 若父级 isLeaf=true则将父级 isLeaf 改为 false
* sort 在同父级下自增
*/
@ -73,7 +73,7 @@ public class QmsStandardDefectControllerService {
.setUpdateBy(operator)
.setUpdateTime(now);
if (StrUtil.isBlank(request.getParentName())) {
if (Objects.isNull(request.getParentId())) {
// 顶级节点
entity.setParentId(null)
.setParentCode(null)
@ -81,8 +81,11 @@ public class QmsStandardDefectControllerService {
short sort = calcNextSort(null);
entity.setSort(sort).setIsLeaf(true);
} else {
// 查询父级
QmsStandardDefect parent = getParentByName(request.getParentName());
// ID 查询父级
QmsStandardDefect parent = defectService.getById(request.getParentId());
if (Objects.isNull(parent) || Boolean.TRUE.equals(parent.getDeleted())) {
throw new NflgException(STATE.BusinessError, "父级缺陷不存在ID" + request.getParentId());
}
entity.setParentId(parent.getId())
.setParentCode(parent.getDefectCode())
.setLevel((short) (parent.getLevel() + 1));
@ -330,7 +333,11 @@ public class QmsStandardDefectControllerService {
continue;
}
QmsStandardDefectAddQO qo = new QmsStandardDefectAddQO();
qo.setParentName(dto.getParentName());
// 导入时通过父级名称查出 parentId
if (StrUtil.isNotBlank(dto.getParentName())) {
QmsStandardDefect parent = getParentByName(dto.getParentName());
qo.setParentId(parent.getId());
}
qo.setDefectCode(dto.getDefectCode());
qo.setDefectName(dto.getDefectName());
qo.setEnable(!"禁用".equals(dto.getStateText()));

View File

@ -11,9 +11,9 @@ import lombok.Data;
public class QmsStandardDefectAddQO {
/**
* 父级缺陷名称查询后自动赋值 parentId/parentCode顶级时传 null
* 父级缺陷ID顶级时传 null
*/
private String parentName;
private Long parentId;
/**
* 缺陷代码

View File

@ -14,7 +14,7 @@
m.material_category_code_path_name AS materialCategoryCodePathName,
m.material_desc AS materialDesc,
m.drawing_no_ver AS drawingNoVer,
s.version_no AS versionNo,
s.version AS versionNo,
STRING_AGG(DISTINCT iqe_user.user_name, ',') AS iqeName,
s.inspection_cycle AS inspectionCycle,
s.packaging_method_id AS packagingMethodId,
@ -42,7 +42,7 @@
</if>
</where>
GROUP BY s.id, m.material_no, m.material_category_code_path_name, m.material_desc, m.drawing_no_ver,
s.version_no, s.inspection_cycle, s.packaging_method_id, s.is_enabled, s.publish_status,
s.version, s.inspection_cycle, s.packaging_method_id, s.is_enabled, s.publish_status,
s.publish_user_name, s.publish_time, s.create_user_name, s.create_time, s.update_user_name, s.update_time
ORDER BY s.id DESC
</select>