package com.tofly.scada.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.tofly.scada.entity.DeviceArchiveManage;
import com.tofly.scada.entity.vo.IOSever.IOServerParObjsDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author haiqiu
* @description 针对表【TF_DEVICE_ARCHIVE_MANAGE(设备档案管理)】的数据库操作Mapper
* @createDate 2022-05-12 10:42:44
* @Entity com.tofly.scada.entity.DeviceArchiveManage
*/
@Mapper
public interface DeviceArchiveManageMapper extends BaseMapper<DeviceArchiveManage> {


    /**
     * 最新数据查询
     * @param queryWrapper 查询条件
     * @return
     */
    @Select("SELECT distinct manage.*,dic.cname as device_type_name FROM TF_DEVICE_ARCHIVE_MANAGE manage " +
            "LEFT JOIN TF_INDEX_ALLOCATION allocation ON allocation.DEVICE_ID = manage.ID " +
            "left join tf_water_info water on manage.water_id=water.id " +
            "left join TF_YWPN_SYSCHILDCODE_D dic  on dic.pcid=53400 and dic.ccode=manage.device_type " +
            "${ew.customSqlSegment}")
    List<DeviceArchiveManage> pageList(@Param(Constants.WRAPPER) QueryWrapper<DeviceArchiveManage> queryWrapper);

    /**
     * 获取阀门对应指标编码列表
     * @return
     */
    List<IOServerParObjsDto> getIOServerDeviceIndexList();
}




