伙伴匹配系统踩坑日记8 controller传参
伙伴匹配系统踩坑日记8 controller传参
后端
参数映射

在swagger里传空值,发现有问题

在方法中加入@requestparam注解

@GetMapping("search/tags")
public BaseResponse<List<User>> searchusersByTags(@RequestParam List<String> tagNameList){
if(CollectionUtils.isEmpty(tagNameList)){
throw new BusinessException(ErrorCode.PARAMS_ERROR);
}
List<User> userList=userService.searchUsersByTags(tagNameList);
return ResultUtils.success(userList);
}
关于RequestParam注解,见https://blog.csdn.net/qq_61668277/article/details/140857451

浙公网安备 33010602011771号