SpringBoot Controller接口接收前台传来的数组参数示例:
前台
$.ajax({
url: interface_apps,
async: false,
type: 'DELETE',
data: JSON.stringify(appCodes),
async: false,
contentType: 'application/json;charset=UTF-8',
success: function (resultData) {
},
error: function () {
}
});
其中,appCodes
为js数组。
后台
@DeleteMapping
public ResponseResult deleteApps(@RequestBody String[] appCodes) {
return service.deleteApps(appCodes);
}