package cn.newfeifan.mall.sale.dal.mysql.merchantapply;

import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.sale.dal.dataobject.merchantapply.MerchantApplyDO;
import cn.newfeifan.mall.sale.controller.admin.merchantapply.vo.MerchantApplyPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商户申请 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface MerchantApplyMapper extends BaseMapperX<MerchantApplyDO> {

    default PageResult<MerchantApplyDO> selectPage(MerchantApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MerchantApplyDO>()
                .eqIfPresent(MerchantApplyDO::getLogoUrl, reqVO.getLogoUrl())
                .likeIfPresent(MerchantApplyDO::getName, reqVO.getName())
                .eqIfPresent(MerchantApplyDO::getDescription, reqVO.getDescription())
                .eqIfPresent(MerchantApplyDO::getContact, reqVO.getContact())
                .eqIfPresent(MerchantApplyDO::getAddress, reqVO.getAddress())
                .eqIfPresent(MerchantApplyDO::getContactNumber, reqVO.getContactNumber())
                .eqIfPresent(MerchantApplyDO::getWebsite, reqVO.getWebsite())
                .eqIfPresent(MerchantApplyDO::getBusinessUrl, reqVO.getBusinessUrl())
                .eqIfPresent(MerchantApplyDO::getComplaintsHotline, reqVO.getComplaintsHotline())
                .eqIfPresent(MerchantApplyDO::getCustomerServiceHotline, reqVO.getCustomerServiceHotline())
                .eqIfPresent(MerchantApplyDO::getEmail, reqVO.getEmail())
                .eqIfPresent(MerchantApplyDO::getBusinessLicensePicture, reqVO.getBusinessLicensePicture())
                .eqIfPresent(MerchantApplyDO::getPackageId, reqVO.getPackageId())
                .eqIfPresent(MerchantApplyDO::getShopCount, reqVO.getShopCount())
                .betweenIfPresent(MerchantApplyDO::getExpireTime, reqVO.getExpireTime())
                .betweenIfPresent(MerchantApplyDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(MerchantApplyDO::getAreaId, reqVO.getAreaId())
                .eqIfPresent(MerchantApplyDO::getApplyMemberUserId, reqVO.getApplyMemberUserId())
                .eqIfPresent(MerchantApplyDO::getCheckSystemUserId, reqVO.getCheckSystemUserId())
                .betweenIfPresent(MerchantApplyDO::getCheckTime, reqVO.getCheckTime())
                .eqIfPresent(MerchantApplyDO::getCheckComment, reqVO.getCheckComment())
                .eqIfPresent(MerchantApplyDO::getApplyComment, reqVO.getApplyComment())
                .eqIfPresent(MerchantApplyDO::getCheckStatus, reqVO.getCheckStatus())
                .likeIfPresent(MerchantApplyDO::getAccountName, reqVO.getAccountName())
                .eqIfPresent(MerchantApplyDO::getAccountNumber, reqVO.getAccountNumber())
                .likeIfPresent(MerchantApplyDO::getBankName, reqVO.getBankName())
                .eqIfPresent(MerchantApplyDO::getBrandLicensing, reqVO.getBrandLicensing())
                .eqIfPresent(MerchantApplyDO::getOtherCertificate, reqVO.getOtherCertificate())
                .eqIfPresent(MerchantApplyDO::getStatus, reqVO.getStatus())
                .eqIfPresent(MerchantApplyDO::getLegalPerson, reqVO.getLegalPerson())
                .eqIfPresent(MerchantApplyDO::getLegalPersonNumber, reqVO.getLegalPersonNumber())
                .eqIfPresent(MerchantApplyDO::getIdentityCardFront, reqVO.getIdentityCardFront())
                .eqIfPresent(MerchantApplyDO::getIdentityCardReverseSide, reqVO.getIdentityCardReverseSide())
                .eqIfPresent(MerchantApplyDO::getCheckPersonStatus, reqVO.getCheckPersonStatus())
                .orderByDesc(MerchantApplyDO::getId));
    }

}