package com.haha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haha.entity.DistributorMonthlyReport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DistributorMonthlyReportMapper extends BaseMapper<DistributorMonthlyReport> {

    @Select("SELECT * FROM t_distributor_monthly_report WHERE year_month = #{yearMonth} ORDER BY total_commission DESC")
    List<DistributorMonthlyReport> selectByMonth(@Param("yearMonth") String yearMonth);

    @Select("SELECT * FROM t_distributor_monthly_report WHERE distributor_id = #{distributorId} ORDER BY year_month DESC")
    List<DistributorMonthlyReport> selectByDistributor(@Param("distributorId") Long distributorId);
}
