zoukankan      html  css  js  c++  java
  • hibernate查询返回一个list ,Date类型追加数据

    public Pagination getLookPage(BeanPatrolScheduling beanPatrolScheduling, int pageNo, int pageSize) {
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
              Pagination pagination = new Pagination();
              StringBuffer sql = new  StringBuffer();
              sql.append("      select   "); 
              
              sql.append("      ps.id,ju.username,ps.patrol_times,ps.patrol_month, ps.result,ps.parkid");
               
              sql.append("      from patrol_scheduling ps, ");
             
              sql.append("      company_emp ce, ");
              
              sql.append("      jc_user ju ");
                   
              sql.append("      where ps.emp_id=ce.id ");
              
              sql.append("      and  ce.id=ju.user_id ");
              
              sql.append("      and ps.data_status=0");
              
              if(beanPatrolScheduling.getUserName()!= null && beanPatrolScheduling.getUserName()!= ""){
                  sql.append("   and  ju.username like '%"+beanPatrolScheduling.getUserName()+"%'" ); 
                  
              }
              String sqls =  sql.toString();
              Query query =   sessionFactory.getCurrentSession().createSQLQuery(sqls.toString());
              List list = query.list();
              List<BeanPatrolScheduling> result=new ArrayList<BeanPatrolScheduling>();
                if(list!=null&&list.size()>0){
                    
                     for (Object object : list) {
                            int i = 0;
                            BeanPatrolScheduling modell=new BeanPatrolScheduling();
                            Object[] temp = (Object[]) object;            
                            modell.setId(Integer.parseInt( temp[i++] +""));
                            modell.setUserName(String.valueOf( temp[i++]));
                            modell.setPatrol_times(Integer.parseInt( temp[i++] +""));
                            try {
                                modell.setPatrol_month(dateformat.parse( temp[i++] +""));
                            } catch (ParseException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                            modell.setResult(Integer.parseInt( temp[i++] +""));
                            modell.setParkid(String.valueOf(temp[i++]));
                            result.add(modell);
                     }
                 }
                
                pagination.setList(result);    
                pagination.setPageNo(pageNo);
                pagination.setPageSize(pageSize);
              
            return pagination;
        }
  • 相关阅读:
    CTF-Reverse-[GXYCTF2019]luck_guy
    凸度偏差与收益率曲线
    【翻译】理解 LSTM 网络
    基于 Keras 用 LSTM 网络做时间序列预测
    AIMR 固定收益推荐读物
    基于 Keras 用深度学习预测时间序列
    预测美国债券回报
    久期增加会提高长期预期回报吗?
    市场收益率预期与远期收益率
    sql server 查询时会锁表吗?
  • 原文地址:https://www.cnblogs.com/xinxin1994/p/6133539.html
Copyright © 2011-2022 走看看