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

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.productTakeRule.vo.ProductTakeRulePageReqVO;
import com.yc.ship.module.product.dal.dataobject.productTakeRule.ProductTakeRuleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 产品取票规则 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ProductTakeRuleMapper extends BaseMapperX<ProductTakeRuleDO> {

    default PageResult<ProductTakeRuleDO> selectPage(ProductTakeRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductTakeRuleDO>()
                .betweenIfPresent(ProductTakeRuleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProductTakeRuleDO::getTakeTimeType, reqVO.getTakeTimeType())
                .eqIfPresent(ProductTakeRuleDO::getQrcodeType, reqVO.getQrcodeType())
                .eqIfPresent(ProductTakeRuleDO::getPrintType, reqVO.getPrintType())
                .eqIfPresent(ProductTakeRuleDO::getPrintTemp, reqVO.getPrintTemp())
                .orderByDesc(ProductTakeRuleDO::getId));
    }

}