package com.yc.ship.module.product.dal.mysql.productSaleChannel;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.product.controller.admin.productSaleChannel.vo.ProductSaleChannelPageReqVO;
import com.yc.ship.module.product.dal.dataobject.productSaleChannel.ProductSaleChannelDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 产品销售渠道 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ProductSaleChannelMapper extends BaseMapperX<ProductSaleChannelDO> {

    default PageResult<ProductSaleChannelDO> selectPage(ProductSaleChannelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductSaleChannelDO>()
                .eqIfPresent(ProductSaleChannelDO::getProductId, reqVO.getProductId())
                .eqIfPresent(ProductSaleChannelDO::getChannelId, reqVO.getChannelId())
                .betweenIfPresent(ProductSaleChannelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductSaleChannelDO::getId));
    }

}