Apifox与注解


使用@RequestParam时,若不是表单上传,可以用FormData进行Ajax请求
例子:
Controller层:

@PostMapping("/deleteProduct")
    public CommonResp deleteProduct(@RequestParam("id") Integer id){
        return productService.deleteProduct(id) ? CommonResp.success("删除成功"):CommonResp.failed("删除失败");
    }

js:

export const goodsDelete=(data)=>{
  var form=new FormData()
  form.append("id",data)

  return post({
    url:'/deleteProduct',
    data:form
  })
}
posted @ 2023-05-07 22:23  CC&  阅读(557)  评论(0)    收藏  举报