diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionItemServiceImpl.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionItemServiceImpl.java index bd87613..347f369 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionItemServiceImpl.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionItemServiceImpl.java @@ -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,24 +163,26 @@ public class QcInspectionItemServiceImpl implements IQcInspectionItemService { // 创建一个新的QcTemplateItemBo对象 QcTemplateItem qcTemplateItem = new QcTemplateItem(); QcTemplateItemVo oldQcTemplateItem = qcTemplateItemMapper.selectQcTemplateItemByItemId(update.getItemId()); - oldQcTemplateItem.setItemCode(update.getItemCode()); - oldQcTemplateItem.setItemName(update.getItemName()); - oldQcTemplateItem.setInspectionItemCode(update.getItemCode()); - oldQcTemplateItem.setInspectionItemName(update.getItemName()); - oldQcTemplateItem.setInspectionPosition(update.getInspectionPosition()); - oldQcTemplateItem.setCategoryName(update.getCategoryName()); - oldQcTemplateItem.setInspectionType(update.getInspectionType()); - oldQcTemplateItem.setDetectType(update.getDetectType()); - oldQcTemplateItem.setControlType(update.getControlType()); - oldQcTemplateItem.setStandardValue(update.getStandardValue()); - oldQcTemplateItem.setUpperLimit(update.getUpperLimit()); - oldQcTemplateItem.setLowerLimit(update.getLowerLimit()); - oldQcTemplateItem.setSpecName(update.getSpecName()); - oldQcTemplateItem.setSpecUpper(update.getSpecUpper()); - oldQcTemplateItem.setSpecLower(update.getSpecLower()); - oldQcTemplateItem.setDescription(update.getDescription()); - BeanUtils.copyProperties(oldQcTemplateItem, qcTemplateItem); - qcTemplateItemMapper.updateById(qcTemplateItem); + if( !ObjectUtils.isEmpty(oldQcTemplateItem)){ + oldQcTemplateItem.setItemCode(update.getItemCode()); + oldQcTemplateItem.setItemName(update.getItemName()); + oldQcTemplateItem.setInspectionItemCode(update.getItemCode()); + oldQcTemplateItem.setInspectionItemName(update.getItemName()); + oldQcTemplateItem.setInspectionPosition(update.getInspectionPosition()); + oldQcTemplateItem.setCategoryName(update.getCategoryName()); + oldQcTemplateItem.setInspectionType(update.getInspectionType()); + oldQcTemplateItem.setDetectType(update.getDetectType()); + oldQcTemplateItem.setControlType(update.getControlType()); + oldQcTemplateItem.setStandardValue(update.getStandardValue()); + oldQcTemplateItem.setUpperLimit(update.getUpperLimit()); + oldQcTemplateItem.setLowerLimit(update.getLowerLimit()); + oldQcTemplateItem.setSpecName(update.getSpecName()); + oldQcTemplateItem.setSpecUpper(update.getSpecUpper()); + oldQcTemplateItem.setSpecLower(update.getSpecLower()); + oldQcTemplateItem.setDescription(update.getDescription()); + BeanUtils.copyProperties(oldQcTemplateItem, qcTemplateItem); + qcTemplateItemMapper.updateById(qcTemplateItem); + } }