requestbody 前台如何传值_前端与后端之间参数的传递与接收和@RequestBody,@Requestparam,@Param三个注解的使用...

参数在前台通过对象的形式传递到后台,在后台,可以用@RequestBody注解通过Map或JSONObject接收(太麻烦,既要从Map中取值,取完值后又要封装到Map),也可以用@RequestParam注解通过具体的属性接收。在dao层可以通过Map将参数传递到mapper.xml,也可以用@Param注解将具体的属性值传递到Mapper.xml。

前端代码:

前端传递给后台一个对象。

data() {

return{

listQuery: {

page: 1,

limit: 20,

dataCode: null,

dataName: null,

// enterpriseId: null,

enterpriseType: null},

},

getList() {this.listLoading = truedataSet.getList(this.listQuery).then(response =>{if(response.success) {this.list =response.datathis.total =response.total

}else{this.$message.error("数据集合信息获取失败")

}

}).catch(error =>{

console.log(error)this.$message.error("发生内部错误,请联系管理员")

}).finally(() =>{this.listLoading = false})

},

getLis


版权声明:本文为weixin_34419561原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。