package org.agt.module.license.dal.mysql.alert;

import java.util.*;

import org.agt.framework.common.pojo.PageResult;
import org.agt.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.agt.framework.mybatis.core.mapper.BaseMapperX;
import org.agt.module.license.dal.dataobject.alert.AlertDO;
import org.apache.ibatis.annotations.Mapper;
import org.agt.module.license.controller.admin.alert.vo.*;

/**
 * 告警 Mapper
 *
 * @author super
 */
@Mapper
public interface AlertMapper extends BaseMapperX<AlertDO> {

    default PageResult<AlertDO> selectPage(AlertPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AlertDO>()
                .eqIfPresent(AlertDO::getUsers, reqVO.getUsers())
                .eqIfPresent(AlertDO::getDays, reqVO.getDays())
                .eqIfPresent(AlertDO::getContent, reqVO.getContent())
                .eqIfPresent(AlertDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AlertDO::getTemplateCode, reqVO.getTemplateCode())
                .eqIfPresent(AlertDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(AlertDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AlertDO::getId));
    }

}