| | |
| | | */ |
| | | @Override |
| | | public R getDeviceSites() { |
| | | List<DeviceSite> sites = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>() |
| | | // 先查全部再按 site 去重,避免 GROUP BY 与 only_full_group_by 冲突 |
| | | List<DeviceSite> all = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>() |
| | | .select(DeviceSite::getId, DeviceSite::getSite, DeviceSite::getName) |
| | | .eq(DeviceSite::getStatus, 1) |
| | | .groupBy(DeviceSite::getSite, DeviceSite::getId, DeviceSite::getName)); |
| | | .eq(DeviceSite::getStatus, 1)); |
| | | List<DeviceSite> sites = all.stream() |
| | | .collect(Collectors.toMap(DeviceSite::getSite, d -> d, (a, b) -> a)) |
| | | .values().stream() |
| | | .collect(Collectors.toList()); |
| | | return R.ok(sites); |
| | | } |
| | | |
| | |
| | | TaskType.TASK_TYPE_OUT.type, |
| | | TaskType.TASK_TYPE_MERGE_OUT.type, |
| | | TaskType.TASK_TYPE_PICK_AGAIN_OUT.type); |
| | | List<DeviceSite> sites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>().in(DeviceSite::getType, list).groupBy(DeviceSite::getSite)); |
| | | // 先查全部再按 site 去重,避免 GROUP BY 与 only_full_group_by 冲突 |
| | | List<DeviceSite> all = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>().in(DeviceSite::getType, list)); |
| | | List<DeviceSite> sites = all.stream() |
| | | .collect(Collectors.toMap(DeviceSite::getSite, d -> d, (a, b) -> a)) |
| | | .values().stream() |
| | | .collect(Collectors.toList()); |
| | | return R.ok(sites); |
| | | } |
| | | |