fix(qms): 修复修改检测项定义同步模板子表内容时的空指针异常

- 在更新检验项目时,增加了对旧数据对象的非空判断
- 避免在没有找到对应旧数据时执行更新操作
master
zch 1 week ago
parent fd45857d93
commit 49f4e29764

@ -25,6 +25,7 @@ import org.dromara.qms.domain.QcInspectionItem;
import org.dromara.qms.mapper.QcInspectionItemMapper;
import org.dromara.qms.service.IQcInspectionItemService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.List;
@ -162,6 +163,7 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService {
// 创建一个新的QcTemplateItemBo对象
QcTemplateItem qcTemplateItem = new QcTemplateItem();
QcTemplateItemVo oldQcTemplateItem = qcTemplateItemMapper.selectQcTemplateItemByItemId(update.getItemId());
if( !ObjectUtils.isEmpty(oldQcTemplateItem)){
oldQcTemplateItem.setItemCode(update.getItemCode());
oldQcTemplateItem.setItemName(update.getItemName());
oldQcTemplateItem.setInspectionItemCode(update.getItemCode());
@ -181,6 +183,7 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService {
BeanUtils.copyProperties(oldQcTemplateItem, qcTemplateItem);
qcTemplateItemMapper.updateById(qcTemplateItem);
}
}
/**

Loading…
Cancel
Save