| | |
| | | package com.mes.device.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.device.entity.DeviceConfig; |
| | | import com.mes.device.entity.DeviceGroupRelation; |
| | | import com.mes.device.vo.DeviceGroupVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | "INNER JOIN device_group_relation dgr ON dgc.id = dgr.group_id " + |
| | | "WHERE dgr.device_id = #{deviceId} AND dgr.is_deleted = 0 AND dgc.is_deleted = 0") |
| | | List<DeviceGroupVO.GroupInfo> getDeviceGroups(@Param("deviceId") Long deviceId); |
| | | |
| | | /** |
| | | * 获取按连接顺序排序的设备配置列表 |
| | | * |
| | | * @param groupId 设备组ID |
| | | * @return 设备配置集合 |
| | | */ |
| | | @Select("SELECT d.* " + |
| | | "FROM device_group_relation dgr " + |
| | | "INNER JOIN device_config d ON dgr.device_id = d.id " + |
| | | "WHERE dgr.group_id = #{groupId} " + |
| | | " AND dgr.is_deleted = 0 " + |
| | | " AND d.is_deleted = 0 " + |
| | | "ORDER BY IFNULL(dgr.connection_order, 0) ASC, dgr.id ASC") |
| | | List<DeviceConfig> getOrderedDeviceConfigs(@Param("groupId") Long groupId); |
| | | } |