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

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.productSpu.checkRuleVO.ProductCheckRulePageReqVO;
import com.yc.ship.module.product.dal.dataobject.productCheckRule.ProductCheckRuleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 产品核销规则 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ProductCheckRuleMapper extends BaseMapperX<ProductCheckRuleDO> {

    default PageResult<ProductCheckRuleDO> selectPage(ProductCheckRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductCheckRuleDO>()
                .eqIfPresent(ProductCheckRuleDO::getIsTakeCheck, reqVO.getIsTakeCheck())
                .eqIfPresent(ProductCheckRuleDO::getIsBuyCheck, reqVO.getIsBuyCheck())
                .eqIfPresent(ProductCheckRuleDO::getEnterVerifyType, reqVO.getEnterVerifyType())
                .eqIfPresent(ProductCheckRuleDO::getCheckType, reqVO.getCheckType())
                .eqIfPresent(ProductCheckRuleDO::getCheckRule, reqVO.getCheckRule())
                .eqIfPresent(ProductCheckRuleDO::getCheckVoice, reqVO.getCheckVoice())
                .eqIfPresent(ProductCheckRuleDO::getCheckVoiceProduct, reqVO.getCheckVoiceProduct())
                .betweenIfPresent(ProductCheckRuleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductCheckRuleDO::getId));
    }

}