From 8bfcc19fe733958d52a90c10729296553f5c079d Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Fri, 11 Mar 2022 09:11:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A8=E6=A3=80=E8=A7=84?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/newpro/dao/QcSpecDao.java | 5 ++++ .../xkrs/newpro/service/QcSpecService.java | 3 ++ .../service/impl/QcSpecServiceImpl.java | 29 ++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) 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); } }