更新dao返回值类型
This commit is contained in:
parent
9cf2698ec8
commit
5ef4df2d6f
@ -36,53 +36,59 @@ public class DataDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加字典变量数据
|
* 添加字典变量数据
|
||||||
|
*
|
||||||
* @param dataDictQo
|
* @param dataDictQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/insertDataDict")
|
@PostMapping("/insertDataDict")
|
||||||
public String insertDataDict(@RequestBody DataDictQo dataDictQo){
|
public String insertDataDict(@RequestBody DataDictQo dataDictQo) {
|
||||||
return dataDictService.insertDataDict(dataDictQo);
|
return dataDictService.insertDataDict(dataDictQo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询字典信息
|
* 动态多条件查询字典信息
|
||||||
* @param dictChineseName
|
*
|
||||||
* @param dictEnglishName
|
* @param inspectionItemName
|
||||||
|
* @param inspectionItemCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDataDict")
|
@GetMapping("/selectDataDict")
|
||||||
public String selectDataDict(@RequestParam("dictChineseName") String dictChineseName,
|
public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, @RequestParam("inspectionItemCode") String inspectionItemCode) {
|
||||||
@RequestParam("dictEnglishName") String dictEnglishName){
|
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<DataDict> dataDict = query.selectDataDict(dictChineseName, dictEnglishName);
|
List<DataDict> dataDict = query.selectDataDict(inspectionItemName, inspectionItemCode);
|
||||||
if(dataDict == null || dataDict.size() == 0){
|
if (dataDict == null || dataDict.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该型号类型的字典信息!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataDict, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询字典信息,用于数据回显,方便进行修改操作
|
* 根据id查询字典信息,用于数据回显,方便进行修改操作
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDataDictById")
|
@GetMapping("/selectDataDictById")
|
||||||
public String selectDataDictById(@RequestParam("id") Integer id){
|
public String selectDataDictById(@RequestParam("id") Integer id) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
DataDict dataDict = dataDictDao.findById(id).get();
|
Optional<DataDict> byId = dataDictDao.findById(id);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale);
|
if (byId.isEmpty()) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
|
||||||
|
}
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byId.get(), locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id修改字典信息
|
* 根据id修改字典信息
|
||||||
|
*
|
||||||
* @param dataDictUpdateQo
|
* @param dataDictUpdateQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateDict")
|
@PostMapping("/updateDict")
|
||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){
|
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getInspectionItemName());
|
dataDictDao.updateDict(dataDictUpdateQo.getId(), dataDictUpdateQo.getInspectionItemName());
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,11 @@ package com.xkrs.controller;
|
|||||||
import com.xkrs.dao.PictureDao;
|
import com.xkrs.dao.PictureDao;
|
||||||
import com.xkrs.encapsulation.PromptMessageEnum;
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.model.entity.PictureEntity;
|
import com.xkrs.model.entity.PictureEntity;
|
||||||
import com.xkrs.model.entity.SpecEntity;
|
|
||||||
import com.xkrs.model.qo.FileQo;
|
|
||||||
import com.xkrs.model.qo.PictureQo;
|
import com.xkrs.model.qo.PictureQo;
|
||||||
import com.xkrs.service.PictureService;
|
import com.xkrs.service.PictureService;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@ -18,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -45,18 +43,17 @@ public class PictureController {
|
|||||||
/**
|
/**
|
||||||
* 查询图片
|
* 查询图片
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectPicture")
|
@GetMapping("/selectPicture")
|
||||||
public String selectPicture(@RequestBody PictureQo pictureQo) throws IOException, InvalidFormatException {
|
public String selectPicture(@RequestParam("lotNo") String lotNo,
|
||||||
|
@RequestParam("machineNo") String machineNo,
|
||||||
|
@RequestParam("materialNo") String materialNo,
|
||||||
|
@RequestParam("modelNo") String modelNo,
|
||||||
|
@RequestParam("partNo") String partNo) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String lotNo = pictureQo.getLotNo();
|
Optional<PictureEntity> pictureEntity1 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo);
|
||||||
String machineNo = pictureQo.getMachineNo();
|
if (pictureEntity1.isEmpty()) {
|
||||||
String materialNo = pictureQo.getMaterialNo();
|
|
||||||
String modelNo = pictureQo.getModelNo();
|
|
||||||
String partNo = pictureQo.getPartNo();
|
|
||||||
PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get();
|
|
||||||
if (pictureEntity == null) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity1.get(), locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying;
|
|||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: XinYi Song
|
* @Author: XinYi Song
|
||||||
* @Date: 2022/1/20 15:23
|
* @Date: 2022/1/20 15:23
|
||||||
@ -25,7 +27,7 @@ public interface FileDao extends JpaRepository<FileEntity, Long>, JpaSpecificati
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true)
|
@Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true)
|
||||||
FileEntity selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
|
Optional<FileEntity> selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改模板上传信息
|
* 修改模板上传信息
|
||||||
|
@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -32,14 +33,8 @@ public class DataDictServiceImpl implements DataDictService {
|
|||||||
@Override
|
@Override
|
||||||
public String insertDataDict(DataDictQo dataDictQo) {
|
public String insertDataDict(DataDictQo dataDictQo) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
//DataDict byDictChineseName = dataDictDao.findByDictChineseName(dataDictQo.getDictChineseName());
|
Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode());
|
||||||
/*DataDict chineseName = dataDictDao.findByModelNumberAndBatchNumberAndMachineCodeAndDictProductNumberAndDictChineseName(dataDictQo.getModelNumber(), dataDictQo.getBatchNumber(), dataDictQo.getMachineCode(), dataDictQo.getDictProductNumber(), dataDictQo.getDictChineseName());
|
if (byInspectionItemCode.isPresent()) {
|
||||||
if(chineseName != null){
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale);
|
|
||||||
}*/
|
|
||||||
//DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
|
|
||||||
DataDict dataDict1 = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode()).get();
|
|
||||||
if (dataDict1 != null) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
DataDict dataDict = new DataDict();
|
DataDict dataDict = new DataDict();
|
||||||
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -30,15 +31,16 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加测量数据
|
* 添加测量数据
|
||||||
|
*
|
||||||
* @param dataSourceQo
|
* @param dataSourceQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String insertDataSource(DataSourceQo dataSourceQo) {
|
public String insertDataSource(DataSourceQo dataSourceQo) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
DataDict dataDict = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()).get();
|
Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode());
|
||||||
if(dataDict == null){
|
if (byInspectionItemCode.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "已存在该字典类型!", locale);
|
||||||
}
|
}
|
||||||
DataSource dataSource = new DataSource();
|
DataSource dataSource = new DataSource();
|
||||||
dataSource.setLotNo(dataSourceQo.getLotNo());
|
dataSource.setLotNo(dataSourceQo.getLotNo());
|
||||||
@ -49,6 +51,6 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||||||
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
|
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
|
||||||
dataSource.setInspectValue(dataSourceQo.getInspectValue());
|
dataSource.setInspectValue(dataSourceQo.getInspectValue());
|
||||||
dataSourceDao.save(dataSource);
|
dataSourceDao.save(dataSource);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -50,8 +47,8 @@ public class FileServiceImpl implements FileService {
|
|||||||
@Override
|
@Override
|
||||||
public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException {
|
public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FileEntity fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
Optional<FileEntity> fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
||||||
if (fileEntity != null) {
|
if (fileEntity.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale);
|
||||||
}
|
}
|
||||||
if (fileExcel == null) {
|
if (fileExcel == null) {
|
||||||
@ -79,11 +76,11 @@ public class FileServiceImpl implements FileService {
|
|||||||
@Override
|
@Override
|
||||||
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
|
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FileEntity entity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
Optional<FileEntity> fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
||||||
if (entity == null) {
|
if (fileEntity.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
|
||||||
}
|
}
|
||||||
String fileUploadPath = entity.getFileUploadPath();
|
String fileUploadPath = fileEntity.get().getFileUploadPath();
|
||||||
List<DataSource> dataSources = dataSourceDao.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
List<DataSource> dataSources = dataSourceDao.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
||||||
if (dataSources == null || dataSources.size() == 0) {
|
if (dataSources == null || dataSources.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
||||||
|
@ -13,6 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -30,8 +31,8 @@ public class PictureServiceImpl implements PictureService {
|
|||||||
String materialNo = pictureQo.getMaterialNo();
|
String materialNo = pictureQo.getMaterialNo();
|
||||||
String modelNo = pictureQo.getModelNo();
|
String modelNo = pictureQo.getModelNo();
|
||||||
String partNo = pictureQo.getPartNo();
|
String partNo = pictureQo.getPartNo();
|
||||||
PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get();
|
Optional<PictureEntity> pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo);
|
||||||
if (pictureEntity != null) {
|
if (pictureEntity2.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
String file = ExcelUploadUtil.memoryFile(pictureFile);
|
String file = ExcelUploadUtil.memoryFile(pictureFile);
|
||||||
|
@ -4,7 +4,6 @@ import com.xkrs.dao.DataDictDao;
|
|||||||
import com.xkrs.model.entity.DataDict;
|
import com.xkrs.model.entity.DataDict;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
@ -26,18 +25,19 @@ public class Query {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询字典信息
|
* 动态多条件查询字典信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<DataDict> selectDataDict(String dictChineseName,String dictEnglishName) {
|
public List<DataDict> selectDataDict(String inspectionItemName, String inspectionItemCode) {
|
||||||
Specification<DataDict> specification = new Specification<DataDict>() {
|
Specification<DataDict> specification = new Specification<DataDict>() {
|
||||||
@Override
|
@Override
|
||||||
public Predicate toPredicate(Root<DataDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
public Predicate toPredicate(Root<DataDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if(dictChineseName != null && !"".equals(dictChineseName)){
|
if (inspectionItemName != null && !"".equals(inspectionItemName)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("dictChineseName").as(String.class), dictChineseName));
|
list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName));
|
||||||
}
|
}
|
||||||
if(dictEnglishName != null && !"".equals(dictEnglishName)){
|
if (inspectionItemCode != null && !"".equals(inspectionItemCode)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("dictEnglishName").as(String.class), dictEnglishName));
|
list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode));
|
||||||
}
|
}
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
|
Loading…
Reference in New Issue
Block a user