package com.ard.gb28181.controller; import com.ard.common.core.web.domain.AjaxResult; import com.ard.gb28181.api.domain.Device; import com.ard.gb28181.service.IDeviceService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Tag(name = "国标设备管理") @Slf4j @RestController @RequestMapping("/device") public class Gb28181Controller { @Autowired private IDeviceService deviceService; /** * 获取所有国标设备 * * @return 设备列表 */ @Operation(summary = "获取所有国标设备") @GetMapping("/getAllDevices") public AjaxResult getAllDevices() { return AjaxResult.success(deviceService.getAllDevices()); } /** * 根据国标设备获取所有通道 * * @param gbDeviceId 设备编号 * @return 通道列表 */ @Operation(summary = "根据国标设备获取所有通道") @GetMapping("/getChannelsByDeviceId/{gbDeviceId}") public AjaxResult getChannelsByDeviceId(@PathVariable String gbDeviceId) { Device device = deviceService.getDeviceByDeviceId(gbDeviceId); if (device == null) { return AjaxResult.error("gb28181 设备不存在 deviceId:" + gbDeviceId); } return AjaxResult.success(deviceService.getChannelsByDeviceId(gbDeviceId)); } }