package cn.iocoder.yudao.module.server.dal.mysql.smsrecord;

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.server.dal.dataobject.smsrecord.SmsRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.server.controller.admin.smsrecord.vo.*;

/**
 * 短信发送记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface SmsRecordMapper extends BaseMapperX<SmsRecordDO> {

    default PageResult<SmsRecordDO> selectPage(SmsRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SmsRecordDO>()
                .eqIfPresent(SmsRecordDO::getMobile, reqVO.getMobile())
                .eqIfPresent(SmsRecordDO::getContent, reqVO.getContent())
                .eqIfPresent(SmsRecordDO::getSendStatus, reqVO.getSendStatus())
                .eqIfPresent(SmsRecordDO::getErrorMessage, reqVO.getErrorMessage())
                .betweenIfPresent(SmsRecordDO::getSendTime, reqVO.getSendTime())
                .eqIfPresent(SmsRecordDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(SmsRecordDO::getBusinessId, reqVO.getBusinessId())
                .betweenIfPresent(SmsRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SmsRecordDO::getId));
    }

}