1.get请求传id
前台传递
export function delBlueprint(id) {
return request({
url: '/blueprint/blueprint/' + id,
method: 'get'
})
}
后台接收
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
}
2.get请求传对象
前台传递
export function listBlueprintCheck(query) {
return request({
url: '/blueprint/blueprint/checkList',
method: 'get',
params: query
})
}
后台接收
@GetMapping("/checkList")
public AjaxResult checkList(EngBlueprint engBlueprint) {
try {
startPage();
List<Map<String,Object>> list = engBlueprintService.selectEngBlueprintCheckList(engBlueprint);
return AjaxResult.success("查询成功", getDataTable(list));
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
3.传集合对象(get,post类似)
前台传递
export function listBlueprintCheck(query) {
return request({
url: '/blueprint/blueprint/checkList',
method: 'get',
params: query
})
}
后台接收
@GetMapping
public AjaxResult add(@RequestBody Map<String, Object> map) {
// User user = JSON.parseObject(JSON.toJSONString(map.get("form")), user .class);
// List<HashMap<String, String>> list = (List<HashMap<String, String>>) map.get("list");
// for (HashMap<String, String> hashMap : list) {
// User user = JSON.parseObject(JSON.toJSONString(hashMap), User.class);
// }
}
4.post请求传id
前台传递
export function resetCipher(id) {
return request({
url: '/user/resetCipher',
method: 'post',
id
})
}
前台传递
@PostMapping("/xxx")
public AjaxResult resetCipher(@RequestBody String id) {
Integer.parseInt(id);
}
网友评论