前端代码:
//保存
function save(event) {
$(event).button("loading");
$.ajax({
url: "${base}/platform/book/noth/addDo",
data: JSON.stringify({
"list": JSON.stringify($('#mainbody').tableinputtoJson())
}),
success: function (data) {
$(event).button("reset");
if (data.code === 0) {
Toast.success(data.msg);
$(this).modal('hide');
} else {
Toast.error(data.msg);
}
},
dataType: "json",
type: "POST",
contentType: 'application/json'
});
}
后台:
@At("/addDo")
@Ok("json")
@AdaptBy(type = JsonAdaptor.class)
@RequiresPermissions("platform.book.noth.add")
public Object addDo(@Param("list")List<Book_noth> maximums, HttpServletRequest req) {
try {
List<Book_noth> listForSave = new ArrayList<>();
if (null != maximums && !maximums.isEmpty()) {
for (Book_noth maximum : maximums) {
if (null != maximum.getMaximum()) {
listForSave.add(maximum);
}
}
bookNothService.dao().insert(listForSave);
}
return Result.success("system.success");
} catch (Exception e) {
return Result.error("system.error");
}
}
后台for循环那里报的错