From abfd819e5a7d466e507df8e023e7a445fa06140e Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Fri, 25 Feb 2022 08:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B4=A2=E5=BC=95=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +-- src/main/java/com/xkrs/dao/DataSourceDao.java | 4 +-- .../com/xkrs/model/entity/DataSource.java | 25 +++++++++++++++---- .../java/com/xkrs/model/qo/DataSourceQo.java | 15 ++++++++++- .../service/impl/DataSourceServiceImpl.java | 2 ++ 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index c248a8a..2458a4b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,9 @@ com.xkrs - industrial_measurement + WordAndExcel 0.0.1-SNAPSHOT - industrial_measurement + WordAndExcel Demo project for Spring Boot diff --git a/src/main/java/com/xkrs/dao/DataSourceDao.java b/src/main/java/com/xkrs/dao/DataSourceDao.java index 1d41ab5..eeec162 100644 --- a/src/main/java/com/xkrs/dao/DataSourceDao.java +++ b/src/main/java/com/xkrs/dao/DataSourceDao.java @@ -25,7 +25,7 @@ public interface DataSourceDao extends JpaRepository, JpaSpecif * @return */ @Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " + - "ds.data_machine_code datamachinecode, ds.product_number productnumber, dd.dict_chinese_name chinesename, " + + "ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename, " + "ds.data_name dataname,ds.numerical_value numericalvalue " + "from data_dict dd,data_source ds where ds.data_name = dd.dict_english_name and " + "ds.data_model_number = :dataModelNumber and ds.data_batch_number = :dataBatchNumber and " + @@ -57,7 +57,7 @@ public interface DataSourceDao extends JpaRepository, JpaSpecif * @return */ @Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " + - "ds.data_machine_code datamachinecode, ds.product_number productnumber, dd.dict_chinese_name chinesename," + + "ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename," + "ds.data_name dataname,ds.numerical_value numericalvalue from data_dict dd,data_source ds " + "where ds.data_name = dd.dict_english_name",nativeQuery = true) List> selectAllSource(); diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java index 1480bd7..4ab1966 100644 --- a/src/main/java/com/xkrs/model/entity/DataSource.java +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -18,29 +18,34 @@ public class DataSource { private Integer id; /** - * 机种号 + * 机种 */ @Column(length = 32, columnDefinition = "varchar(32)") private String dataModelNumber; /** - * 批次号 + * 成型批号 */ @Column(length = 32, columnDefinition = "varchar(32)") private String dataBatchNumber; /** - * 机器号 + * 机器 */ @Column(length = 32, columnDefinition = "varchar(32)") private String dataMachineCode; /** - * 产品编号 + * 模具 */ @Column(length = 32, columnDefinition = "varchar(32)") private String productNumber; + /** + * 材料 + */ + private String material; + /** * 变量值 */ @@ -56,12 +61,13 @@ public class DataSource { public DataSource() { } - public DataSource(Integer id, String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber, String dataName, String numericalValue) { + public DataSource(Integer id, String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber, String material, String dataName, String numericalValue) { this.id = id; this.dataModelNumber = dataModelNumber; this.dataBatchNumber = dataBatchNumber; this.dataMachineCode = dataMachineCode; this.productNumber = productNumber; + this.material = material; this.dataName = dataName; this.numericalValue = numericalValue; } @@ -106,6 +112,14 @@ public class DataSource { this.productNumber = productNumber; } + public String getMaterial() { + return material; + } + + public void setMaterial(String material) { + this.material = material; + } + public String getDataName() { return dataName; } @@ -130,6 +144,7 @@ public class DataSource { ", dataBatchNumber='" + dataBatchNumber + '\'' + ", dataMachineCode='" + dataMachineCode + '\'' + ", productNumber='" + productNumber + '\'' + + ", material='" + material + '\'' + ", dataName='" + dataName + '\'' + ", numericalValue='" + numericalValue + '\'' + '}'; diff --git a/src/main/java/com/xkrs/model/qo/DataSourceQo.java b/src/main/java/com/xkrs/model/qo/DataSourceQo.java index 9128b99..6e34209 100644 --- a/src/main/java/com/xkrs/model/qo/DataSourceQo.java +++ b/src/main/java/com/xkrs/model/qo/DataSourceQo.java @@ -30,11 +30,16 @@ public class DataSourceQo { private String dataMachineCode; /** - * 产品编号 + * 模具 */ @NotBlank(message = "{DataSource.productNumber.blank}",groups={DataSourceQoInsert.class}) private String productNumber; + /** + * 材料 + */ + private String material; + /** * 变量值 */ @@ -75,6 +80,14 @@ public class DataSourceQo { return productNumber; } + public String getMaterial() { + return material; + } + + public void setMaterial(String material) { + this.material = material; + } + public void setProductNumber(String productNumber) { this.productNumber = productNumber; } diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index 8c775f5..f17a4d2 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -38,6 +38,7 @@ public class DataSourceServiceImpl implements DataSourceService { Locale locale = LocaleContextHolder.getLocale(); DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getDataName()); if(byDictEnglishName == null){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale); } /*DataSource byDataName = dataSourceDao.findByDataName(dataSourceQo.getDataName()); @@ -49,6 +50,7 @@ public class DataSourceServiceImpl implements DataSourceService { dataSource.setDataBatchNumber(dataSourceQo.getDataBatchNumber()); dataSource.setDataMachineCode(dataSourceQo.getDataMachineCode()); dataSource.setProductNumber(dataSourceQo.getProductNumber()); + dataSource.setMaterial(dataSourceQo.getMaterial()); dataSource.setDataName(dataSourceQo.getDataName()); dataSource.setNumericalValue(dataSourceQo.getNumericalValue()); dataSourceDao.save(dataSource);