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

📄 u_cbnrbmanager.java

📁 一套完整的工商12315的源程序jsp部分在12315里,后台JAVA部分在gs12315src里,没有打包数据库.
💻 JAVA
字号:
package com.gs.doCase;

import com.gs.db.*;
import com.gs.db.dbimp.*;
import com.gs.util.Cacheable;
import com.gs.util.*;
import java.sql.*;
import java.util.Iterator;
import java.util.ArrayList;
import java.lang.*;
import java.util.*;

public class U_cbnrbManager {
  //$variable
  public static String dateFormat = "yyyy-MM-dd HH:mm:ss";
  public U_cbnrbManager() {
  }

  /**
   *
   *add
   */
  private final static String Q_U_cbnrb_add =
      "INSERT INTO u_cbnrb   ( djbh,rq,cbr,cbnr) VALUES ( ?,CONVERT(datetime, ?, 120),?,?)";
  private final static String Q_U_cbnrb_edit =
      "update u_cbnrb set rq=CONVERT(datetime, ?, 120),cbr=?,cbnr=? where djbh=? ";
  private final static String Q_U_cbnrb_delete =
      "delete from  u_cbnrb where  djbh=? ";
  private final static String Q_U_cbnrb_getByKey =
      "select  djbh,rq,cbr,cbnr from u_cbnrb where djbh=? ";
  private final static String Q_U_cbnrb_getAll =
      "select  djbh,rq,cbr,cbnr from u_cbnrb";
  private final static String Q_U_cbnrb_getList_byDJBH =
      "select  djbh,rq,cbr,cbnr from u_cbnrb where djbh=?";
  public void add(U_cbnrbImp obj) {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_add);
      pstmt.setString(1, obj.getdjbh());
      pstmt.setString(2, StringUtils.SimpleDateFormat(obj.getrq()));
      pstmt.setString(3, obj.getcbr());
      pstmt.setString(4, obj.getcbnr());
      pstmt.executeUpdate();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }

  }

  /**
   *
   *edit
   */
  public void edit(U_cbnrbImp obj) {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_edit);
      String djbh = obj.getdjbh();
      java.util.Date rq = obj.getrq();
      String cbr = obj.getcbr();
      String cbnr = obj.getcbnr();

      pstmt.setString(1, StringUtils.SimpleDateFormat(rq, dateFormat));
      pstmt.setString(2, cbr);
      pstmt.setString(3, cbnr);
      pstmt.setString(4, djbh);

      pstmt.executeUpdate();
    }
    catch (Exception e) {
    }
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }
  }

  /**
   *
   *delete
   */
  public void delete(String djbh) {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_delete);
      pstmt.setString(1, djbh);
      pstmt.executeUpdate();
    }
    catch (Exception e) {}
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }

  }

  /**
   *
   *getU_cbnrbImp
   */
  public U_cbnrbImp getObject(String djbh) {
    U_cbnrbImp obj = null;
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_getByKey);

      pstmt.setString(1, djbh);

      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        obj = setObjct(obj, rs);
      }
    }
    catch (Exception e) {
    }
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }
    return obj;

  }

  /**
   *getAllList
   */
  public ArrayList getAllList() {
    ArrayList list = new ArrayList();
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_getAll);
      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {
        U_cbnrbImp obj = new U_cbnrbImp();
        obj = setObjct(obj, rs);
        list.add(obj);
      }
    }
    catch (Exception e) {

    }
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }

    return list;
  }
  public ArrayList getListByDjbh(String djbh) {
    ArrayList list = new ArrayList();
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = DbConnectionManager.getConnection();
      pstmt = con.prepareStatement(Q_U_cbnrb_getList_byDJBH);
      pstmt.setString(1, djbh);
      ResultSet rs = pstmt.executeQuery();
      while (rs.next()) {
        U_cbnrbImp obj = new U_cbnrbImp();
        obj = setObjct(obj, rs);
        list.add(obj);
      }
    }
    catch (Exception e) {

    }
    finally {
      try {
        pstmt.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      try {
        con.close();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }

    return list;
  }


  private U_cbnrbImp setObjct(U_cbnrbImp obj, ResultSet rs) throws Exception {
    obj = new U_cbnrbImp();
    obj.setdjbh(rs.getString("djbh"));
    obj.setrq(StringUtils.handleDate(rs.getString("rq"), dateFormat));
    obj.setcbr(rs.getString("cbr"));
    obj.setcbnr(rs.getString("cbnr"));
    ;
    return obj;
  }

}

⌨️ 快捷键说明

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