package com.trs.ggzyexchange.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.trs.ggzyexchange.entity.CqSwBargainResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.trs.ggzyexchange.entity.TenderDetailsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 交易结果信息 Mapper 接口
 * </p>
 *
 * @author trs
 * @since 2023-03-03
 */
@Mapper
public interface CqSwBargainResultMapper extends BaseMapper<CqSwBargainResult> {

    IPage<TenderDetailsVo> queryCqSwBargainResultAllList(Page<CqSwBargainResult> page);

    Long maxDataTimeStamp();

    IPage<TenderDetailsVo> queryCqSwBargainResultAllListByTime(
            Page<CqSwBargainResult> page,
            @Param("time")
                    Long time);

    int countByRegionCodeAndTime(
            @Param("region_code") String region_code,
            @Param("resultStartTimeYyyyMMdd") Long resultStartTimeYyyyMMdd,
            @Param("resultEndTimeYyyyMMdd") Long resultEndTimeYyyyMMdd
    );

    int countByRegionCode(@Param("region_code") String region_code);

    CqSwBargainResult getSumMoneyByRegionCode(
            @Param("region_code")    String region_code
    );

    CqSwBargainResult getSumMoneyByRegionCodeAndTime(
            @Param("regionCode")  String regionCode,
            @Param("resultStartTime")  String resultStartTime,
            @Param("resultEndTime") String resultEndTime);
}
