package cn.iocoder.yudao.module.pms.dal.mysql.inspect;

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.pms.controller.admin.inspect.route.vo.IotInspectRoutePageReqVO;
import cn.iocoder.yudao.module.pms.controller.admin.inspect.route.vo.IotInspectRouteRespVO;
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectRouteDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 巡检路线 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IotInspectRouteMapper extends BaseMapperX<IotInspectRouteDO> {

    default PageResult<IotInspectRouteDO> selectPage(IotInspectRoutePageReqVO reqVO, Set<Long> classifies, Set<Long> deptIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotInspectRouteDO>()
                .likeIfPresent(IotInspectRouteDO::getRouteName, reqVO.getRouteName())
                .inIfPresent(IotInspectRouteDO::getDeviceClassify, classifies)
                .eqIfPresent(IotInspectRouteDO::getDeviceId, reqVO.getDeviceId())
                .likeIfPresent(IotInspectRouteDO::getDeviceClassifyName, reqVO.getDeviceClassifyName())
                .likeIfPresent(IotInspectRouteDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(IotInspectRouteDO::getItemJson, reqVO.getItemJson())
                .eqIfPresent(IotInspectRouteDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotInspectRouteDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(IotInspectRouteDO::getDeptId, deptIds)
                .orderByDesc(IotInspectRouteDO::getId));
    }
    IPage<IotInspectRouteDO> getRoute(IPage<IotInspectRoutePageReqVO> page,@Param("reqVO")  IotInspectRoutePageReqVO reqVO);

}
