package com.xkrs.newpro.dao; import com.xkrs.newpro.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; @Component public interface QcItemDao extends JpaRepository, JpaSpecificationExecutor { Optional findByNo(String no); /** * 更新检验项目名称 */ @Modifying(clearAutomatically = true) @Query(value = "UPDATE qc_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true) void updateNameById(Integer id, String updateTime, String name); /** * 查询检验项目 */ @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) List> queryQcItem(String no, String name); }