stringbuffer buf = new stringbuffer(); if (!forobject) { buf.append("select count(*) "); } buf.append("from agent agent where 1=1 ");
string gradeid = (string)conditions.get("gradeid"); if(gradeid != null && !gradeid.equals("") && gradeid != ""){ buf.append(" and agent.gradeid=").append(gradeid); }
buf.append(" and agent.agentid in (:agentids) ");
query query = sess.createquery(buf.tostring()); list ids = commisioninfodelegateext.findagentidlist(conditions); system.out.println("ids.length=" + ids.size()); query.setparameterlist("agentids", ids);
当ids长度为0(空记录)时,query.list()出错.没办法,现在在ids.add("-1"),塞入一条绝对不存在的记录id(绝对是不可能的).
