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

📄 combineunitmanager.java

📁 OA典型例子
💻 JAVA
字号:
package com.sure.oa.dict;import com.sure.businessmodel.Page;import com.sure.businessmodel.UpdateException;import com.sure.businesslogic.AlreadyExistsException;import com.sure.businesslogic.NotFoundException;import com.sure.dataabstraction.DBManager;import com.sure.dataabstraction.DBPoolException;import com.sure.util.StringUtils;import java.sql.SQLException;import java.sql.Connection;import java.util.Vector;/** * <p>Title: OA</p> * <p>Description: 国办项目</p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: sure</p> * @author mengzy * @version 1.0 */public class combineUnitManager {  public combineUnitManager() {  }  /**   * 根据Id获得联合发文单位信息详情   */  public combineUnit getcombineUnit(int Id) throws SQLException,DBPoolException, NotFoundException {      Connection cn = DBManager.getConnection();      try {          String where = "Where Id = " + Id;          Vector beans = combineUnitPersistent.load(cn, where);          combineUnit bean = (combineUnit)beans.firstElement();          return bean;      }catch (SQLException sqle) {          throw new NotFoundException();      } finally {          cn.close();      }  }  public Page getCombineUnitList(int start,int unitId) throws SQLException,DBPoolException {      Connection cn = DBManager.getConnection();      try{          String where = "where  unitId=" + unitId + "  order by Id";          Page p = combineUnitPersistent.load(cn, start, 10, where);          return p;      }finally {          cn.close();      }  }  /**   * 显示某个单位的所有联合发文单位信息(不是分页形式)   */  public static  Vector getCombineUnitList(int unitId) throws SQLException,          DBPoolException {      Connection cn = DBManager.getConnection();      try{          String where = "where  unitId=" + unitId + "";          Vector v = combineUnitPersistent.load(cn, where);          return v;      }finally {          cn.close();      }  }  /**   * 保存联合发文单位信息   */  public int saveCombineUnit(combineUnit com) throws SQLException,DBPoolException, UpdateException, NotFoundException {      Connection cn = DBManager.getConnection();      String UnitName = StringUtils.getSQLencode(com.getUnitName());      String where = "Where  UnitName = '" + UnitName + "'  and unitId=" +                     com.getUnitId() + " and Id<>" + com.getId();      int intResult = combineUnitPersistent.getCount(cn, where);      if (intResult > 0){          throw new UpdateException("本次发文中已经存在" + UnitName + "这个联合发文单位了!");      }      int cId = com.getId().intValue();      int retval = 0;      try{          combineUnitPersistent comp = new combineUnitPersistent(com);          if (cId == 0){            retval = 2;          }else{            comp.setRecordExists(true);            retval = 3;          }          comp.persist(cn);      }finally {          cn.close();      }    return retval;  }  /**   * 删除联合发文单位信息   */  public void  delCombineUnit(int Id) throws SQLException, DBPoolException, NotFoundException {        Connection cn = DBManager.getConnection();        try {           String where = "Where Id = " + Id;           combineUnitPersistent.delete(cn, where);        }catch (SQLException sqle) {            throw new  NotFoundException();        } finally {            cn.close();        }    }}

⌨️ 快捷键说明

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