时间:2021-07-01 10:21:17 帮助过:3人阅读
DaoImpl:
/**
* 开发转让页面展示 ,查询搜索数据,并且分页展示
* @param zrdp 搜索条件封装对象
* @return
*/
@SuppressWarnings("unchecked")
public List
Stringsql ="select * from zrdpxx where dpxx_htaiztai = 2";
if(zrdp!=null){
if(zrdp.getDpxxId()!=null&&!zrdp.getDpxxId().equals("")){
sql+=" and dpxx_id =" +zrdp.getDpxxId();
}
if(zrdp.getDpxxQyu()!=null&&!zrdp.getDpxxQyu().equals("-选择区域-")){
sql+=" and dpxx_qyu = '"+zrdp.getDpxxQyu()+"'";
}
if(zrdp.getDpxxPyetai()!=null&&!zrdp.getDpxxPyetai().equals("")){
sql+=" and dpxx_pyetai = '"+zrdp.getDpxxPyetai()+"'";
}
if(zrdp.getDpxxZyetai()!=null&&!zrdp.getDpxxZyetai().equals("0")&&!zrdp.getDpxxZyetai().equals("null")){
sql+=" and dpxx_zyetai = '"+zrdp.getDpxxZyetai()+"'";
}
if(zrdp.getBigmji()!=0&&zrdp.getSmlmj()!=-1){
sql += " and dpxx_mji between "+zrdp.getSmlmj()+" and " +zrdp.getBigmji();
}
//开始时间和结束时间均有值
if(zrdp.getBeginTime()!=null&&!zrdp.getBeginTime().equals("")&&zrdp.getEndTimes()!=null&&!zrdp.getEndTimes().equals("null")){
sql +=" and dpxx_fbusjian between '"+zrdp.getBeginTime()+"' and '"+zrdp.getEndTimes()+"'";
}
//只有开始时间
if(zrdp.getBeginTime()!=null&&!zrdp.getBeginTime().equals("")&&zrdp.getEndTimes()==null){
sql +=" and dpxx_fbusjian between '"+zrdp.getBeginTime()+"' and now()";
}
if(!("标题 地址 电话").equals(keys)){
sql +=" and (dpxx_bti like '%"+keys+"%' or tel like '%"+keys+"%' or dpxx_jtidzhi like '%"+keys+"%')";
}
sql +=" order by dpxx_fbusjian desc";
}
return getSession().createSQLQuery(sql).addEntity(Zrdpxx.class).setFirstResult((pageindex-1)*20).setMaxResults(20).list();
}
//public int getallzrdpcounts() {
//Object oo = getSession().createSQLQuery("select count(dpxx_id) from zrdpxx where dpxx_htaiztai =2").uniqueResult();
//return Integer.parseInt(oo.toString());
/