以对象方式向后台传参
@ApiOperation(value = "更新Onsiteptw1yfcs详细信息", notes = "根据url的id来指定更新对象,并根据传过来的Onsiteptw1yfcs信息来更新Onsiteptw1yfcs详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "listpojo", value = "更新的对象", required = true, dataType = "List<Onsiteptw1yfcs>"),
@ApiImplicitParam(name = "setfield", value = "跟新listpojo中对象的那些字段对应的类字段不是表字段 不填默认更新所有字段 列如: item1,item2,item3", required = false, dataType = "String"),
@ApiImplicitParam(name = "mapfilter", value = "更新条件,在数据写好条件放上就好了 以集合形式接收 例如:{”column1=“:“2”,”column2 like “:”%li%“ } ", required = true, dataType = "Onsiteptw1yfcs")})
@PutMapping("/v1/onsiteptw1yfcs/moreupdate")
public Response updateBatchOnsiteptw1yfcs(@RequestBody Onsiteptw1yfcsParam param) {
...
}
var listpojo = {};
listpojo["mapfilter"] = {};
listpojo["setfield"] = "infoname,infocnt";//infoname = '吊车:RTFK-120' , infocnt = '是'
listpojo["listpojo"] = fields1;
listpojo1 = JSON.stringify(listpojo);console.debug('478::listpojo1>>>'+listpojo1);
$.ajax({
url: url1,
data:listpojo1,
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));
}
});