package cn.iocoder.yudao.module.basic.dal.mysql.vendorinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.basic.dal.dataobject.vendorinfo.VendorInfoDO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.basic.controller.admin.vendorinfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 供应商 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VendorInfoMapper extends BaseMapperX<VendorInfoDO> {

    default PageResult<VendorInfoDO> selectPage(VendorInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VendorInfoDO>()
                .likeIfPresent(VendorInfoDO::getVendorName, reqVO.getVendorName())
                .eqIfPresent(VendorInfoDO::getVendorId, reqVO.getVendorId())
                .eqIfPresent(VendorInfoDO::getVendorType, reqVO.getVendorType())
                .eqIfPresent(VendorInfoDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(VendorInfoDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .eqIfPresent(VendorInfoDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(VendorInfoDO::getBusinessCode, reqVO.getBusinessCode())
                .eqIfPresent(VendorInfoDO::getContactPhone, reqVO.getContactPhone())
                .likeIfPresent(VendorInfoDO::getContactName, reqVO.getContactName())
                .eqIfPresent(VendorInfoDO::getArea, reqVO.getArea())
                .betweenIfPresent(VendorInfoDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(VendorInfoDO::getRealName, reqVO.getRealName())
                .eqIfPresent(VendorInfoDO::getIdCard, reqVO.getIdCard())
                .orderByDesc(VendorInfoDO::getId));
    }

    IPage<VendorInfoDO> selectPageByInfo(IPage<VendorInfoDO> page, @Param(Constants.WRAPPER) Wrapper<VendorInfoDO> queryWrapper);
}
