| | |
| | | @ToolParam(required = true, description = "作业类型列表") List<String> types, |
| | | @ToolParam(description = "返回条数,默认 20,最大 50") Integer limit) { |
| | | List<String> normalizedTypes = BuiltinToolGovernanceSupport.sanitizeStringList(types, "站点类型列表", 10, 32); |
| | | int finalLimit = BuiltinToolGovernanceSupport.normalizeLimit(limit, 20, 50); |
| | | List<DeviceSite> sites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>() |
| | | .in(DeviceSite::getType, normalizedTypes) |
| | | .orderByAsc(DeviceSite::getType) |
| | | .orderByAsc(DeviceSite::getSite) |
| | | .last("LIMIT " + finalLimit)); |
| | | // int finalLimit = BuiltinToolGovernanceSupport.normalizeLimit(limit, 20, 50); |
| | | // List<DeviceSite> sites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>() |
| | | // .in(DeviceSite::getType, normalizedTypes) |
| | | // .orderByAsc(DeviceSite::getType) |
| | | // .orderByAsc(DeviceSite::getSite) |
| | | // .last("LIMIT " + finalLimit)); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DeviceSite site : sites) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("id", site.getId()); |
| | | item.put("type", site.getType()); |
| | | item.put("site", site.getSite()); |
| | | item.put("name", site.getName()); |
| | | item.put("target", site.getTarget()); |
| | | item.put("label", site.getLabel()); |
| | | item.put("device", site.getDevice()); |
| | | item.put("deviceCode", site.getDeviceCode()); |
| | | item.put("deviceSite", site.getDeviceSite()); |
| | | item.put("channel", site.getChannel()); |
| | | item.put("status", site.getStatus()); |
| | | result.add(item); |
| | | } |
| | | // for (DeviceSite site : sites) { |
| | | // Map<String, Object> item = new LinkedHashMap<>(); |
| | | // item.put("id", site.getId()); |
| | | // item.put("type", site.getType()); |
| | | // item.put("site", site.getSite()); |
| | | // item.put("name", site.getName()); |
| | | // item.put("target", site.getTarget()); |
| | | // item.put("label", site.getLabel()); |
| | | // item.put("device", site.getDevice()); |
| | | // item.put("deviceCode", site.getDeviceCode()); |
| | | // item.put("deviceSite", site.getDeviceSite()); |
| | | // item.put("channel", site.getChannel()); |
| | | // item.put("status", site.getStatus()); |
| | | // result.add(item); |
| | | // } |
| | | return result; |
| | | } |
| | | } |