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

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

/**
 * 点位规则 Mapper
 *
 * @author 必硕科技
 */
@Mapper
public interface DevicePointRulesMapper extends BaseMapperX<DevicePointRulesDO> {

    default PageResult<DevicePointRulesDO> selectPage(DevicePointRulesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DevicePointRulesDO>()
                .eqIfPresent(DevicePointRulesDO::getIdentifier, reqVO.getIdentifier())
                .likeIfPresent(DevicePointRulesDO::getFieldName, reqVO.getFieldName())
                .eqIfPresent(DevicePointRulesDO::getFieldRule, reqVO.getFieldRule())
                .eqIfPresent(DevicePointRulesDO::getDefaultValue, reqVO.getDefaultValue())
                .betweenIfPresent(DevicePointRulesDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DevicePointRulesDO::getDeviceId, reqVO.getDeviceId())
                .orderByDesc(DevicePointRulesDO::getId));
    }

}