<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 167,  comments - 30,  trackbacks - 0
     public List<CertInfoListView> getInfoList(CertInfoListView view) throws DAOException {
      List<CertInfoListView>  liinfo = new ArrayList<CertInfoListView>();
      String sql="select b.usercode,b.agentcode,i.sn,i.cert,i.certstate,i.endtime, i.ipasskeyno,b.id,b.addtime  from certbind b inner join certinfo i on b.ipasskeyno=i.ipasskeyno";
      Session session = HibernateTemplate.getInstance().getSession();
      StringBuffer sb = new StringBuffer(sql);
      sb.append(" where 1=1 ");
      if(!CheckEmpty.isEmpty(view.getIpasskeyno())){
       sb.append(" and i.ipasskeyno ='").append(view.getIpasskeyno()).append("'");
      }
      if(!CheckEmpty.isEmpty(view.getAgentcode())){
       sb.append(" and b.agentcode ='").append(view.getAgentcode()).append("'");
      }
      if(!CheckEmpty.isEmpty(view.getSn())){
       sb.append(" and i.sn ='").append(view.getSn()).append("'");
      }
      if(!CheckEmpty.isEmpty(view.getUsercode())){
       sb.append(" and b.usercode ='").append(view.getUsercode()).append("'");
      }
      if(view.getAddtime()!=null){
       sb.append(" and b.addtime=").append(view.getAddtime());
      }
      sb.append(" order by ipasskeyno ,addtime desc");
      Query q = session.createSQLQuery(sb.toString());
      int pageno = view.getPageno();
      int size = view.getPagesize();
      if(pageno!=0&&size!=0){
       q.setFirstResult((pageno-1)*size);
       q.setMaxResults(size);
      }
      List list = q.list();
      Iterator it = list.iterator();
      while(it.hasNext()){
       Object[] obj = (Object[])it.next();
       CertInfoListView c = new CertInfoListView();
       for(int i=0;i<obj.length;i++){
        if(!CheckEmpty.isEmpty((String)obj[0])){
         c.setUsercode((String)obj[0]);
        }
        if(!CheckEmpty.isEmpty((String)obj[1])){
         c.setAgentcode((String)obj[1]);
        }
        if(!CheckEmpty.isEmpty((String)obj[2])){
         c.setSn((String)obj[2]);
        }
        if(obj[3]!=null){
         SerializableClob sc = (SerializableClob)obj[3];
         String cc = null;
         if(sc!=null){
          try {
           cc = sc.getSubString(1, (int)sc.length());
          } catch (SQLException e) {
          }
         }
         if(cc!=null)c.setCert(cc);
        }
        if(obj[4]!=null){
         BigDecimal b = (BigDecimal)obj[4];
         c.setCertstate(b.intValue());
        }
        if((obj[5])!=null){
         c.setEndtime(((Date)obj[5]));
        }
        if(!CheckEmpty.isEmpty((String)obj[6])){
         c.setIpasskeyno((String)obj[6]);
        }
        c.setCertbindid(Integer.parseInt((String)obj[7]));
        c.setAddtime((Date)obj[8]);
       }
       liinfo.add(c);
      }
      if(session!=null&&session.isConnected())session.close();
      return liinfo;
     }


    實(shí)現(xiàn)分頁(yè)的DAO
    /*
      * (non-Javadoc)
      *
      * @see com.cns.certservice.dao.CertBindTabDao#getCertBindList(com.cns.certservice.vo.CertBindView)
      */
     public List<CertBindView> getCertBindList(CertBindView view)
       throws DAOException {
      List<CertBindView> li = null;
      List<Certbind> lic = null;
      Session session = null;
      try {
       session = HibernateTemplate.getInstance().getSession();
       Criteria cri = session.createCriteria(Certbind.class);
       Certbind c = getCertBind(view);
       if (c.getAddtime() != null) {
        cri.add(Expression.eq("addtime", c.getAddtime()));
       }
       if (!CheckEmpty.isEmpty(c.getAgentcode())) {
        cri.add(Expression.eq("agentcode", c.getAgentcode()));
       }
       if(c.getId()!=0)cri.add(Expression.eq("id", c.getId()));
       if (!CheckEmpty.isEmpty(c.getIpasskeyno())) {
        cri.add(Expression.eq("ipasskeyno", c.getIpasskeyno()));
       }
       if (!CheckEmpty.isEmpty(c.getUsercode())) {
        cri.add(Expression.eq("usercode", c.getUsercode()));
       }
       if (!CheckEmpty.isEmpty(c.getExtend1())) {
        cri.add(Expression.eq("extend1", c.getExtend1()));
       }
       if (!CheckEmpty.isEmpty(c.getExtend2())) {
        cri.add(Expression.eq("extend2", c.getExtend2()));
       }
       if (c.getAgenttype() != 0) {
        cri.add(Expression.eq("agenttype", c.getAgenttype()));
       }
       int pageno = view.getPageno();
       int size = view.getPagesize();
       if(pageno!=0&&size!=0){
        cri.setFirstResult((pageno-1)*size);
        cri.setMaxResults(size);
       }
       lic = cri.list();
       if (lic != null) {
        li = new ArrayList<CertBindView>();
        for (Certbind cer : lic) {
         CertBindView v = getCertBindView(cer);
         li.add(v);
        }
       }
       
      } catch (HibernateException e) {
       log.error(e,e);
       throw new DAOException(e);
      }finally{
       if (session != null && session.isConnected())
        session.close();
      }
      return li;
     }
     public int getInfoListCount(CertBindView view) throws DAOException {
      int count = 0;
      Session session = null;
      try {
       session = HibernateTemplate.getInstance().getSession();
       Criteria cri = session.createCriteria(Certbind.class);
       Certbind c = getCertBind(view);
       if (c.getAddtime() != null) {
        cri.add(Expression.eq("addtime", c.getAddtime()));
       }
       if (!CheckEmpty.isEmpty(c.getAgentcode())) {
        cri.add(Expression.eq("agentcode", c.getAgentcode()));
       }
       if(c.getId()!=0)cri.add(Expression.eq("id", c.getId()));
       if (!CheckEmpty.isEmpty(c.getIpasskeyno())) {
        cri.add(Expression.eq("ipasskeyno", c.getIpasskeyno()));
       }
       if (!CheckEmpty.isEmpty(c.getUsercode())) {
        cri.add(Expression.eq("usercode", c.getUsercode()));
       }
       if (!CheckEmpty.isEmpty(c.getExtend1())) {
        cri.add(Expression.eq("extend1", c.getExtend1()));
       }
       if (!CheckEmpty.isEmpty(c.getExtend2())) {
        cri.add(Expression.eq("extend2", c.getExtend2()));
       }
       if (c.getAgenttype() != 0) {
        cri.add(Expression.eq("agenttype", c.getAgenttype()));
       }
       count = (Integer)cri.setProjection(Projections.rowCount()).uniqueResult();
       cri.setProjection(null);
      } catch (HibernateException e) {
       log.error(e,e);
       throw new DAOException(e);
      }finally{
       if (session != null && session.isConnected())
        session.close();
      }
      return count;
     }

    /*
      * (non-Javadoc)
      *
      * @see com.cns.certservice.dao.CertBindTabDao#updateCertBind(com.cns.certservice.vo.CertBindView)
      */
     public boolean updateCertBind(CertBindView view) throws DAOException {
      boolean res = false;
      if (view.getId()==0) {
       throw new DAOException("getId from CertBindView is null!");
      }
      Session session= null;
      try {
       session = HibernateTemplate.getInstance().getSession();
       Certbind c = (Certbind) session.get(Certbind.class, view.getId());
       if (!CheckEmpty.isEmpty(view.getAgentcode()))
        c.setAgentcode(view.getAgentcode());
       if (!CheckEmpty.isEmpty(view.getExtend1()))
        c.setExtend1(view.getExtend1());
       if (!CheckEmpty.isEmpty(view.getExtend2()))
        c.setExtend2(view.getExtend2());
       if (!CheckEmpty.isEmpty(view.getIpasskeyno()))
        c.setIpasskeyno(view.getIpasskeyno());
       if (!CheckEmpty.isEmpty(view.getUsercode()))
        c.setUsercode(view.getUsercode());
       if (view.getAgenttype() != 0)
        c.setAgenttype(view.getAgenttype());
       res = HibernateTemplate.getInstance().updateObject(c);
      } catch (HibernateException e) {
       log.error(e,e);
       throw new DAOException(e);
      }finally{
       if (session != null && session.isConnected())
        session.close();
      }
      return res;
     }


     private Certbind getCertBind(CertBindView view) {
      Certbind c = new Certbind();
      if (view.getAddtime() != null)
       c.setAddtime(view.getAddtime());
      if (!CheckEmpty.isEmpty(view.getAgentcode()))
       c.setAgentcode(view.getAgentcode());
      if (!CheckEmpty.isEmpty(view.getExtend1()))
       c.setExtend1(view.getExtend1());
      if (!CheckEmpty.isEmpty(view.getExtend2()))
       c.setExtend2(view.getExtend2());
      if (!CheckEmpty.isEmpty(view.getIpasskeyno()))
       c.setIpasskeyno(view.getIpasskeyno());
      if (!CheckEmpty.isEmpty(view.getUsercode()))
       c.setUsercode(view.getUsercode());
      if(view.getId()!=0)c.setId(view.getId());
      if (view.getAgenttype() != 0)
       c.setAgenttype(view.getAgenttype());
      return c;
     }

     private CertBindView getCertBindView(Certbind view) {
      CertBindView c = new CertBindView();
      if (view.getAddtime() != null)
       c.setAddtime(view.getAddtime());
      if (!CheckEmpty.isEmpty(view.getAgentcode()))
       c.setAgentcode(view.getAgentcode());
      if (!CheckEmpty.isEmpty(view.getExtend1()))
       c.setExtend1(view.getExtend1());
      if (!CheckEmpty.isEmpty(view.getExtend2()))
       c.setExtend2(view.getExtend2());
      if (!CheckEmpty.isEmpty(view.getIpasskeyno()))
       c.setIpasskeyno(view.getIpasskeyno());
      if (!CheckEmpty.isEmpty(view.getUsercode()))
       c.setUsercode(view.getUsercode());
      if(view.getId()!=0)c.setId(view.getId());
      if (view.getAgenttype() != 0)
       c.setAgenttype(view.getAgenttype());
      return c;
     }

    posted on 2009-08-20 13:37 David1228 閱讀(861) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Hibernate/ibatis

    <2009年8月>
    2627282930311
    2345678
    9101112131415
    16171819202122
    23242526272829
    303112345

    常用鏈接

    留言簿(4)

    隨筆分類(lèi)

    隨筆檔案

    文章檔案

    新聞分類(lèi)

    新聞檔案

    相冊(cè)

    收藏夾

    Java

    Linux知識(shí)相關(guān)

    Spring相關(guān)

    云計(jì)算/Linux/虛擬化技術(shù)/

    友情博客

    多線程并發(fā)編程

    開(kāi)源技術(shù)

    持久層技術(shù)相關(guān)

    搜索

    •  

    積分與排名

    • 積分 - 359875
    • 排名 - 154

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 99re6热视频精品免费观看| 2021久久精品免费观看| 亚洲AV人人澡人人爽人人夜夜| 久久国产免费观看精品| 亚洲成年人电影在线观看| 国产特级淫片免费看| 女同免费毛片在线播放| 精品亚洲AV无码一区二区| 亚洲电影日韩精品| 91精品全国免费观看含羞草| 亚洲精品无码av片| 亚洲αv久久久噜噜噜噜噜| 最近最新的免费中文字幕 | 91视频免费观看| 亚洲免费二区三区| 亚洲欧洲日产国码高潮αv| 在线看片免费人成视久网| 日韩成人精品日本亚洲| 亚洲第一区香蕉_国产a| 又大又黄又粗又爽的免费视频| 日本在线免费观看| 美女视频黄a视频全免费网站色| 亚洲免费视频网站| 亚洲国产专区一区| 美女网站免费福利视频| 男人天堂免费视频| 婷婷国产偷v国产偷v亚洲| 亚洲综合在线成人一区| 亚洲精品无码久久不卡| 成年女人男人免费视频播放| 大地影院MV在线观看视频免费| 亚洲heyzo专区无码综合| 亚洲黄色免费在线观看| 久久青青草原亚洲av无码| 在线观看免费大黄网站| 99久久免费看国产精品| 中文字幕在线免费观看视频| 亚洲丰满熟女一区二区哦| 亚洲激情黄色小说| 亚洲成Av人片乱码色午夜| 亚洲国产成人久久一区久久|