修改返回国家信息的数据结构

This commit is contained in:
2025-06-13 17:02:27 +08:00
parent 9460926eee
commit 3b8adef8ec

View File

@@ -14,6 +14,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/*
@@ -39,9 +40,13 @@ public class HostInfoController {
}
@GetMapping("country_info")
public BaseResponse<List<CountryInfoVO>> getCountryInfo(@RequestParam(name = "countryName") String countryName){
return ResultUtils.success(hostInfoService.getCountryInfo(countryName));
public BaseResponse<List<String>> getCountryInfo(@RequestParam(name = "countryName") String countryName){
List<CountryInfoVO> countryInfo = hostInfoService.getCountryInfo(countryName);
List<String>countryNameList = new ArrayList<>();
for (CountryInfoVO countryInfoVO : countryInfo) {
countryNameList.add(countryInfoVO.getCountryName());
}
return ResultUtils.success(countryNameList);
}
@PostMapping("query_count")