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

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

/**
 * 点位规则关联模型 Mapper
 *
 * @author 必硕科技
 */
@Mapper
public interface DeviceModelRulesMapper extends BaseMapperX<DeviceModelRulesDO> {

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

}