From 0a16db2bd18c48e2119cc917a69879f3b4f9b96e Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 17:02:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/WordAndExcelApplication.java | 2 +- .../QcInspectionSpecController.java | 2 ++ .../impl/QcInspectionSpecServiceImpl.java | 32 ++++++------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/xkrs/WordAndExcelApplication.java b/src/main/java/com/xkrs/WordAndExcelApplication.java index ab63071..ed97437 100644 --- a/src/main/java/com/xkrs/WordAndExcelApplication.java +++ b/src/main/java/com/xkrs/WordAndExcelApplication.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@ComponentScan(basePackages = {"com.xkrs.model.entity"}) +//@ComponentScan(basePackages = {"com.xkrs.model.entity", "com.xkrs.controller", "com.xkrs.service"}) public class WordAndExcelApplication { public static void main(String[] args) { diff --git a/src/main/java/com/xkrs/controller/QcInspectionSpecController.java b/src/main/java/com/xkrs/controller/QcInspectionSpecController.java index 4e5a0c1..499b6ba 100644 --- a/src/main/java/com/xkrs/controller/QcInspectionSpecController.java +++ b/src/main/java/com/xkrs/controller/QcInspectionSpecController.java @@ -9,6 +9,7 @@ import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; @@ -16,6 +17,7 @@ import java.util.Locale; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; +@RestController public class QcInspectionSpecController { @Resource diff --git a/src/main/java/com/xkrs/service/impl/QcInspectionSpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/QcInspectionSpecServiceImpl.java index b2c70b1..41caee4 100644 --- a/src/main/java/com/xkrs/service/impl/QcInspectionSpecServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/QcInspectionSpecServiceImpl.java @@ -3,7 +3,6 @@ package com.xkrs.service.impl; import com.xkrs.dao.QcInspectionItemDictDao; import com.xkrs.dao.QcInspectionSpecDao; import com.xkrs.encapsulation.PromptMessageEnum; -import com.xkrs.model.entity.QcInspectionItemDict; import com.xkrs.model.entity.QcInspectionSpec; import com.xkrs.model.qo.QcInspectionSpecQo; import com.xkrs.service.QcInspectionSpecService; @@ -31,33 +30,20 @@ public class QcInspectionSpecServiceImpl implements QcInspectionSpecService { */ @Override public String insertSpec(QcInspectionSpecQo inspectionSpecQo) { - String partNo = inspectionSpecQo.getPartNo(); - String inspectionItemCode = inspectionSpecQo.getInspectionItemCode(); - String max = inspectionSpecQo.getMax(); - String mean = inspectionSpecQo.getMean(); - String min = inspectionSpecQo.getMin(); - String unit = inspectionSpecQo.getUnit(); - String inspectionMethod = inspectionSpecQo.getInspectionMethod(); - String inspectionStandard = inspectionSpecQo.getInspectionStandard(); - String remark = inspectionSpecQo.getRemark(); Locale locale = LocaleContextHolder.getLocale(); - QcInspectionItemDict byInspectionItemCode = inspectionItemDictDao.findByInspectionItemCode(inspectionSpecQo.getInspectionItemCode()); - if (byInspectionItemCode == null) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale); - } QcInspectionSpec inspectionSpec = new QcInspectionSpec(); if (inspectionSpecQo.getId() > 0) { inspectionSpec.setId(inspectionSpecQo.getId()); } - inspectionSpec.setPartNo(partNo); - inspectionSpec.setInspectionItemCode(inspectionItemCode); - inspectionSpec.setMax(max); - inspectionSpec.setMean(mean); - inspectionSpec.setMin(min); - inspectionSpec.setUnit(unit); - inspectionSpec.setInspectionMethod(inspectionMethod); - inspectionSpec.setInspectionStandard(inspectionStandard); - inspectionSpec.setRemark(remark); + inspectionSpec.setPartNo(inspectionSpecQo.getPartNo()); + inspectionSpec.setInspectionItemCode(inspectionSpecQo.getInspectionItemCode()); + inspectionSpec.setMax(inspectionSpecQo.getMax()); + inspectionSpec.setMean(inspectionSpecQo.getMean()); + inspectionSpec.setMin(inspectionSpecQo.getMin()); + inspectionSpec.setUnit(inspectionSpecQo.getUnit()); + inspectionSpec.setInspectionMethod(inspectionSpecQo.getInspectionMethod()); + inspectionSpec.setInspectionStandard(inspectionSpecQo.getInspectionStandard()); + inspectionSpec.setRemark(inspectionSpecQo.getRemark()); inspectionSpecDao.save(inspectionSpec); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); }