package co.yixiang.yshop.module.distributor.dal.mysql.distributorwithdrawalmethod;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.distributor.dal.dataobject.distributorwithdrawalmethod.DistributorWithdrawalMethodDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.distributor.controller.admin.distributorwithdrawalmethod.vo.*;

/**
 * 分销商提现方式 Mapper
 *
 * @author admin
 */
@Mapper
public interface DistributorWithdrawalMethodMapper extends BaseMapperX<DistributorWithdrawalMethodDO> {

    default PageResult<DistributorWithdrawalMethodDO> selectPage(DistributorWithdrawalMethodPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DistributorWithdrawalMethodDO>()
                .eqIfPresent(DistributorWithdrawalMethodDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DistributorWithdrawalMethodDO::getDistributorId, reqVO.getDistributorId())
                .eqIfPresent(DistributorWithdrawalMethodDO::getPaymentMethod, reqVO.getPaymentMethod())
                .eqIfPresent(DistributorWithdrawalMethodDO::getAccountNum, reqVO.getAcountNum())
                .likeIfPresent(DistributorWithdrawalMethodDO::getRealName, reqVO.getRealName())
                .betweenIfPresent(DistributorWithdrawalMethodDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DistributorWithdrawalMethodDO::getType, reqVO.getType())
                .orderByDesc(DistributorWithdrawalMethodDO::getId));
    }

    default List<DistributorWithdrawalMethodDO> selectList(DistributorWithdrawalMethodExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DistributorWithdrawalMethodDO>()
                .eqIfPresent(DistributorWithdrawalMethodDO::getUserId, reqVO.getUserId())
                .eqIfPresent(DistributorWithdrawalMethodDO::getDistributorId, reqVO.getDistributorId())
                .eqIfPresent(DistributorWithdrawalMethodDO::getPaymentMethod, reqVO.getPaymentMethod())
                .eqIfPresent(DistributorWithdrawalMethodDO::getAccountNum, reqVO.getAcountNum())
                .likeIfPresent(DistributorWithdrawalMethodDO::getRealName, reqVO.getRealName())
                .betweenIfPresent(DistributorWithdrawalMethodDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DistributorWithdrawalMethodDO::getType, reqVO.getType())
                .orderByDesc(DistributorWithdrawalMethodDO::getId));
    }

}
