package cn.iocoder.yudao.module.order.dal.mysql.orderExceptionChannelPrice;

import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.order.dal.dataobject.orderExceptionChannelPrice.OrderExceptionChannelPriceDO;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.order.vo.orderExceptionChannelPrice.*;

/**
 * 不可出渠道异常商品价格 Mapper
 * @author 系统管理员
 */
@Mapper
public interface OrderExceptionChannelPriceMapper extends AbstractMapper<OrderExceptionChannelPriceDO> {
    @Override
    default PageResult<OrderExceptionChannelPriceDO> selectPage(PageVO page, Object object) {
        if (object instanceof OrderExceptionChannelPriceQueryVO) {
            OrderExceptionChannelPriceQueryVO vo = (OrderExceptionChannelPriceQueryVO)object;
            return selectPage(page, new LambdaQuery<OrderExceptionChannelPriceDO>()
                .eqIfPresent(OrderExceptionChannelPriceDO::getOrderId, vo.getOrderId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getOrderItemId, vo.getOrderItemId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getExceptionId, vo.getExceptionId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightFee, vo.getFreightFee())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightCurrencyId, vo.getFreightCurrencyId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightUnitId, vo.getFreightUnitId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceFee, vo.getClearanceFee())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceCurrencyId, vo.getClearanceCurrencyId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceUnitId, vo.getClearanceUnitId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getIsPayAdvance, vo.getIsPayAdvance())
                .eqIfPresent(OrderExceptionChannelPriceDO::getCharging, vo.getCharging())
                .betweenIfPresent(OrderExceptionChannelPriceDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
                    .orderByDesc(OrderExceptionChannelPriceDO::getId));
        }

        return null;
    }

    @Override
    default List<OrderExceptionChannelPriceDO> selectList(Object object) {
        if (object instanceof OrderExceptionChannelPriceQueryVO) {
            OrderExceptionChannelPriceQueryVO vo = (OrderExceptionChannelPriceQueryVO)object;
            return selectList(new LambdaQuery<OrderExceptionChannelPriceDO>()
                .eqIfPresent(OrderExceptionChannelPriceDO::getOrderId, vo.getOrderId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getOrderItemId, vo.getOrderItemId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getExceptionId, vo.getExceptionId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightFee, vo.getFreightFee())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightCurrencyId, vo.getFreightCurrencyId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getFreightUnitId, vo.getFreightUnitId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceFee, vo.getClearanceFee())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceCurrencyId, vo.getClearanceCurrencyId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getClearanceUnitId, vo.getClearanceUnitId())
                .eqIfPresent(OrderExceptionChannelPriceDO::getIsPayAdvance, vo.getIsPayAdvance())
                .eqIfPresent(OrderExceptionChannelPriceDO::getCharging, vo.getCharging())
                .betweenIfPresent(OrderExceptionChannelPriceDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
                    .orderByDesc(OrderExceptionChannelPriceDO::getId));
        }

        return null;
    }
}
