package cn.iocoder.yudao.module.chain.dal.mysql.blockcertificate;

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.chain.dal.dataobject.blockcertificate.BlockCertificateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.chain.controller.admin.blockcertificate.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 区块证书 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BlockCertificateMapper extends BaseMapperX<BlockCertificateDO> {

    default PageResult<BlockCertificateDO> selectPage(BlockCertificatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlockCertificateDO>()
                .eqIfPresent(BlockCertificateDO::getChainOperateId, reqVO.getChainOperateId())
                .eqIfPresent(BlockCertificateDO::getOperateType, reqVO.getOperateType())
                .likeIfPresent(BlockCertificateDO::getOperateName, reqVO.getOperateName())
                .eqIfPresent(BlockCertificateDO::getBatchId, reqVO.getBatchId())
                .eqIfPresent(BlockCertificateDO::getLinkId, reqVO.getLinkId())
                .likeIfPresent(BlockCertificateDO::getLinkName, reqVO.getLinkName())
                .likeIfPresent(BlockCertificateDO::getChainName, reqVO.getChainName())
                .eqIfPresent(BlockCertificateDO::getChainBlock, reqVO.getChainBlock())
                .betweenIfPresent(BlockCertificateDO::getBlockTime, reqVO.getBlockTime())
                .eqIfPresent(BlockCertificateDO::getChainBlockIdentity, reqVO.getChainBlockIdentity())
                .eqIfPresent(BlockCertificateDO::getChainState, reqVO.getChainState())
                .eqIfPresent(BlockCertificateDO::getChainStatus, reqVO.getChainStatus())
                .eqIfPresent(BlockCertificateDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(BlockCertificateDO::getUploadUser, reqVO.getUploadUser())
                .eqIfPresent(BlockCertificateDO::getUploadVerify, reqVO.getUploadVerify())
                .betweenIfPresent(BlockCertificateDO::getUploadTime, reqVO.getUploadTime())
                .eqIfPresent(BlockCertificateDO::getUploadLocation, reqVO.getUploadLocation())
                .eqIfPresent(BlockCertificateDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(BlockCertificateDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .orderByDesc(BlockCertificateDO::getId));
    }

    List<BlockCertificateRespVO> getBlockCertificateList(@Param("blockCertificate") BlockCertificateReqVO blockCertificate);

}
