package cn.iocoder.yudao.module.system.dal.mysql.bank;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.bank.BankDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 银行卡信息 Mapper
 *
 * @author 符溶馨
 */
@Mapper
public interface BankMapper extends BaseMapperX<BankDO> {

    default PageResult<BankDO> selectPageIn(UserBankPageReqVO reqVO, List<Long> bankId) {

        return selectPage(reqVO, new LambdaQueryWrapperX<BankDO>()
                .likeIfPresent(BankDO::getNickname, reqVO.getNickname())
                .inIfPresent(BankDO::getId, bankId)
                .orderByDesc(BankDO::getId));
    }

    default PageResult<BankDO> selectPageNotIn(UserBankPageReqVO reqVO, List<Long> bankId) {

        return selectPage(reqVO, new LambdaQueryWrapperX<BankDO>()
                .likeIfPresent(BankDO::getNickname, reqVO.getNickname())
                .notIn(BankDO::getId, bankId)
                .orderByDesc(BankDO::getId));
    }

    default List<BankDO> selectBankList(List<Long> bankId) {

        return selectList(new LambdaQueryWrapperX<BankDO>()
                .in(BankDO::getId, bankId));
    }
}
