package com.cirle.scientific.dao;


import com.cirle.scientific.po.QkjArticle;
import com.cirle.scientific.po.QkjConferenceRecord;
import com.cirle.scientific.po.QkjLive;
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 QkjConferenceRecordDao extends PagingAndSortingRepository<QkjConferenceRecord, Long>, JpaSpecificationExecutor<QkjConferenceRecord> {

    @Query(value = "select * from qkj_conference_record where mem_card=?2 and confer_id=?1 and status = 0 order by id asc", nativeQuery = true)
    List<QkjConferenceRecord> findByConferIdAndMemCard(Long conferId, String memCard);

    @Query(value = "SELECT r.* from qkj_conference_record r " +
                        "INNER JOIN qkj_conference_peopel p on r.people_id=p.id " +
                   "where r.confer_id=?1 and p.mobile=?2 and r.pay_status=1 and r.`status`=0", nativeQuery = true)
    QkjConferenceRecord findByConferIdAndMobile(Long conferId, String mobile);

    @Query(value = "select * from qkj_conference_record where mem_card=?2 and confer_id=?1 and pay_status=?3 and status=0  order by id asc", nativeQuery = true)
    List<QkjConferenceRecord> findByConferIdAndMemCard(Long conferId, String memCard, Integer payStatus);

    @Query(value = "select * from qkj_conference_record where order_id=?3 and mem_card=?2 and confer_id=?1 and status = 0 order by id asc", nativeQuery = true)
    List<QkjConferenceRecord> findByConferIdAndMemCardAndOrderId(Long conferId, String memCard, String orderId);


}