diff --git a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java index 715cce9..69b8429 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java @@ -12,4 +12,9 @@ public interface QcSpecDao extends JpaRepository, JpaSpec Optional findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo); + /** + * 更新质检规格 + */ + void updateQcSpecById(Integer id, String max, String mean, String min, String unit, String method, String standard, String remark); + } \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/service/QcSpecService.java b/src/main/java/com/xkrs/newpro/service/QcSpecService.java index de4fd10..d3fa01c 100644 --- a/src/main/java/com/xkrs/newpro/service/QcSpecService.java +++ b/src/main/java/com/xkrs/newpro/service/QcSpecService.java @@ -10,6 +10,9 @@ public interface QcSpecService { */ String insertQcSpec(QcSpecQoInsert insertQo); + /** + * 更新质检规格 + */ String updateQcSpec(QcSpecQoUpdate updateQo); } diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java index 9d2f4fb..a5bd36f 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java @@ -70,8 +70,35 @@ public class QcSpecServiceImpl implements QcSpecService { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } + /** + * 更新质检规格 + */ @Override public String updateQcSpec(QcSpecQoUpdate updateQo) { - return null; + + Integer id = updateQo.getId(); + String max = updateQo.getMax(); + String mean = updateQo.getMean(); + String min = updateQo.getMin(); + String unit = updateQo.getUnit(); + String method = updateQo.getMethod(); + String standard = updateQo.getStandard(); + String remark = updateQo.getRemark(); + + Optional entityById = qcSpecDao.findById(id); + if (entityById.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验规格,请先添加检验规格!", locale); + } + + qcSpecDao.updateQcSpecById(id, + LocalStringUtils.formatEmptyValue(max), + LocalStringUtils.formatEmptyValue(mean), + LocalStringUtils.formatEmptyValue(min), + LocalStringUtils.formatEmptyValue(unit), + LocalStringUtils.formatEmptyValue(method), + LocalStringUtils.formatEmptyValue(standard), + LocalStringUtils.formatEmptyValue(remark)); + + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } }