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.order.device.IotInspectOrderDevicePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectOrderDeviceDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 巡检工单设备 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotInspectOrderDeviceMapper extends BaseMapperX<IotInspectOrderDeviceDO> {

    default PageResult<IotInspectOrderDeviceDO> selectPage(IotInspectOrderDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotInspectOrderDeviceDO>()
                .eqIfPresent(IotInspectOrderDeviceDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(IotInspectOrderDeviceDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(IotInspectOrderDeviceDO::getDeviceCode, reqVO.getDeviceCode())
                .likeIfPresent(IotInspectOrderDeviceDO::getDeviceName, reqVO.getDeviceName())
                .betweenIfPresent(IotInspectOrderDeviceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotInspectOrderDeviceDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(IotInspectOrderDeviceDO::getId));
    }

    String getDeviceInfo(@Param("orderId") Long orderId);
}