更新索引字段

This commit is contained in:
XinYi Song 2022-02-25 08:40:50 +08:00
parent fbae435de6
commit abfd819e5a
5 changed files with 40 additions and 10 deletions

View File

@ -9,9 +9,9 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xkrs</groupId>
<artifactId>industrial_measurement</artifactId>
<artifactId>WordAndExcel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>industrial_measurement</name>
<name>WordAndExcel</name>
<description>Demo project for Spring Boot</description>
<properties>

View File

@ -25,7 +25,7 @@ public interface DataSourceDao extends JpaRepository<DataSource,Long>, 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<DataSource,Long>, 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<Map<String,String>> selectAllSource();

View File

@ -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 + '\'' +
'}';

View File

@ -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;
}

View File

@ -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);