最近在使用spring boot ,在用前端访问后台时,获取公司所有部门,前端发送代码是:
this.$Request.get(this.$api.wj.getSectionList, userdata).then(res => {
//代码
}
后台接收代码是:
@GetMapping(value = "/getSectionList") @ResponseBody public R getUserList(@RequestBody WxSection wxSection) { List<WxSection> wxSections = wxSectionService.listWxSection(BeanUtil.beanToMap(wxSection, false, true)); return R.success(wxSections); }
报错如下:
Required request body is missing: public com.roach.util.result.R com.roach.assistant.controller.user.WxUserController.getSectionList(com.roach.assistant.domain.user.WxSection)"
}
检查参数都没错,后来把GET改为post即可
@PostMapping(value = "/getSectionList") @ResponseBody public R getUserList(@RequestBody WxSection wxSection) { List<WxSection> wxSections = wxSectionService.listWxSection(BeanUtil.beanToMap(wxSection, false, true)); return R.success(wxSections); }