项目经验:通过开始时间、结束时间查询日期to_char()

/**

      * 构造查询条件

      */

     public String getConditions( List paramValueList, ZxDRgyjxx rgyjxx) {

            if(rgyjxx== null) return "";

           StringBuffer sb = new StringBuffer();

           if(rgyjxx.getSgfsfs()!= null&&! "".equals(rgyjxx.getSgfsfs().trim())){

                sb.append( " and sgfsfs=?");

                 paramValueList.add(rgyjxx.getSgfsfs());

           }

           if(rgyjxx.getQrzt()!= null&&! "".equals(rgyjxx.getQrzt().trim())){

                sb.append( " and qrzt=?");

                 paramValueList.add(rgyjxx.getQrzt());

           }

           if(rgyjxx.getStartTime()!= null&&! "".equals(rgyjxx.getStartTime())&& rgyjxx.getEndTime()!= null&&! "".equals(rgyjxx.getEndTime())){

                sb.append( " and to_char(jssj,'yyyy-mm-dd')>=to_char(?,'yyyy-mm-dd') and to_char(jssj,'yyyy-mm-dd')<=to_char(?,'yyyy-mm-dd')");

//              "  from  ZxDDbsszzpjjg  where to_char(id.pjsj,'yyyy-mm-dd')=to_char(?,' yyyy-mm -dd') and id.pjsd=? and id.jclb=? and id.stcd in (:strs)";

//              paramValueList.add("%"+rgyjxx.getSgfsfs()+"%");

                 paramValueList.add(rgyjxx.getStartTime());

                 paramValueList.add(rgyjxx.getEndTime());

           }

            return sb.toString();

     }


 

你可能感兴趣的:(oracle)