zx_bing

          人生路漫漫,多學些知識總是有益處的
          隨筆 - 32, 文章 - 0, 評論 - 0, 引用 - 0

          導航

          <2012年7月>
          24252627282930
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          hibernate 多條件查詢

          Java代碼 復制代碼 收藏代碼
          1. public List<Client> searchClients(String clientName, String tel, 
          2.             String identityNo) { 
          3.  
          4.         StringBuffer sb = new StringBuffer("from Client c where 1=1"); 
          5.          
          6.         if(clientName != null && !"".equals(clientName) ){ 
          7.             sb.append("and c.name like '%" + clientName + "%'"); 
          8.         } 
          9.         if(tel != null && !"".equals(tel)){ 
          10.             sb.append("and c.tel = " + tel); 
          11.         } 
          12.         if(identityNo != null && !"".equals(identityNo)){ 
          13.             sb.append("and c.identityNo = " + identityNo); 
          14.         } 
          15.         return clientDao.searchClients(sb.toString()); 

          posted on 2012-07-27 14:08 zx_bing 閱讀(330) 評論(0)  編輯  收藏 所屬分類: Hibernate

          主站蜘蛛池模板: 九龙县| 商洛市| 荣成市| 巍山| 彰化市| 凤翔县| 隆子县| 柳州市| 健康| 威海市| 永州市| 邯郸市| 固阳县| 依安县| 连州市| 邵阳县| 浦县| 徐闻县| 东莞市| 德州市| 蒙城县| 桦川县| 张家口市| 英超| 富宁县| 阜阳市| 岢岚县| 同德县| 台山市| 磐石市| 三门峡市| 九江县| 财经| 涡阳县| 黄大仙区| 大田县| 靖州| 扎鲁特旗| 罗平县| 民丰县| 安达市|