package cn.newfeifan.mall.module.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.module.sale.controller.app.merchantapply.vo.MerchantApplyPageReqVO;
import cn.newfeifan.mall.module.sale.dal.dataobject.merchantapply.MerchantApplyDO;
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::getStatus, reqVO.getStatus())
                .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())
                .orderByDesc(MerchantApplyDO::getId));
    }

}