以列表方式向后台传参
@ApiOperation(value = "批量更新Onsiteptw2aqzyd详细信息", notes = "根据对象的id来更新对象,并根据传过来的集合中的Onsiteptw2aqzyd信息来更新集合中的Onsiteptw2aqzyd详细信息")
@ApiImplicitParams({@ApiImplicitParam(name = "pojoList", value = "更新的对象", required = true, dataType = "List<Onsiteptw2aqzyd>")})
@PutMapping("/v1/onsiteptw2aqzyd/batchupdate")
public Response updateOnsiteptw2aqzyd(@RequestBody List<Onsiteptw2aqzyd> pojoList) {
...
}
var fields2obj = [];
for(i = 0; i < chacks2Val.length; i++) { console.debug(chacks2Val[i]) ;
var fields2 = {};
var aqzydtype = chacks2Val[i];
var isneedaqzyd = '是';
var create_by = '';
fields2["id"] = chacks2Id[i];
fields2["aqzydtype"] = aqzydtype;
fields2["isneedaqzyd"] = isneedaqzyd;
fields2["onsiteptw"] = obj["onsiteptw"];
fields2obj.push(fields2);
}
pojoList2 = JSON.stringify(fields2obj);
$.ajax({
url: url2,
data:pojoList2,
type: "put",
dataType: "json",
headers: {
Authorization: authtoken,
},
contentType:"application/json",
success: function (result) {
console.debug('success:'+JSON.stringify(result));
mui.toast("OK");
},
error:function(e){
console.debug('error:'+JSON.stringify(e));
}
});