package com.jsowell.pile.mapper;

import com.jsowell.pile.domain.SettleOrderReport;
import com.jsowell.pile.dto.MerchantOrderReportDTO;
import com.jsowell.pile.vo.web.SettleOrderReportVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SettleOrderReportMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(SettleOrderReport record);

    int insertOrUpdate(SettleOrderReport record);

    int insertOrUpdateSelective(SettleOrderReport record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(SettleOrderReport record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    SettleOrderReport selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(SettleOrderReport record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(SettleOrderReport record);

    int updateBatch(List<SettleOrderReport> list);

    int batchInsert(@Param("list") List<SettleOrderReport> list);

    int updateBatchSelective(List<SettleOrderReport> list);

    /**
     * 查询结算订单报
     *
     * @param id 结算订单报主键
     * @return 结算订单报
     */
    SettleOrderReport selectSettleOrderReportById(Long id);

    /**
     * 查询结算订单报列表
     *
     * @param settleOrderReport 结算订单报
     * @return 结算订单报集合
     */
    List<SettleOrderReport> selectSettleOrderReportList(SettleOrderReport settleOrderReport);

    /**
     * 新增结算订单报
     *
     * @param settleOrderReport 结算订单报
     * @return 结果
     */
    int insertSettleOrderReport(SettleOrderReport settleOrderReport);

    /**
     * 修改结算订单报
     *
     * @param settleOrderReport 结算订单报
     * @return 结果
     */
    int updateSettleOrderReport(SettleOrderReport settleOrderReport);

    /**
     * 删除结算订单报
     *
     * @param id 结算订单报主键
     * @return 结果
     */
    int deleteSettleOrderReportById(Long id);

    /**
     * 批量删除结算订单报
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteSettleOrderReportByIds(Long[] ids);

    /**
     * 根据运营商id查询订单报表
     *
     * @param dto
     * @return
     */
    List<SettleOrderReportVO> getMerchantOrderReport(@Param("dto") MerchantOrderReportDTO dto);

    /**
     * 根据站点id和日期查询订单日报
     *
     * @param stationId 站点id
     * @param date      交易日期
     */
    SettleOrderReport selectByStationIdAndDate(@Param("stationId") String stationId, @Param("date") String date);

    /**
     * 根据运营商id和日期查询订单日报
     *
     * @param merchantId 运营商id
     * @param date       交易日期
     */
    List<SettleOrderReport> selectByMerchantIdAndDate(@Param("merchantId") String merchantId, @Param("date") String date);

    /**
     * 通过站点idList 日期范围查询订单日报列表
     *
     * @param stationIdList 站点idList
     * @param startDate     开始时间
     * @param endDate       结束时间
     * @return
     */
    List<SettleOrderReport> queryOrderReport(@Param("stationIdList") List<String> stationIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
}