package com.yc.ship.module.trade.dal.mysql.billrule;

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.trade.controller.admin.billrule.vo.BillRulePageReqVO;
import com.yc.ship.module.trade.dal.dataobject.billrule.BillRuleDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 旅行社账单规则 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface BillRuleMapper extends BaseMapperX<BillRuleDO> {

    default PageResult<BillRuleDO> selectPage(BillRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BillRuleDO>()
                .likeIfPresent(BillRuleDO::getName, reqVO.getName())
                .eqIfPresent(BillRuleDO::getType, reqVO.getType())
                .betweenIfPresent(BillRuleDO::getRepaymentDate, reqVO.getRepaymentDate())
                .betweenIfPresent(BillRuleDO::getGenerationDate, reqVO.getGenerationDate())
                .eqIfPresent(BillRuleDO::getOverdueType, reqVO.getOverdueType())
                .betweenIfPresent(BillRuleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BillRuleDO::getId));
    }

}