package com.cirle.scientific.dao;


import com.cirle.scientific.po.QkjArticle;
import com.cirle.scientific.po.QkjMemberDorec;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
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 QkjMemberDorecDao extends PagingAndSortingRepository<QkjMemberDorec, Long>, JpaSpecificationExecutor<QkjMemberDorec> {

    @Query(value = "SELECT * FROM qkj_member_dorec WHERE mem_card=?1 and opr_type=?2 and obj_type=?3 and obj_id=?4 and TO_DAYS(NOW())=TO_DAYS(opr_time)",nativeQuery = true)
    List<QkjMemberDorec> findTodayLogs(String memCard, Integer oprType, Integer objType, Integer objId);

    @Query(value = "SELECT * FROM qkj_member_dorec WHERE mem_card=?1 and opr_type=?2 and url=?3 and TO_DAYS(NOW())=TO_DAYS(opr_time)",nativeQuery = true)
    List<QkjMemberDorec> findTodayLogs(String memCard, Integer oprType, String url);
}