package com.cirle.scientific.dao;

import com.cirle.scientific.po.QkjAuditing;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface QkjAuditingDao extends PagingAndSortingRepository<QkjAuditing, Long>, JpaSpecificationExecutor<QkjAuditing> {

    @Query(value = "SELECT a.* FROM qkj_auditing a WHERE a.mem_card=?1 and a.obj_type= ?2 and a.obj_id= ?3 ", nativeQuery = true)
    List<QkjAuditing> getQkjAuditingList(String memCard, Integer objType, Integer objId);

    @Modifying
    @Query(value = "delete from qkj_auditing where mem_card = ?1 and obj_type=?2 and obj_id=?3", nativeQuery = true)
    void deleteByMemberAndObjTypeAndOjbId(String memCard, Integer objType, Integer objId);


}
