| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import static sun.audio.AudioDevice.device; |
| | | |
| | | /** |
| | | * 设备Controller |
| | | * |
| | |
| | | return getDataTable(deviceService.selectDeviceList(device)); |
| | | } |
| | | |
| | | /** |
| | | * 查询首页的总用户数(人),总设备数(台) |
| | | * |
| | | * @param tenantName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('iot:device:list')") |
| | | @GetMapping(value = {"/", "/{tenantName}"}) |
| | | @ApiOperation(value = "获取总用户数和总设备数") |
| | | @PreAuthorize("@ss.hasPermi('iot:device:select')") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult list(@PathVariable("id") int id) throws Exception { |
| | | int i = deviceService.selectUserDeviceByCount(id); |
| | | int count = deviceService.selectDeviceCount(); |
| | | if (count > 0) { |
| | | AjaxResult ajaxResult = new AjaxResult(); |
| | | ajaxResult.put("count", i); |
| | | ajaxResult.put("total", count); |
| | | return AjaxResult.success(ajaxResult); |
| | | } else { |
| | | return AjaxResult.error(); |
| | | } |
| | | public AjaxResult selectCount(@PathVariable("tenantName") String tenantName) throws Exception { |
| | | //根据用户登录的角色身份查询总设备数(台) |
| | | int count = deviceService.selectDeviceCount(tenantName); |
| | | //根据登录用户的角色身份查询设备的使用人数 |
| | | int total = deviceService.selectUserDeviceByCount(tenantName); |
| | | AjaxResult ajax = new AjaxResult(); |
| | | ajax.put("deviceCount", count); |
| | | ajax.put("userTotal", total); |
| | | return AjaxResult.success("查询成功", ajax); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * 获取设备详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('iot:device:query')") |
| | | @GetMapping(value = "/{deviceId}") |
| | | @ApiOperation("获取设备详情") |
| | | public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) { |
| | | return AjaxResult.success(deviceService.selectDeviceByDeviceId(deviceId)); |
| | | } |
| | | // @PreAuthorize("@ss.hasPermi('iot:device:query')") |
| | | // @GetMapping(value = "/{deviceId}") |
| | | // @ApiOperation("获取设备详情") |
| | | // public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) { |
| | | // return AjaxResult.success(deviceService.selectDeviceByDeviceId(deviceId)); |
| | | // } |
| | | |
| | | /** |
| | | * 设备数据同步 |