package cn.newfeifan.mall.module.trade.dal.mysql.ordersettlement;


import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.module.trade.dal.dataobject.ordersettlement.OrderSettlementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.trade.controller.app.ordersettlement.vo.*;

/**
 * 订单结算表,记录有那些订单参与了本次结算 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface OrderSettlementMapper extends BaseMapperX<OrderSettlementDO> {

    default PageResult<OrderSettlementDO> selectPage(AppOrderSettlementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderSettlementDO>()
                .eqIfPresent(OrderSettlementDO::getTradeShopSettlementId, reqVO.getTradeShopSettlementId())
                .eqIfPresent(OrderSettlementDO::getTradeOrderId, reqVO.getTradeOrderId())
                .betweenIfPresent(OrderSettlementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderSettlementDO::getId));
    }

}