?? departmentbean.java
字號:
sql =
"select XM from ZZ_ZGB where ZGBH= '"
+ glyzwbh
+ "' and BMBH='"
+ depNo
+ "'";
rs = selectRecord(sql);
try{
if (rs.next())
glyxm = ds.toString(rs.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getAllInf()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉聲明時statement出錯"+e);}
}
}
ht.put("GLYZWXM", glyxm);
if (!wszwbh.equals("") && wszwbh != null) {
sql =
"select XM from ZZ_ZGB where ZGBH= '"
+ wszwbh
+ "' and BMBH='"
+ depNo
+ "'";
rs = selectRecord(sql);
try{
if (rs.next())
wsxm = ds.toString(rs.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getAllInf()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉聲明時statement出錯"+e);}
}
}
ht.put("WSZWXM", wsxm);
String[] ckqxMax = null;
String psName = "";
String strMax = "";
if (!ckqxbh.equals("") && ckqxbh != null) {
ckqxMax = ckqxbh.split(",");
for (int i = 0; i < ckqxMax.length; i++) {
sql = "select XM from ZZ_ZGB where ZGBH='" + ckqxMax[i] + "'";
rs = selectRecord(sql);
try{
if (rs.next())
psName = ds.toString(rs.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getAllInf()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getAllInf()關(guān)閉聲明時statement出錯"+e);}
}
if (!strMax.equals(""))
strMax += "," + psName;
if (strMax.equals(""))
strMax = psName;
}
}
ht.put("CKQX", strMax);
return ht;
}
public Hashtable getRootInf()
{
String sql ="select BMMC,TZWBH,GLYZWBH,WSZWBH,CKQX from ZZ_BMB where BMBH='"+depNo+ "' and BMFBH is null";
ResultSet rs = selectRecord(sql);
ResultSet rs1 = null;
Statement stmt = null;
Hashtable ht = new Hashtable();
try{
if (rs.next()) {
ht.put("BMMC", ds.toString(rs.getString("BMMC")));
ht.put("GLYZWBH", ds.toString(rs.getString("GLYZWBH")));
ht.put("WSZWBH", ds.toString(rs.getString("WSZWBH")));
ht.put("CKQXBH", ds.toString(rs.getString("CKQX")));
ht.put("BMFBH", "");
ht.put("JBXH", "");
String zwmc = "";
String glyxm = "";
String wsxm = "";
String tzwbh = ds.toString(rs.getString("TZWBH"));
String ckqxbh = ds.toString(rs.getString("CKQX"));
String glyzwbh = ds.toString(rs.getString("GLYZWBH"));
String wszwbh = ds.toString(rs.getString("WSZWBH"));
if (!tzwbh.equals("") && tzwbh != null) {
sql =
"select ZWMC from ZZ_ZWB where ZWBH="
+ tzwbh
+ " and BMBH='"
+ depNo
+ "'";
try{
rs1 = selectRecord(sql);
if (rs1.next())
zwmc = ds.toString(rs1.getString("ZWMC"));
}catch(Exception e){System.out.println("DepartmentBean.getRootInf()運行時出錯:"+e);}
finally{
if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉聲明時statement出錯"+e);}
}
}
ht.put("ZWMC", zwmc);
if (!glyzwbh.equals("") && glyzwbh != null) {
sql =
"select XM from ZZ_ZGB where ZGBH= '"
+ glyzwbh
+ "' and BMBH='"
+ depNo
+ "'";
try{
rs1 = selectRecord(sql);
if (rs1.next())
glyxm = ds.toString(rs1.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getRootInf()運行時出錯:"+e);}
finally{
if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉聲明時statement出錯"+e);}
}
}
ht.put("GLYZWXM", glyxm);
if (!wszwbh.equals("") && wszwbh != null) {
sql =
"select XM from ZZ_ZGB where ZGBH="
+ wszwbh
+ " and BMBH='"
+ depNo
+ "'";
try{
rs1 = selectRecord(sql);
if (rs1.next())
wsxm = ds.toString(rs1.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getRootInf()運行時出錯:"+e);}
finally{
if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉聲明時statement出錯"+e);}
}
}
ht.put("WSZWXM", wsxm);
String[] ckqxMax = null;
String psName = "";
String strMax = "";
if (!ckqxbh.equals("") && ckqxbh != null) {
ckqxMax = ckqxbh.split(",");
for (int i = 0; i < ckqxMax.length; i++) {
sql =
"select XM from ZZ_ZGB where ZGBH='" + ckqxMax[i] + "'";
try{
rs1 = selectRecord(sql);
if (rs1.next())
psName = ds.toString(rs1.getString("XM"));
}catch(Exception e){System.out.println("DepartmentBean.getRootInf()運行時出錯:"+e);}
finally{
if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉聲明時statement出錯"+e);}
}
if (!strMax.equals(""))
strMax += "," + psName;
if (strMax.equals(""))
strMax = psName;
}
}
ht.put("CKQX", strMax);
}
}catch(Exception e){System.out.println("DepartmentBean.getRootInf()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getRootInf()關(guān)閉聲明時statement出錯"+e);}
}
return ht;
}
public boolean nameExist(String bmname) //判斷同一個部門下名稱是否重
{
boolean bool = false;
String sql =
"select BMMC from zz_bmb where BMFBH='"
+ depNo
+ "' and BMMC='"
+ bmname
+ "'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if (rs.next())
bool = true;
else
bool = false;
}catch(Exception e){System.out.println("DepartmentBean.nameExist(String)運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.nameExist(String)關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.nameExist(String)關(guān)閉聲明時statement出錯"+e);}
}
return bool;
}
public Vector getOnePage(int page, int records) {
String sql =
"select * from ZZ_ZWB where BMBH='"
+ depNo
+ "' order by JBXH";
return db.getOnePage(sql, page, records);
}
//返回某個部門的在職所有人員
public Vector getOneBMPs(){
String sql =
"select XM from ZZ_ZGB where BMBH='" + depNo + "' and ZZZT=0 order by XM";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
Vector oneBmPerson = new Vector();
try{
String psName = "";
while (rs.next()) {
psName = ds.toString(rs.getString("XM"));
oneBmPerson.add(psName);
}
}catch(Exception e){System.out.println("DepartmentBean.getOneBMPs()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getOneBMPs()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getOneBMPs()關(guān)閉聲明時statement出錯"+e);}
}
return oneBmPerson;
}
public Vector getOneBMPsBH(){
String sql =
"select ZGBH,XM from ZZ_ZGB where BMBH='" + depNo + "' and ZZZT=0 order by XM";
ResultSet rs = selectRecord(sql);
Vector oneBmPerson = new Vector();
String psName = "";
Statement stmt = null;
try{
while (rs.next()) {
psName = ds.toString(rs.getString("ZGBH"));
oneBmPerson.add(psName);
}
}catch(Exception e){System.out.println("DepartmentBean.getOneBMPsBH()運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getOneBMPsBH()關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getOneBMPsBH()關(guān)閉聲明時statement出錯"+e);}
}
return oneBmPerson;
}
public String getBMBH(String strPersonNO)
{
String sql = "";
String name = "";
sql = " select BMBH from ZZ_ZGB where ZGBH = '"+strPersonNO+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
name = ds.toString(rs.getString("BMBH"));
}catch(Exception e){System.out.println("DepartmentBean.getBMBH(String)運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.getBMBH(String)關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.getBMBH(String)關(guān)閉聲明時statement出錯"+e);}
}
return name;
}
public String isWho(String zgbh)
{
String bmno = getBMBH(zgbh);
String sql = "";
String admin="",ws="";
if(bmno!=null && !bmno.equals(""))
sql = " select GLYZWBH,WSZWBH from ZZ_BMB where BMBH = '"+bmno+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
{
admin = ds.toString(rs.getString("GLYZWBH"));
ws = ds.toString(rs.getString("WSZWBH"));
if(admin.equals(zgbh) || (admin.equals(zgbh) && ws.equals(zgbh)))
{
return "bmadmin";
}
else if(ws.equals(zgbh))
{
return "bmws";
}
}
}catch(Exception e){System.out.println("DepartmentBean.isWho(String)運行時出錯:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("DepartmentBean.isWho(String)關(guān)閉記錄集rs時出錯"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("DepartmentBean.isWho(String)關(guān)閉聲明時statement出錯"+e);}
}
return "person";
}
public String getOrgNo(String bmbh){
String org = bmbh.substring(0,4);
for(int i=0;i<16;i++)
org = org+"0";
return org;
}
public int unit(String strDepA,String strDepB)
{
try{
String sql = "update ZZ_ZGB set BMBH='"+strDepB+"' where BMBH='"+strDepA+"'";
executeUpdate(sql);
if(!strDepA.substring(0,4).equals(strDepB.substring(0,4)))
{
sql = "delete from ZZ_ZGZWB where BMBH='"+strDepA+"'";
executeUpdate(sql);
}
}
catch(Exception e){}
finally{
}
return 0;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -