List list = metaDBQuery.getResult();
if (list.size() > 0) {
/*要将tablebacth中的条件放到此处才能正确的显示记录数,在此处的筛选条件的for循环与tablebacth不同,正确写法如下*/
for(int i = list.size() - 1; i >= 0; i--){
Map dataMap = (Map) list.get(i);
if (!"".equals(custIds)) {
String nowcustid="";
String sqlcustid = StringUtil.safeToString(dataMap.get("trueparentcusttid"), "");
sqlcustid=","+sqlcustid+",";
nowcustid=","+custIds+",";
if (!nowcustid.contains(sqlcustid)) {
list.remove(i);
}
}
if (!"".equals(sencendCustIds)) {
String nowchirdid="";
String sqlchirdid = StringUtil.safeToString(dataMap.get("truechirdcustid"), "");
sqlchirdid=","+sqlchirdid+",";
nowchirdid=","+sencendCustIds+",";
if (!nowchirdid.contains(sqlchirdid)) {
list.remove(i);
}
}
}
}
return list;
后端——》关于getResult方法通过for循环筛选查询条件的问题
最新推荐文章于 2022-08-06 09:22:54 发布