package com.ssj.dao.conch.conch.dao;

import com.ssj.bean.conch.conch.domain.IntegralDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author sh
 * @className IntegralDetailDao
 * @description TODO
 * @date 2020/6/2
 */
@Repository
public interface IntegralDetailDao extends JpaRepository<IntegralDetail,String> {

    @Query(nativeQuery = true,value = "select count(1) from scon_integral_detail where oper_type=3 and to_days(create_time)=to_days(now()) and state=1 and vip_id=?1 ")
    int findTodaySignData(String vipId);

    @Query(nativeQuery = true,value = "select count(1) from scon_integral_detail where oper_type=6 and start_time=?2 and state=1 and vip_id=?1 and detail_category=?3 ")
    int findThisWeekShare(String vipId, String beginTime,String subject);

    @Query(nativeQuery = true,value = "select count(1) from scon_integral_detail where oper_type=7 and report_month=?2 and state=1 and vip_id=?1 ")
    int findThisMonthShare(String vipId, String month);

    @Query(nativeQuery = true,value = "select count(1) from scon_integral_detail where oper_type=8 and detail_category=?2 and state=1 and vip_id=?1 ")
    int findPrizeShare(String vipId, String detailCategory);
}
