修改SQL请求

This commit is contained in:
liuchengqian 2022-02-28 16:48:02 +08:00
parent d3b6998ea1
commit c82714f206
7 changed files with 16 additions and 13 deletions

View File

@ -2,8 +2,10 @@ package com.xkrs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = {"com.xkrs.model.entity"})
public class WordAndExcelApplication {
public static void main(String[] args) {

View File

@ -45,7 +45,7 @@ public class QcInspectionDataSourceController {
* 查询某一产品的测量信息
* 根据 批次号机器号物料号模具号零件号
*/
@GetMapping("/selectDataSource")
@PostMapping("/selectDataSource")
public String selectDataSource(@RequestBody QcInspectionDataSourceQo inspectionDataSourceQo) {
String lotNo = inspectionDataSourceQo.getLotNo();
String machineNo = inspectionDataSourceQo.getMachineNo();
@ -69,7 +69,7 @@ public class QcInspectionDataSourceController {
public String selectAllSource() {
Locale locale = LocaleContextHolder.getLocale();
List<QcInspectionDataSource> dataSourceAll = inspectionDataSourceDao.findAll();
if (dataSourceAll == null || dataSourceAll.isEmpty()) {
if (dataSourceAll.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSourceAll, locale);

View File

@ -21,7 +21,7 @@ public interface QcInspectionDataSourceDao extends JpaRepository<QcInspectionDat
* @param partNo 零件号
* @return
*/
@Query(value = "from QcInspectionDataSource where lotNo = ? and machineNo = ?and materialNo = ?and modelNo = ?and partNo = ?")
@Query(value = "select * from qc_inspection_data_source where lot_no = ? and machine_no = ? and material_no = ? and model_no = ? and part_no = ?",nativeQuery = true)
List<QcInspectionDataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
}

View File

@ -26,7 +26,7 @@ public interface QcInspectionFileDao extends JpaRepository<QcInspectionFile, Lon
* @param partNo 零件号
* @return
*/
@Query(value = "from QcInspectionFile where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
@Query(value = "select * from qc_inspection_file where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true)
List<QcInspectionFile> selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
/**
@ -40,7 +40,7 @@ public interface QcInspectionFileDao extends JpaRepository<QcInspectionFile, Lon
* @param templatePath 模版路径
*/
@Modifying(clearAutomatically = true)
@Query(value = "update QcInspectionFile set templatePath = ?6 where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
@Query(value = "update qc_inspection_file set template_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true)
void updateTemplatePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String templatePath);
/**
@ -54,8 +54,7 @@ public interface QcInspectionFileDao extends JpaRepository<QcInspectionFile, Lon
* @param filePath 文件路径
*/
@Modifying(clearAutomatically = true)
@Query(value = "update QcInspectionFile set filePath = ?6 where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
@Query(value = "update qc_inspection_file set file_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true)
void updateFilePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String filePath);
}

View File

@ -12,6 +12,7 @@ public interface QcInspectionItemDictDao extends JpaRepository<QcInspectionItemD
/**
* 通过检验项代码查询字典表的数据
*
* @param inspectionItemCode
* @return
*/
@ -19,6 +20,7 @@ public interface QcInspectionItemDictDao extends JpaRepository<QcInspectionItemD
/**
* 根据id查询字典信息
*
* @param id
* @return
*/
@ -26,10 +28,11 @@ public interface QcInspectionItemDictDao extends JpaRepository<QcInspectionItemD
/**
* 根据id修改字典的信息
*
* @param id
* @param inspectionItemName
*/
@Modifying(clearAutomatically=true)
@Query(value = "update QcInspectionItemDict set inspectionItemName = ?2 where id = ?1")
@Modifying(clearAutomatically = true)
@Query(value = "update qc_inspection_item_dict set inspection_item_name = ?2 where id = ?1", nativeQuery = true)
void updateDictById(Integer id, String inspectionItemName);
}

View File

@ -22,7 +22,7 @@ public interface QcInspectionPictureDao extends JpaRepository<QcInspectionPictur
* @param partNo 零件号
* @return
*/
@Query(value = "from QcInspectionPicture where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
@Query(value = "select * from qc_inspection_picture where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5",nativeQuery = true)
List<QcInspectionPicture> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
/**
@ -36,7 +36,7 @@ public interface QcInspectionPictureDao extends JpaRepository<QcInspectionPictur
* @param picturePath 图片路径
*/
@Modifying(clearAutomatically = true)
@Query(value = "update QcInspectionPicture set picturePath = ?6 where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
@Query(value = "update qc_inspection_picture set picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5",nativeQuery = true)
void updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String picturePath);
}

View File

@ -1,6 +1,5 @@
package com.xkrs.dao;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.entity.QcInspectionSpec;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -11,5 +10,5 @@ import java.util.List;
@Component
public interface QcInspectionSpecDao extends JpaRepository<QcInspectionSpec, Long>, JpaSpecificationExecutor<QcInspectionSpec> {
List<QcInspectionSpec> findByPartNoAndInspectionItemCode(String partNo,String inspectionItemCode);
List<QcInspectionSpec> findByPartNoAndInspectionItemCode(String partNo, String inspectionItemCode);
}