| | |
| | | |
| | | /** |
| | | * 查询非本部门区域的设备 |
| | | * @param regionCode 区域编码,用于查询不在该区域内的设备 |
| | | * @param deptId 机构ID,用于限定查询范围 |
| | | * @return 设备列表 |
| | | */ |
| | | @GetMapping("/nonDeptAreaDevices") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "查询非本部门区域的设备", notes = "查询不在当前部门及其子部门区域内的设备") |
| | | public R<List<FwDeviceVO>> getNonDeptAreaDevices() { |
| | | return R.data(fwDeviceService.getNonDeptAreaDevices()); |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "regionCode", value = "区域编码", paramType = "query", dataType = "string", required = true), |
| | | @ApiImplicitParam(name = "deptId", value = "机构ID", paramType = "query", dataType = "string", required = true) |
| | | }) |
| | | public R<List<FwDeviceVO>> getNonDeptAreaDevices( |
| | | @ApiParam(value = "区域编码", required = true) @RequestParam String regionCode, |
| | | @ApiParam(value = "机构ID", required = true) @RequestParam String deptId) { |
| | | return R.data(fwDeviceService.getNonDeptAreaDevices(regionCode, deptId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | SELECT |
| | | d.*, |
| | | t.out_target, |
| | | ps.id AS shareId, |
| | | CASE |
| | | WHEN EXISTS ( |
| | | SELECT 1 |
| | | FROM ja_fw_device_per_share ps |
| | | WHERE ps.device_id = d.id |
| | | AND ps.loan_to_dept_id = #{currentDeptId} |
| | | AND ps.is_deleted = 0 |
| | | ) THEN TRUE |
| | | WHEN ps.id IS NOT NULL THEN TRUE |
| | | ELSE FALSE |
| | | END AS isShared |
| | | FROM |
| | |
| | | out_target IS NOT NULL |
| | | ) t ON d.id = t.device_id |
| | | AND t.rn = 1 |
| | | LEFT JOIN ja_fw_device_per_share ps ON ps.device_id = d.id |
| | | AND ps.loan_to_dept_id = #{currentDeptId} |
| | | AND ps.is_deleted = 0 |
| | | WHERE |
| | | d.is_deleted = 0 |
| | | and d.effective_range_km is not null |
| | |
| | | |
| | | /** |
| | | * 查询非本部门区域的设备 |
| | | * |
| | | * @param regionCode 区域编码,用于查询不在该区域内的设备 |
| | | * @param deptId 机构ID,用于限定查询范围 |
| | | * @return 设备列表 |
| | | */ |
| | | List<FwDeviceVO> getNonDeptAreaDevices(); |
| | | List<FwDeviceVO> getNonDeptAreaDevices(String regionCode, String deptId); |
| | | } |
| | |
| | | /** |
| | | * 查询非本部门区域的设备 |
| | | * |
| | | * @param regionCode 区域编码,用于查询不在该区域内的设备 |
| | | * @param deptId 机构ID,用于限定查询范围 |
| | | * @return 设备列表 |
| | | */ |
| | | @Override |
| | | public List<FwDeviceVO> getNonDeptAreaDevices() { |
| | | // 1. 获取当前用户的部门ID |
| | | String currentDeptId = AuthUtil.getDeptId(); |
| | | Dept dept = SysCache.getDept(Long.valueOf(currentDeptId)); |
| | | // 3. 查询不在这些部门区域内的设备 |
| | | Region byCode = RegionCache.getByCode(dept.getAreaCode()); |
| | | List<FwDeviceVO> deviceList = baseMapper.selectNonDeptAreaDevices(byCode.getName(), currentDeptId); |
| | | public List<FwDeviceVO> getNonDeptAreaDevices(String regionCode, String deptId) { |
| | | // 1. 根据区域编码获取区域名称 |
| | | Region region = RegionCache.getByCode(regionCode); |
| | | String regionName = region != null ? region.getName() : null; |
| | | // 2. 查询不在这些部门区域内的设备 |
| | | List<FwDeviceVO> deviceList = baseMapper.selectNonDeptAreaDevices(regionName, deptId); |
| | | return deviceList; |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "是否被共享给当前机构") |
| | | private Boolean isShared; |
| | | |
| | | @ApiModelProperty(value = "共享记录ID") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long shareId; |
| | | } |