修改字典请求字段

This commit is contained in:
liuchengqian 2022-02-28 15:54:53 +08:00
parent 35fe6011e9
commit d3b6998ea1
4 changed files with 17 additions and 26 deletions

View File

@ -46,14 +46,14 @@ public class QcInspectionItemDictController {
/** /**
* 动态多条件查询字典信息 * 动态多条件查询字典信息
* *
* @param dictChineseName * @param inspectionItemCode
* @param dictEnglishName * @param inspectionItemName
* @return * @return
*/ */
@GetMapping("/selectDataDict") @GetMapping("/selectDataDict")
public String selectDataDict(@RequestParam("dictChineseName") String dictChineseName, @RequestParam("dictEnglishName") String dictEnglishName) { public String selectDataDict(@RequestParam("inspectionItemCode") String inspectionItemCode, @RequestParam("inspectionItemName") String inspectionItemName) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
List<QcInspectionItemDict> qcInspectionItemDict = query.selectDataDict(dictChineseName, dictEnglishName); List<QcInspectionItemDict> qcInspectionItemDict = query.selectDataDict(inspectionItemCode, inspectionItemName);
if (qcInspectionItemDict == null || qcInspectionItemDict.size() == 0) { if (qcInspectionItemDict == null || qcInspectionItemDict.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
} }

View File

@ -37,13 +37,6 @@ public class QcInspectionDataSourceServiceImpl implements QcInspectionDataSource
@Override @Override
public String insertDataSource(QcInspectionDataSourceQo inspectionDataSourceQo) { public String insertDataSource(QcInspectionDataSourceQo inspectionDataSourceQo) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
String lotNo = inspectionDataSourceQo.getLotNo();
String machineNo = inspectionDataSourceQo.getMachineNo();
String materialNo = inspectionDataSourceQo.getMaterialNo();
String modelNo = inspectionDataSourceQo.getModelNo();
String partNo = inspectionDataSourceQo.getPartNo();
String inspectionItemCode = inspectionDataSourceQo.getInspectionItemCode();
String inspectValue = inspectionDataSourceQo.getInspectValue();
QcInspectionItemDict byInspectionItemCode = inspectionItemDictDao.findByInspectionItemCode(inspectionDataSourceQo.getInspectionItemCode()); QcInspectionItemDict byInspectionItemCode = inspectionItemDictDao.findByInspectionItemCode(inspectionDataSourceQo.getInspectionItemCode());
if (byInspectionItemCode == null) { if (byInspectionItemCode == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale);
@ -52,13 +45,13 @@ public class QcInspectionDataSourceServiceImpl implements QcInspectionDataSource
if (inspectionDataSourceQo.getId() > 0) { if (inspectionDataSourceQo.getId() > 0) {
qcInspectionDataSource.setId(inspectionDataSourceQo.getId()); qcInspectionDataSource.setId(inspectionDataSourceQo.getId());
} }
qcInspectionDataSource.setLotNo(lotNo); qcInspectionDataSource.setLotNo(inspectionDataSourceQo.getLotNo());
qcInspectionDataSource.setMachineNo(machineNo); qcInspectionDataSource.setMachineNo(inspectionDataSourceQo.getMachineNo());
qcInspectionDataSource.setMaterialNo(materialNo); qcInspectionDataSource.setMaterialNo(inspectionDataSourceQo.getMaterialNo());
qcInspectionDataSource.setModelNo(modelNo); qcInspectionDataSource.setModelNo(inspectionDataSourceQo.getModelNo());
qcInspectionDataSource.setPartNo(partNo); qcInspectionDataSource.setPartNo(inspectionDataSourceQo.getPartNo());
qcInspectionDataSource.setInspectionItemCode(inspectionItemCode); qcInspectionDataSource.setInspectionItemCode(inspectionDataSourceQo.getInspectionItemCode());
qcInspectionDataSource.setInspectValue(inspectValue); qcInspectionDataSource.setInspectValue(inspectionDataSourceQo.getInspectValue());
inspectionDataSourceDao.save(qcInspectionDataSource); inspectionDataSourceDao.save(qcInspectionDataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
} }

View File

@ -64,9 +64,7 @@ public class QcInspectionFileServiceImpl implements QcInspectionFileService {
} }
String file = ExcelUploadUtil.memoryFile(fileExcel); String file = ExcelUploadUtil.memoryFile(fileExcel);
QcInspectionFile fileEntity = new QcInspectionFile(); QcInspectionFile fileEntity = new QcInspectionFile();
if (inspectionFileQo.getId() > 0) {
fileEntity.setId(inspectionFileQo.getId()); fileEntity.setId(inspectionFileQo.getId());
}
fileEntity.setLotNo(lotNo); fileEntity.setLotNo(lotNo);
fileEntity.setMachineNo(machineNo); fileEntity.setMachineNo(machineNo);
fileEntity.setMaterialNo(materialNo); fileEntity.setMaterialNo(materialNo);

View File

@ -28,16 +28,16 @@ public class Query {
* *
* @return * @return
*/ */
public List<QcInspectionItemDict> selectDataDict(String dictChineseName, String dictEnglishName) { public List<QcInspectionItemDict> selectDataDict(String inspectionItemCode, String inspectionItemName) {
Specification<QcInspectionItemDict> specification = new Specification<QcInspectionItemDict>() { Specification<QcInspectionItemDict> specification = new Specification<QcInspectionItemDict>() {
@Override @Override
public Predicate toPredicate(Root<QcInspectionItemDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) { public Predicate toPredicate(Root<QcInspectionItemDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> list = new ArrayList<>(); List<Predicate> list = new ArrayList<>();
if (dictChineseName != null && !"".equals(dictChineseName)) { if (inspectionItemCode != null && !"".equals(inspectionItemCode)) {
list.add(criteriaBuilder.equal(root.get("dictChineseName").as(String.class), dictChineseName)); list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode));
} }
if (dictEnglishName != null && !"".equals(dictEnglishName)) { if (inspectionItemName != null && !"".equals(inspectionItemName)) {
list.add(criteriaBuilder.equal(root.get("dictEnglishName").as(String.class), dictEnglishName)); list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName));
} }
Predicate[] predicates = new Predicate[list.size()]; Predicate[] predicates = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(predicates)); return criteriaBuilder.and(list.toArray(predicates));