package cn.iocoder.yudao.module.system.dal.mysql.devicewarn;

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

/**
 * 设备报警 Mapper
 *
 * @author 我是秦俊旗
 */
@Mapper
public interface DeviceWarnMapper extends BaseMapperX<DeviceWarnDO> {

    default PageResult<DeviceWarnDO> selectPage(DeviceWarnPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceWarnDO>()
                .likeIfPresent(DeviceWarnDO::getDeviceSn, reqVO.getDeviceSn())
                .likeIfPresent(DeviceWarnDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(DeviceWarnDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(DeviceWarnDO::getBeforeWeight, reqVO.getBeforeWeight())
                .eqIfPresent(DeviceWarnDO::getAfterWeight, reqVO.getAfterWeight())
                .betweenIfPresent(DeviceWarnDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceWarnDO::getId));
    }

}