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

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.refundRuleVO.ProductRefundRulePageReqVO;
import com.yc.ship.module.product.dal.dataobject.productRefundRule.ProductRefundRuleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 产品退款规则 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ProductRefundRuleMapper extends BaseMapperX<ProductRefundRuleDO> {

    default PageResult<ProductRefundRuleDO> selectPage(ProductRefundRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductRefundRuleDO>()
                .eqIfPresent(ProductRefundRuleDO::getRefundFeeRule, reqVO.getRefundFeeRule())
                .betweenIfPresent(ProductRefundRuleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProductRefundRuleDO::getRefundRule, reqVO.getRefundRule())
                .eqIfPresent(ProductRefundRuleDO::getRefundDay, reqVO.getRefundDay())
                .eqIfPresent(ProductRefundRuleDO::getRefundChannel, reqVO.getRefundChannel())
                .eqIfPresent(ProductRefundRuleDO::getExpireOperateType, reqVO.getExpireOperateType())
                .orderByDesc(ProductRefundRuleDO::getId));
    }

}