String hql = "from Items oi "
+ " where exists "
+ "( select 1 from Nodes n where oi.cId = n.cId and n.nodeId= ? )";
List params = new ArrayList();
params.add(nodeId);//固定參數信息
//組拼查詢的 檢驗項目串
if(null != existsItems && !"".equals(existsItems)){
StringBuffer strbuf = new StringBuffer();
strbuf.append(" and oi.ItemId not in ( ");//組成新的查詢條件
String[] items = existsItems.split(",");
for(int i=0;i<=items.length-1;i++){
if(i != 0){
strbuf.append(" , ");
}
strbuf.append(" ? ");//動態添加參數
params.add(items[i]);//同步添加變量
}
strbuf.append(" )");
hql += strbuf.toString();
}
List<Items> list = findListByHQL(hql, params); node