@ApiOperation(value = "增加修改用户")
@PostMapping("/addOrUpdateUser")
public JSONObject setStationProfile(@RequestParam("profile") MultipartFile profile,
@RequestParam("jsonObject") String jsonObject) {
JSONObject user=JSONObject.parseObject(jsonObject);
return stationService.addStation(profile,user);
}
在这里jsonObject中是实体类的string,JSONObject是alibaba的fastjson,将参数jsonObject通过parseObtect转换成实体类。
如果想要图片可传可不传,注解为
@RequestParam(value = "profile",required = false)