⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdscwddao.java

📁 以前做的一个j2ee的项目
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
           //list = (List) selectAll("WDSC.selectWdByNsrnbm", this);
           //if ((list != null) && list.size() >= 1) wd = (WDSCwdDAO) list.get(0);

           String sql = " SELECT " +
                " WD_MC, WD_SM, WD_NR, WDSC_SJ, WDXG_SJ, MB_BM, CZY_BM, SWJG " +
                " FROM T_WDSC_WD " +
                " WHERE WD_MC like '" + this.getM_wdmc() + "' " +
                " AND SWJG like '" + this.getM_swjg() + "' " +
                " ORDER BY WDXG_SJ DESC ";
           //由于使用weblogic连接池,故只有直接通过sql取blob
           //this.getSqlMapClient();
           //sqlMap.startTransaction();
           //conn = sqlMap.getCurrentConnection();
           conn = JDBCLocator.getInstance().getJDBCConnection();

           Statement st = conn.createStatement();
           ResultSet rs = st.executeQuery(sql);

           if (rs.next()) {
               wd.setM_wdmc(rs.getString("WD_MC"));
               wd.setM_wdsm(rs.getString("WD_SM"));
               wd.setM_wdnr((java.sql.Blob)rs.getBlob("WD_NR"));
               wd.setM_wdscsj(rs.getDate("WDSC_SJ"));
               wd.setM_wdscsj(rs.getDate("WDXG_SJ"));
               wd.setM_wdmbbm(rs.getString("MB_BM"));
               wd.setM_wdczy(rs.getString("CZY_BM"));
               wd.setM_swjg(rs.getString("SWJG"));
           }
           rs.close();
           st.close();
           //sqlMap.commitTransaction();
       } catch (Exception ex) {
          //ex.printStackTrace();
          //log.bizInfo(ex.getMessage());
          throw new Exception("YCWDSC21000");//通过纳税人内部码得到最新一条文档失败!" + ex.getMessage());
       } finally {
           conn.close();
       }

       return wd;
   }


   //通过修改时间查找文档(时间范围)
   //参数分别为:时间起,时间止
   /*
   public List getWdByXgsj(Date sjq, Date sjz) throws Exception {
       WDSCwdDAO wd = null;
       try {
           HashMap sssq = new HashMap();
           sssq.put("sjq", sjq);
           sssq.put("sjz", sjz);
           sssq.put("swjg", this.getM_swjg());
           return selectAll("WDSC.selectWdByXgsj", sssq);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }
   */
   /*
   public List getAllWd() throws Exception {
       List list = null;
       try {
           list = selectAll("WDSC.selectAllWd", null);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

       return list;
   }
   */

/*
   public void insertWd(WDSCwdDAO wd) throws Exception {
       if (wd == null) return;
       Calendar cal = Calendar.getInstance();
       cal.setTime(wd.getM_wdxgsj());
       int year, month, day, hour, minute, second, millisecond;//MILLISECOND
       year = cal.get(Calendar.YEAR);
       month = cal.get(Calendar.MONTH) + 1;
       day = cal.get(Calendar.DATE);
       hour = cal.get(Calendar.HOUR_OF_DAY);
       minute = cal.get(Calendar.MINUTE);
       second = cal.get(Calendar.SECOND);
       millisecond = cal.get(Calendar.MILLISECOND);
       String dayTime_q = String.valueOf(year) + "-" + String.valueOf(month) +
                        "-" +String.valueOf(day) + " " +
                        String.valueOf(hour) + ":" + String.valueOf(minute) + ":" +
                        String.valueOf(second);
       String dayTime_z = "";

       if ((second + 1) == 60) {
           dayTime_z = String.valueOf(year) + "-" + String.valueOf(month) +
                              "-" + String.valueOf(day) + " " +
                              String.valueOf(hour) + ":" + String.valueOf(minute) +
                              ":" +
                              String.valueOf(second + 1);

       } else {
           dayTime_z = String.valueOf(year) + "-" + String.valueOf(month) +
                              "-" + String.valueOf(day) + " " +
                              String.valueOf(hour) + ":" + String.valueOf(minute) +
                              ":" +
                              String.valueOf(second + 1);
       }
       String key = " wd_mc = '" + wd.getM_wdmc() +
                    "' and WDXG_SJ >= to_date('" + dayTime_q + "', 'YYYY-MM-DD HH24:MI:SS') " +
                    " and WDXG_SJ < to_date('" + dayTime_z + "', 'YYYY-MM-DD HH24:MI:SS') ";

       wd.setSqlMap(this.getSqlMapClient());
       BLOB blob = (BLOB)wd.getM_wdnr();
       if (blob.equals(BLOB.empty_lob()) ) {
           //OracleBlobOperation.insertOracleBlob(wd, "t_wdsc_wd", "wd_nr", key);
           OracleBlobOperation.insertOracleBlob(wd);
       }
   }
 */
    //insert
    public void insertWd(WDSCwdDAO wd) throws Exception {
        if (wd == null) return;
        try {
            OracleBlobOperation.insertOracleBlob(wd);
        } catch(SQLException e) {
            //e.printStackTrace();
            throw new SQLException("YCWDSC21001");//:插入文档失败!" + e.getMessage());
        } catch (Exception ex) {
          //ex.printStackTrace();
          throw new Exception("YCWDSC21001");//:插入文档失败!" + ex.getMessage());
       }

    }


   public void insertWd() throws Exception {
       try {
           insertWd(this);
       } catch(SQLException e) {
            throw new SQLException("YCWDSC21001");//:插入文档失败" + e.getMessage());
        } catch (Exception ex) {
          throw new Exception("YCWDSC21001");//:插入文档失败!" + ex.getMessage());
       }


   }

   /////////////////////////////////////////////////////////////////////////////
/*   public void updateWd(WDSCwdDAO wd) throws Exception {
       if (wd == null) return;
       try {
           this.update("WDSC.updateWdBlobEmpty", this);
           this.update("WDSC.updateWd", wd);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }

   public void updateWd() throws Exception {
       try {
           this.update("WDSC.updateWdBlobEmpty", this);
           this.update("WDSC.updateWd", this);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }

   public void updateWdBlob(WDSCwdDAO wd) throws Exception {
       if (wd == null) return;
       try {
           this.update("WDSC.updateWdBlobEmpty", this);
           this.update("WDSC.updateWd", wd);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }

   public void updateWdBlob() throws Exception {
       if (this.getM_wdnr() == null) return;
       try {
           this.update("WDSC.updateWdBlobEmpty", this);
           this.update("WDSC.updateWdBlob", this);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }

   public void updateWdBlobEmpty(WDSCwdDAO wd) throws Exception {
       if (wd == null) return;
       try {
           this.update("WDSC.updateWdBlobEmpty", wd);
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
       }

   }

   public void updateWdBlobEmpty() throws Exception {
      if (this.getM_wdnr() == null) return;
      try {
          this.update("WDSC.updateWdBlobEmpty", this);
      } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception(ex.getMessage());
      }
   }
*/
   /////////////////////////////////////////////////////////////////////////////
   public void deleteWd(String bm) throws Exception {
       this.setM_wdmc(bm);
       try {
           this.delete("WDSC.deleteWd");
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception("YCWDSC21002");//:删除文档失败!" + ex.getMessage());
       }
   }

   public void deleteWd() throws Exception {
       try {
           this.delete("WDSC.deleteWd");
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception("YCWDSC21002");//:删除文档失败!" + ex.getMessage());
       }
   }

   public int deleteWdByNsrnbm() throws Exception {
       try {
           return this.delete("WDSC.deleteWdByNsrnbm");
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception("YCWDSC21002");//:删除文档失败!" + ex.getMessage());
       }
   }

   public int deleteWdAll() throws Exception {
       try {
           return this.delete("WDSC.deleteWdAll");
       } catch (Exception ex) {
          ex.printStackTrace();
          throw new Exception("YCWDSC21002");//:删除文档失败!" + ex.getMessage());
       }
   }
/*
   public Object selectE(String id, Object paramObj) throws Exception{
        //sqlMap = this.getSqlMapClient(); //获取SqlMap对象
        try {
            //执行select操作
            try {
                //sqlMap.startTransaction();
                sqlMap.queryForObject(id, paramObj, this);
                //sqlMap.commitTransaction();
            } finally {
                //sqlMap.endTransaction();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new Exception(ex.getMessage());
        }
        return this;
    }


    protected Object saveE(String id) throws Exception {
        Object generatedKey = null;
        //sqlMap = this.getSqlMapClient(); //用父类方法获取SqlMap对象
        try {
            try {
                //sqlMap.startTransaction();
                generatedKey = sqlMap.insert(id, this);
                //sqlMap.commitTransaction();
            } finally {
                //sqlMap.endTransaction();
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
            throw new Exception(ex.getMessage());
        }

        return generatedKey;
    }
*/

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -