| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public int selectDeviceCount(int id) throws Exception { |
| | | return deviceMapper.selectDeviceCount(id); |
| | | public AjaxResult selectDeviceCount(int id) throws Exception { |
| | | //根据用户登录的角色身份查询总设备数(台) |
| | | int count = deviceMapper.selectDeviceCount(id); |
| | | //根据登录用户的角色身份查询设备的使用人数 |
| | | int total = deviceMapper.selectUserDeviceByCount(id); |
| | | AjaxResult ajax = new AjaxResult(); |
| | | ajax.put("deviceCount", count); |
| | | ajax.put("userTotal", total); |
| | | return AjaxResult.success("查询成功", ajax); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 设备编号:D + userId + 15位随机字母和数字 |
| | | SysUser user = getLoginUser().getUser(); |
| | | String number = "D" + user.getUserId().toString() + toolService.getStringRandom(10); |
| | | // int count = deviceMapper.getDeviceNumCount(number); |
| | | // if (count == 0) { |
| | | // return number; |
| | | // } else { |
| | | // generationDeviceNum(); |
| | | // } |
| | | int count = deviceMapper.getDeviceNumCount(number); |
| | | if (count == 0) { |
| | | return number; |
| | | } else { |
| | | generationDeviceNum(); |
| | | } |
| | | return ""; |
| | | } |
| | | |