| | |
| | | @Override |
| | | public R getSiteNos() { |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_CHECK_IN.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().add(sites); |
| | | } |
| | | |
| | |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_CHECK_IN.type); |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .in(DeviceSite::getType, list) |
| | | .groupBy(DeviceSite::getSite) |
| | | .last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("库口不为空!!"); |