package cn.iocoder.yudao.module.pms.dal.mysql.yanfan.var.slave;

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.pms.controller.admin.yanfan.var.slave.vo.IotYfVarTempSalvePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.var.slave.IotYfVarTempSalveDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * yf变量模板设备从机对象 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotYfVarTempSalveMapper extends BaseMapperX<IotYfVarTempSalveDO> {

    default PageResult<IotYfVarTempSalveDO> selectPage(IotYfVarTempSalvePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotYfVarTempSalveDO>()
                .eqIfPresent(IotYfVarTempSalveDO::getDeviceTempId, reqVO.getDeviceTempId())
                .eqIfPresent(IotYfVarTempSalveDO::getSlaveAddr, reqVO.getSlaveAddr())
                .eqIfPresent(IotYfVarTempSalveDO::getSlaveIndex, reqVO.getSlaveIndex())
                .eqIfPresent(IotYfVarTempSalveDO::getSlaveIp, reqVO.getSlaveIp())
                .likeIfPresent(IotYfVarTempSalveDO::getSlaveName, reqVO.getSlaveName())
                .eqIfPresent(IotYfVarTempSalveDO::getSlavePort, reqVO.getSlavePort())
                .eqIfPresent(IotYfVarTempSalveDO::getAddrStart, reqVO.getAddrStart())
                .eqIfPresent(IotYfVarTempSalveDO::getAddrEnd, reqVO.getAddrEnd())
                .eqIfPresent(IotYfVarTempSalveDO::getPacketLength, reqVO.getPacketLength())
                .eqIfPresent(IotYfVarTempSalveDO::getTimer, reqVO.getTimer())
                .eqIfPresent(IotYfVarTempSalveDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotYfVarTempSalveDO::getCode, reqVO.getCode())
                .betweenIfPresent(IotYfVarTempSalveDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotYfVarTempSalveDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotYfVarTempSalveDO::getRemark, reqVO.getRemark())
                .orderByDesc(IotYfVarTempSalveDO::getId));
    }

    List<IotYfVarTempSalveDO> selectVarTempSalveList(IotYfVarTempSalveDO varTempSalve);
}
