优化查询质检数据
This commit is contained in:
		| @@ -12,7 +12,7 @@ import java.util.Map; | ||||
| @Component | ||||
| public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> { | ||||
|  | ||||
|     @Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND mould_no = ?4 AND variety_no = ?5 ORDER BY create_time DESC", nativeQuery = true) | ||||
|     @Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% ORDER BY create_time DESC", nativeQuery = true) | ||||
|     List<Map<String, Object>> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo); | ||||
|  | ||||
| } | ||||
| @@ -11,7 +11,9 @@ import com.xkrs.newpro.utils.LocalStringUtils; | ||||
| import org.springframework.context.i18n.LocaleContextHolder; | ||||
|  | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
| import java.util.Locale; | ||||
| import java.util.Map; | ||||
|  | ||||
| import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; | ||||
|  | ||||
| @@ -61,8 +63,10 @@ public class QcSourceServiceImpl implements QcSourceService { | ||||
|         String materialNo = queryQo.getMaterialNo(); | ||||
|         String mouldNo = queryQo.getMouldNo(); | ||||
|         String varietyNo = queryQo.getVarietyNo(); | ||||
|         qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); | ||||
|  | ||||
|         List<Map<String, Object>> resultList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); | ||||
|         if (resultList == null || resultList.isEmpty()) { | ||||
|             return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验项目的信息!", locale); | ||||
|         } | ||||
|  | ||||
|         return null; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user