package cn.newfeifan.mall.module.distri.dal.mysql.orderitemsettlement;

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.distri.dal.dataobject.orderitemsettlement.OrderItemSettlementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.distri.controller.admin.orderitemsettlement.vo.*;

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

    default PageResult<OrderItemSettlementDO> selectPage(OrderItemSettlementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderItemSettlementDO>()
                .eqIfPresent(OrderItemSettlementDO::getTradeShopSettlementId, reqVO.getTradeShopSettlementId())
                .eqIfPresent(OrderItemSettlementDO::getTradeOrderItemId, reqVO.getTradeOrderItemId())
                .betweenIfPresent(OrderItemSettlementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderItemSettlementDO::getId));
    }

}