task65-动态获取站点下设备类型

This commit is contained in:
2025-10-14 17:32:16 +08:00
parent 15b964b4ce
commit d468ef9941
5 changed files with 25 additions and 3 deletions

View File

@ -152,4 +152,13 @@ public class EmsSiteConfigController extends BaseController{
List<PointQueryResponse> result = iEmsDeviceSettingService.getSingleSiteDevicePoints(request); List<PointQueryResponse> result = iEmsDeviceSettingService.getSingleSiteDevicePoints(request);
return getDataTable2(result); return getDataTable2(result);
} }
/**
* 获取指定站点下的所有设备类别
*/
@GetMapping("/getSiteAllDeviceCategory")
public AjaxResult getSiteAllDeviceCategory(String siteId)
{
return success(iEmsDeviceSettingService.getSiteAllDeviceCategory(siteId));
}
} }

View File

@ -88,5 +88,5 @@ public interface EmsDevicesSettingMapper
public List<Map<String, Object>> getClusterIdsByFuzzyQuery(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory, public List<Map<String, Object>> getClusterIdsByFuzzyQuery(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory,
@Param("parentId")String parentId); @Param("parentId")String parentId);
public List<String> getDeviceIdsBySiteIdAndCategory(@Param("siteId")String siteId,@Param("deviceCategory")String deviceCategory); public List<String> getAllDeviceCategoryBySiteId(String siteId);
} }

View File

@ -26,4 +26,6 @@ public interface IEmsDeviceSettingService
public List<DeviceCategory> getDeviceCategory(); public List<DeviceCategory> getDeviceCategory();
public List<PointQueryResponse> getSingleSiteDevicePoints(PointDataRequest request); public List<PointQueryResponse> getSingleSiteDevicePoints(PointDataRequest request);
public List<String> getSiteAllDeviceCategory(String siteId);
} }

View File

@ -219,6 +219,12 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
.sorted(finalComparator) .sorted(finalComparator)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public List<String> getSiteAllDeviceCategory(String siteId) {
return emsDevicesMapper.getAllDeviceCategoryBySiteId(siteId);
}
// 辅助方法:根据值查找对应的对象(用于比较器中获取完整对象) // 辅助方法:根据值查找对应的对象(用于比较器中获取完整对象)
private PointQueryResponse findByValue(List<PointQueryResponse> list, Object value) { private PointQueryResponse findByValue(List<PointQueryResponse> list, Object value) {
return list.stream() return list.stream()

View File

@ -216,7 +216,12 @@
and device_category = #{deviceCategory} and device_category = #{deviceCategory}
</select> </select>
<select id="getDeviceIdsBySiteIdAndCategory" resultType="java.lang.String"> <select id="getAllDeviceCategoryBySiteId" resultType="java.lang.String">
select DISTINCT device_id from ems_devices_setting where site_id = #{siteId} and device_category = #{deviceCategory} select DISTINCT device_category
from ems_devices_setting
where 1=1
<if test="siteId !=null and siteId !=''">
and site_id = #{siteId}
</if>
</select> </select>
</mapper> </mapper>