uploadCosPrivateFile这个方法中定义的参数为什么用@Param注解
来源:3-9 司机实名认证,OCR识别证件信息(一)

Mr_kingyu先生
2025-05-26
这部分controller层代码为什么用@Param注解接收参数呢,如果是SpringMVC中,PostMapping定义接口不应该是用@RequestParam或者@RequestBody吗?@Param接收参数的作用是什么,这个注解一般应用在与数据库交互定义参数才对呀
@PostMapping("/uploadCosPrivateFile")
@SaCheckLogin
@Operation(summary = “上传文件”)
public R uploadCosPrivateFile(@Param(“file”) MultipartFile file, @Param(“module”) String module) {
if (file.isEmpty()) {
throw new HxdsException(“上传文件不能为空”);
}
try {
String path = null;
if (“driverAuth”.equals(module)) {
path = “/driver/auth/”;
} else {
throw new HxdsException(“module错误”);
}
HashMap map = cosUtil.uploadPrivateFile(file, path);
return R.ok(map);
} catch (IOException e) {
log.error(“文件上传到腾讯云错误”, e);
throw new HxdsException(“文件上传到腾讯云错误”);
}
}
1回答
-
神思者
2025-05-26
不需要写这个注解,笔误
00
相似问题