35 lines
1.2 KiB
Java
35 lines
1.2 KiB
Java
package com.xkrs.dao;
|
|
|
|
import com.xkrs.model.entity.QcItemEntity;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Optional;
|
|
|
|
/**
|
|
* 检验项目Dao
|
|
*/
|
|
@Component
|
|
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
|
|
|
|
Optional<QcItemEntity> findByQcItemNo(String no);
|
|
|
|
/**
|
|
* 更新检验项目名称
|
|
*/
|
|
@Modifying(clearAutomatically = true)
|
|
@Query(value = "UPDATE qc_item SET update_time = ?2, qc_item_name = ?3 WHERE id = ?1", nativeQuery = true)
|
|
void updateNameById(Integer id, String updateTime, String name);
|
|
|
|
/**
|
|
* 查询检验项目
|
|
*/
|
|
@Query(value = "SELECT id AS id, qc_item_no AS no, qc_item_name AS name, qc_item_type AS type FROM qc_item WHERE qc_item_no LIKE %?1% AND qc_item_name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
|
List<Map<String, Object>> queryQcItem(String no, String name);
|
|
}
|