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

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.operatedetail.OperateDetailDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.chain.controller.admin.operatedetail.vo.*;

/**
 * 区块上链操作具体上链信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OperateDetailMapper extends BaseMapperX<OperateDetailDO> {

    default PageResult<OperateDetailDO> selectPage(OperateDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OperateDetailDO>()
                .eqIfPresent(OperateDetailDO::getChainOperateId, reqVO.getChainOperateId())
                .eqIfPresent(OperateDetailDO::getTitle, reqVO.getTitle())
                .eqIfPresent(OperateDetailDO::getType, reqVO.getType())
                .eqIfPresent(OperateDetailDO::getContent, reqVO.getContent())
                .eqIfPresent(OperateDetailDO::getOperateInfo, reqVO.getOperateInfo())
                .betweenIfPresent(OperateDetailDO::getAddTime, reqVO.getAddTime())
                .eqIfPresent(OperateDetailDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(OperateDetailDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .betweenIfPresent(OperateDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OperateDetailDO::getId));
    }

    default List<OperateDetailDO> selectList(OperateDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OperateDetailDO>()
                .eqIfPresent(OperateDetailDO::getChainOperateId, reqVO.getChainOperateId())
                .eqIfPresent(OperateDetailDO::getTitle, reqVO.getTitle())
                .eqIfPresent(OperateDetailDO::getType, reqVO.getType())
                .eqIfPresent(OperateDetailDO::getContent, reqVO.getContent())
                .eqIfPresent(OperateDetailDO::getOperateInfo, reqVO.getOperateInfo())
                .betweenIfPresent(OperateDetailDO::getAddTime, reqVO.getAddTime())
                .eqIfPresent(OperateDetailDO::getBelongBusinessId, reqVO.getBelongBusinessId())
                .likeIfPresent(OperateDetailDO::getBelongBusinessName, reqVO.getBelongBusinessName())
                .betweenIfPresent(OperateDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OperateDetailDO::getId));
    }

}
