@PostMapping("/queryLicenseReminder") public ApiResult queryLicenseReminder() { Long retailShopId = AccessContext.get().getRetailShopId(); Map<String, List> map = new HashMap<>(3); if (retailShopId != null) { List<GspCompanyLicenseVO> gspCompanyLicenseList = gspCompanyLicenseService.queryLicenseReminder(retailShopId); List<GspUserLicenseVO> gspUserLicenseList = gspUserLicenseService.queryLicenseReminder(retailShopId); List<RetailShopLicenseVO> retailShopLicenseVOList = retailShopLicenseService.queryLicenseReminder(retailShopId); map.put("gspCompanyLicenseList", gspCompanyLicenseList); map.put("gspUserLicenseList", gspUserLicenseList); map.put("retailLicenseList", retailShopLicenseVOList); } return ApiResult.success(map); }改为查询所有门店不按照门店ID查询
时间: 2024-03-16 20:47:28 浏览: 91
@Validated验证List集合的方法示例
可以将原先的 `Long retailShopId = AccessContext.get().getRetailShopId();` 改为获取所有门店的 ID 列表,然后遍历这些门店 ID,逐个查询每个门店的 License Reminder,将每个门店的查询结果存储到一个 List 中,最后将这个 List 作为整个 API 的返回值即可。具体实现可以参考下面的代码:
```
@GetMapping("/queryLicenseReminder")
public ApiResult queryLicenseReminder() {
List<Long> retailShopIdList = retailShopService.getAllRetailShopIds(); // 获取所有门店的 ID 列表
List<Map<String, List>> resultList = new ArrayList<>(); // 存储所有门店的查询结果
for (Long retailShopId : retailShopIdList) {
Map<String, List> map = new HashMap<>(3);
List<GspCompanyLicenseVO> gspCompanyLicenseList = gspCompanyLicenseService.queryLicenseReminder(retailShopId);
List<GspUserLicenseVO> gspUserLicenseList = gspUserLicenseService.queryLicenseReminder(retailShopId);
List<RetailShopLicenseVO> retailShopLicenseVOList = retailShopLicenseService.queryLicenseReminder(retailShopId);
map.put("gspCompanyLicenseList", gspCompanyLicenseList);
map.put("gspUserLicenseList", gspUserLicenseList);
map.put("retailLicenseList", retailShopLicenseVOList);
resultList.add(map);
}
return ApiResult.success(resultList);
}
```
阅读全文