在xml遍历数组id
function printSerialNumber() {
var arr = new Array();
if ($(".unclaimedId:checked").length == 0) {
$.jBox.alert('请至少选择一条数据打印');
return false;
} else {
$(".unclaimedId:checked").each(function () {
if ($(this).attr("checked") == "checked") {
arr.push($(this).val());
}
});
var url = "${ctx}/bz/unclaimed/printSerialNumber?ids=" + arr;
window.open(url);
}
}
<th><input type="checkbox" id="checkAll" style="display: inline-block; width:20px;height: 20px;"></th>
<input name="input_id" class="unclaimedId" type="checkbox" value="${bzDeceased.id}" style="display: inline-block; width:20px;height: 20px;">
$("#checkAll").click(function () {
$(".unclaimedId").attr("checked", this.checked);
addGhMap();
});
private String[] projectArr;
public String printSettled(BzListGroup bzListGroup, Model model) {
<if test="projectArr != null and projectArr.length > 0">
and blg.id in
<foreach collection="projectArr" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</if>
在service遍历数组id
service层
List<BzUnclaimedClearance> list1 = new ArrayList<>();
try {
if (ids != null && ids.length > 0) {
List<String> list = Arrays.asList(ids);
list1 = dao.printSettlementDetails(list);
}
} catch (Exception e) {
e.printStackTrace();
}
return list1;
}
xml文件遍历数组id
<if test="list.size()>0">
blg.id in
<foreach collection="list" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</if>