📄 personbean.java
字号:
if(!isexact)
sql = sql+" and "+srchzd+" like '%"+srchzdval+"%'";
}
sql = sql+" order by BMBH";
if(!pxzd.equals("") && !pxzd.equals("BMBH"))
{
sql = sql +","+pxzd;
}
else{
sql = sql +",JBXH";
}
// if(!pxzd.equals(""))
// sql = sql+" order by "+pxzd;
}
if(isdesc)
{
sql = sql+" DESC";
}
Hashtable ht = new Hashtable();
ht.put("sql",sql);
vect.add(ht);
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
int rowno=0;
//取得列数和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while(rs.next())
{
rowno++;
//Hashtable hash = new Hashtable();
/*for(int i=1;i<=cols;i++)
{
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if(field.equals("BMBH"))
{
value = getApartName(value);
}
if(field.equals("ZZZT"))
{
if(value.equals("0"))value="正常";
if(value.equals("1"))value="离职";
if(value.equals("2"))value="退休";
if(value.equals("3"))value="挂起";
}
//if(value==null)value="";
//hash.put(field,value);
} */
//vect.add(hash);
}
vect.add(new Integer(rowno));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vect;
}
//取得人员记录列表(不包括只能用户)
public Vector getData()
{
Vector vect = new Vector();
String sql = "";
sql =" select * from ZZ_ZGB where bmbh='"+strOrgNO+"' and ZZZT=0 "
+" and ZZ_ZGB.ZGBH<>'1' and ZNYH=0"
+" order by JBXH ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列数和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while(rs.next())
{
Hashtable hash = new Hashtable();
for(int i=1;i<=cols;i++)
{
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if(field.equals("BMBH"))
{
value = getApartName(value);
}
if(field.equals("ZZZT"))
{
if(value.equals("0"))value="正常";
if(value.equals("1"))value="离职";
if(value.equals("2"))value="退休";
}
if(value==null)value="";
hash.put(field,value);
}
vect.add(hash);
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vect;
}
////取得人员记录列表(包括职能用户)
public Vector getZNData()
{
Vector vect = new Vector();
String sql = "";
sql =" select * from ZZ_ZGB where bmbh='"+strOrgNO+"' and ZZZT=0 "
+" and ZZ_ZGB.ZGBH<>'1' "
+" order by JBXH ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列数和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while(rs.next())
{
Hashtable hash = new Hashtable();
for(int i=1;i<=cols;i++)
{
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if(field.equals("BMBH"))
{
value = getApartName(value);
}
if(field.equals("ZZZT"))
{
if(value.equals("0"))value="正常";
if(value.equals("1"))value="离职";
if(value.equals("2"))value="退休";
}
if(value==null)value="";
hash.put(field,value);
}
vect.add(hash);
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vect;
}
//取得当前人员的信息
public Hashtable getOneData()
{
Hashtable hash = new Hashtable();
String sql = "";
sql = " select * from ZZ_ZGB where ZGBH = '"+strPersonNO+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
if (rs.next())
{
String bmmc="";
for(int i=1;i<=cols;i++)
{
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if(field.equals("BMBH"))
{
setOrgNO(value);
bmmc = getBmName();
}
if(field.equals("ZZZT"))
{
if(value.equals("0"))value="正常";
if(value.equals("1"))value="离职";
if(value.equals("2"))value="退休";
if(value.equals("3"))value="挂起";
}
if(value==null)value="";
hash.put(field,value);
}
hash.put("BMMC",bmmc);
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return hash;
}
public String getApartName(String bmno)//取得某部门的部门名称
{
String sql = "";
String name = "";
sql = " select BMMC from ZZ_BMB where BMBH = '"+bmno+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
name = ds.toString(rs.getString("BMMC"));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return name;
}
public String getPsBmName()//取得当前人员的部门名称
{
return toName("zz_bmb","BMBH","BMMC",toName("zz_zgb","ZGBH","BMBH",strPersonNO));
}
public String getZgName(String str)//取得某人员的名字
{
return toName("ZZ_ZGB","ZGBH","XM",str);
}
public String getBmName()//取得当前部门的部门名称
{
String sql = "";
String name = "";
sql = " select BMMC from ZZ_BMB where BMBH = '"+strOrgNO+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
name = ds.toString(rs.getString("BMMC"));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return name;
}
public String getBgColor()//取得需要必填项目之背景色 new chen
{
String sql = "";
String color = "#ffffff";
sql = " select xmmc from CODE_ZDB where ZDMC ='表单元素背景色' and xmbh='1' and syzt=0";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
if(rs.next())
color = ds.toString(rs.getString("xmmc"));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return color;
}
public String getMaxzgNo()//取得最大职工编号+1
{
String sql = "",zgNo="";
long lzgNo=0,lmaxNo = 0;
sql = " select ZGBH from ZZ_ZGB ";//where BMBH = '"+strOrgNO+"'"
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
while(rs.next())
{
zgNo = ds.toString(rs.getString("ZGBH"));
lzgNo = Long.parseLong(zgNo);
if (lzgNo > lmaxNo) {
lmaxNo = lzgNo;
//maxNo = zgNo;
}
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
lmaxNo = lmaxNo + 1;
return String.valueOf(lmaxNo);
}
public Vector getMZ()//从字典表取得民族
{
String sql = "";
sql = "select XMMC from CODE_ZDB where ZDMC='民族' and SYZT=0 order by jbxh";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
Vector vt = new Vector();
try{
while(rs.next())
vt.add(ds.toString(rs.getString("XMMC")));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vt;
}
public Vector getZzmm()//从字典表取得政治面目
{
String sql = "";
sql = "select XMMC from CODE_ZDB where ZDMC='政治面貌' and SYZT=0 order by jbxh";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
Vector vt = new Vector();
try{
while(rs.next())
vt.add(ds.toString(rs.getString("XMMC")));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vt;
}
public Vector getXL()//从字典表取得学历
{
String sql = "";
sql = "select XMMC from CODE_ZDB where ZDMC='学历' and SYZT=0 order by jbxh";
ResultSet rs = selectRecord(sql);
Vector vt = new Vector();
Statement stmt = null;
try{
while(rs.next())
vt.add(ds.toString(rs.getString("XMMC")));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vt;
}
public Vector getZC()//从字典表取得职称
{
String sql = "";
sql = "select XMMC from CODE_ZDB where ZDMC='职称' and SYZT=0 order by jbxh";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
Vector vt = new Vector();
try{
while(rs.next())
vt.add(ds.toString(rs.getString("XMMC")));
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vt;
}
//增加人员数据记录
public int addPerson(Hashtable hash)
{
String sql="";
long intPerson = 0;
String strBMBH = ds.toString((String)hash.get("BMBH"));
String strZGBH = ds.toString((String)hash.get("ZGBH"));
String strXM = ds.toString((String)hash.get("XM"));
String strGH = ds.toString((String)hash.get("GH"));
// String strCZQX = ds.toString((String)hash.get("CZQX"));
// String strLCQX = ds.toString((String)hash.get("LCQX"));
String strPZCS = ds.toString((String)hash.get("PZCS"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -