package cn.iocoder.yudao.module.iot.dal.mysql.recipedevicerecord;

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

/**
 * 设备点位采集值记录 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface RecipeDeviceRecordMapper extends BaseMapperX<RecipeDeviceRecordDO> {

    default PageResult<RecipeDeviceRecordDO> selectPage(RecipeDeviceRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecipeDeviceRecordDO>()
                .eqIfPresent(RecipeDeviceRecordDO::getAttributeCode, reqVO.getAttributeCode())
                .likeIfPresent(RecipeDeviceRecordDO::getAttributeName, reqVO.getAttributeName())
                .eqIfPresent(RecipeDeviceRecordDO::getAttributeType, reqVO.getAttributeType())
                .eqIfPresent(RecipeDeviceRecordDO::getDataType, reqVO.getDataType())
                .eqIfPresent(RecipeDeviceRecordDO::getAddress, reqVO.getAddress())
                .eqIfPresent(RecipeDeviceRecordDO::getDataUnit, reqVO.getDataUnit())
                .eqIfPresent(RecipeDeviceRecordDO::getRatio, reqVO.getRatio())
                .eqIfPresent(RecipeDeviceRecordDO::getRemark, reqVO.getRemark())
                .eqIfPresent(RecipeDeviceRecordDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(RecipeDeviceRecordDO::getRecipeId, reqVO.getRecipeId())
                .betweenIfPresent(RecipeDeviceRecordDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RecipeDeviceRecordDO::getValue, reqVO.getValue())
                .orderByDesc(RecipeDeviceRecordDO::getId));
    }

}