修改字典请求字段

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 dictEnglishName
* @param inspectionItemCode
* @param inspectionItemName
* @return
*/
@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();
List<QcInspectionItemDict> qcInspectionItemDict = query.selectDataDict(dictChineseName, dictEnglishName);
List<QcInspectionItemDict> qcInspectionItemDict = query.selectDataDict(inspectionItemCode, inspectionItemName);
if (qcInspectionItemDict == null || qcInspectionItemDict.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
}

View File

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

View File

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

View File

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