2022-03-11 17:30:56 +08:00
|
|
|
package com.xkrs.dao;
|
2022-03-10 17:11:37 +08:00
|
|
|
|
2022-03-10 17:43:05 +08:00
|
|
|
import com.xkrs.newpro.model.entity.QcItemEntity;
|
2022-03-10 17:11:37 +08:00
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
2022-03-11 09:28:04 +08:00
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
|
import org.springframework.data.jpa.repository.Query;
|
2022-03-10 17:11:37 +08:00
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
2022-03-11 10:28:36 +08:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2022-03-10 20:09:26 +08:00
|
|
|
import java.util.Optional;
|
|
|
|
|
2022-03-11 15:37:06 +08:00
|
|
|
/**
|
|
|
|
* 检验项目Dao
|
|
|
|
*/
|
2022-03-10 17:11:37 +08:00
|
|
|
@Component
|
2022-03-11 08:58:20 +08:00
|
|
|
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
|
2022-03-10 20:09:26 +08:00
|
|
|
|
|
|
|
Optional<QcItemEntity> findByNo(String no);
|
|
|
|
|
2022-03-11 08:58:20 +08:00
|
|
|
/**
|
2022-03-11 11:58:38 +08:00
|
|
|
* 更新检验项目名称
|
2022-03-11 08:58:20 +08:00
|
|
|
*/
|
2022-03-11 09:28:04 +08:00
|
|
|
@Modifying(clearAutomatically = true)
|
2022-03-11 10:28:36 +08:00
|
|
|
@Query(value = "UPDATE qc_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true)
|
2022-03-11 09:28:04 +08:00
|
|
|
void updateNameById(Integer id, String updateTime, String name);
|
2022-03-11 08:58:20 +08:00
|
|
|
|
2022-03-11 10:28:36 +08:00
|
|
|
/**
|
2022-03-11 11:58:38 +08:00
|
|
|
* 查询检验项目
|
2022-03-11 10:28:36 +08:00
|
|
|
*/
|
2022-03-11 13:52:27 +08:00
|
|
|
@Query(value = "SELECT id, no, name, type FROM qc_item WHERE no LIKE %?1% AND name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
2022-03-11 10:28:36 +08:00
|
|
|
List<Map<String, Object>> queryQcItem(String no, String name);
|
2022-03-10 17:11:37 +08:00
|
|
|
}
|