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

📄 personbean.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				if(strOper.length()!=0)
					strOper = strOper.substring(0,strOper.length()-1);
				if(strOper.length()==0)
					strOper = "";
				return strOper;				
			}
		}

		strMax = strMax.substring(0,strMax.length()-1);
		String strMaxOper[] = strMax.split("@");
		strMax = ",";
		for(i=0;i<strMaxOper.length;i++)//取得此职工最大权限集合strMax
		{
			String strEp[] = strMaxOper[i].split(",");
			for(j=0;j<strEp.length;j++)
			{
				strEp[j] = strEp[j];
				/*String[] s = strMax.split(",");
				boolean f = true;
				for(int k=0;k<s.length;k++){
					if(strEp[j].equals(s[k])){
						f = false;
						break;
					}
				}*/
				if(strMax.indexOf("," + strEp[j] + ",")==-1)
				{
					strMax+=strEp[j]+str1;
				}
			}
		}
		strOper = strMax;
		strOper = strOper.substring(1,strOper.length()-1);
		/*	String strOpers[] = strOper.split(",");
			for(i=0;i<strOpers.length;i++)//根据分割后的编号取得模块名称
			{
				strOper+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strOpers[i])+str1;
			}
			strOper = strOper.substring(0,strOper.length()-1);*/
		return strOper;
	}

	//取得当前操作者能够分配的操作权限(即 在某部门能够'分配职务'才能够分配在此部门的操作权限)
	public String getOper_lm()
	{
		String strOper = "";
		String sql = "";
		String strMRCZ = "1";
		String strSYZT = "0";
		String str1 = ",";
		String str2 = "@";
		String strBMBH = "";
		String strZWBH = "";
		String strMax = "";
		int i,j;
		
		sql = " select x.CZQX from ZZ_ZGZWB x,zz_zwb y where x.ZGBH = '"+strPersonNO+"' and y.zwzt<>1 and x.bmbh=y.bmbh and x.zwbh=y.zwbh and x.BMBH in ( select distinct a.BMBH from ZZ_ZGZWB a,ZZ_ZWB b where a.ZGBH='"+strPersonNO+"' and (a.CZQX like '%,73%' or a.CZQX like '%,73%,' or a.CZQX like '%73%,' or b.CZQX like '%,73%' or b.CZQX like '%,73%,' or b.CZQX like '%73%,') and b.zwzt<>1 and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH  ) ";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
		while(rs.next())//在ZZ_ZGZWB表找此职工所有职务的权限
		{   		
			String strX = ds.toString(rs.getString(1));//取得某一职务的权限
			if (!strX.equals(""))
			{						
				strMax+=strX+str2;
			}
		}
		}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);}		
		}

		if(strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空,在ZZ_ZWB表找此职工所有职务的权限
		{
			sql = "select a.CZQX from ZZ_ZWB a,ZZ_ZGZWB b where ZGBH = '"+strPersonNO+"' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH and  b.BMBH in ( select distinct a.BMBH from ZZ_ZGZWB a,ZZ_ZWB b where a.ZGBH='"+strPersonNO+"' and b.zwzt<>1 and (a.CZQX like '%,73%' or a.CZQX like '%,73%,' or a.CZQX like '%73%,' or b.CZQX like '%,73%' or b.CZQX like '%,73%,' or b.CZQX like '%73%,') and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH   ) ";
			rs = selectRecord(sql);
			try{
			while(rs.next())//把此职工的所有职务的权限用(@)分割存储
			{
				String strX = ds.toString(rs.getString(1));//取得某一职务的权限
				if (!strX.equals(""))
				{						
					strMax+=strX+str2;
				}
			}
			}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);}		
			}

			if(strMax.equals(""))//判断是否启用默认权限,空则用默认权限
			{
				sql = "select ID from CODE_ANCZQXB where MRCZ = "+strMRCZ+" and SYZT = "+strSYZT+"";
				ResultSet r = selectRecord(sql);
				try{
				while(r.next())
				{
					strOper+=ds.toString(r.getString("ID"))+str1;
				}
				}catch(Exception e){System.out.println("运行时出错:"+e);}
				finally{
					if(r!=null)try{ stmt = r.getStatement(); r.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
					if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
				}
				if(strOper.length()!=0)
					strOper = strOper.substring(0,strOper.length()-1);
				if(strOper.length()==0)
					strOper = "";
				return strOper;				
			}
		}
		strMax = strMax.substring(0,strMax.length()-1);
		String strMaxOper[] = strMax.split("@");
		strMax = ",";
		for(i=0;i<strMaxOper.length;i++)//取得此职工最大权限集合strMax
		{
			String strEp[] = strMaxOper[i].split(",");
			for(j=0;j<strEp.length;j++)
			{
				strEp[j] = strEp[j];
				/*String[] s = strMax.split(",");
				boolean f = true;
				for(int k=0;k<s.length;k++){
					if(strEp[j].equals(s[k])){
						f = false;
						break;
					}
				}*/
				if(strMax.indexOf("," + strEp[j] + ",")==-1)
				{
					strMax+=strEp[j]+str1;
				}
			}
		}
		strOper = strMax;
		strOper = strOper.substring(1,strOper.length()-1);
		/*	String strOpers[] = strOper.split(",");
			for(i=0;i<strOpers.length;i++)//根据分割后的编号取得模块名称
			{
				strOper+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strOpers[i])+str1;
			}
			strOper = strOper.substring(0,strOper.length()-1);*/
		return strOper;
	}
	//将getOper返回的操作权限编号转为汉字      new  
	public String toOperName(String strOperNo)
	{
		String strOper="";
		String strOpers[] = strOperNo.split(",");
		for(int i=0;i<strOpers.length;i++)//根据分割后的编号取得模块名称
		{
			strOper+=db.toName("CODE_ANCZQXB","ID","MKMC",strOpers[i])+":"+db.toName("CODE_ANCZQXB","ID","ANMC",strOpers[i])+",";
		}
		strOper = strOper.substring(0,strOper.length()-1);
		return strOper;
	}
	//将getFlow返回的流程权限编号转为汉字    new  
	public String toFlowName(String strFlowNo)
	{
		String strFlow="";
		String strFlows[] = strFlowNo.split(",");
		for(int i=0;i<strFlows.length;i++)//根据分割后的编号取得模块名称
		{
			strFlow+=db.toName("CODE_LCQXB","MKBH","MKMC",strFlows[i])+",";
		}
		strFlow = strFlow.substring(0,strFlow.length()-1);
		return strFlow;
	}
	//通过职工编号得到当前职务的流程权限,没转化为汉字
	public String getFlow()
	{
		String strFlow = "";
		String sql = "";
		String strMRCZ = "1";
		String strSYZT = "0";
		String str1 = ",";
		String str2 = "@";
		String strBMBH = "";
		String strZWBH = "";
		String strMax = "";
		int i,j;

		sql = "select LCQX from ZZ_ZGZWB where ZGBH = '"+strPersonNO+"'";
		ResultSet rs = null;	
		Statement stmt = null;
		try{
		rs = selectRecord(sql);

		while(rs.next())//在ZZ_ZGZWB表找此职工所有职务的权限
		{
			String strX = ds.toString(rs.getString("LCQX"));//取得某一职务的权限
			if (!strX.equals(""))
			{						
				strMax+=strX+str2;
			}
		}
		}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);}		
		}
		if(strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空
		{
			sql = "select a.LCQX from ZZ_ZWB a,ZZ_ZGZWB b where ZGBH = '"+strPersonNO+"' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH  ";
			ResultSet rs1 = selectRecord(sql);
			try{
				while(rs1.next())//把此职工的所有职务的权限用(@)分割存储
				{
					String strX = ds.toString(rs1.getString("LCQX"));//取得某一职务的权限
					//System.out.println("\r\nwwwwwwwwwwwwwwwww zgbh = "+strPersonNO+" lcqx="+strX);
					if (!strX.equals(""))
					{						
						strMax+=strX+str2;
					}
				}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
				if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
			}
			if(strMax.equals(""))//判断是否启用默认权限,空则用默认权限
			{
				sql = "select MKBH from CODE_LCQXB where MRCZ = "+strMRCZ+" and SYZT = "+strSYZT+"";
				ResultSet r = selectRecord(sql);
				try{
				while(r.next())
				{
					strFlow+=ds.toString(r.getString("MKBH"))+str1;
				}
				}catch(Exception e){System.out.println("运行时出错:"+e);}
				finally{
					if(r!=null)try{ stmt = r.getStatement(); r.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
					if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
				}

				if(strFlow.length()!=0)
					strFlow = strFlow.substring(0,strFlow.length()-1);
				if(strFlow.length()==0)
					strFlow = "";
				return strFlow;				
			}
		}

		strMax = strMax.substring(0,strMax.length()-1);
		String strMaxOper[] = strMax.split("@");
		strMax = "";
		for(i=0;i<strMaxOper.length;i++)//取得此职工最大权限集合strMax
		{   
			String strEp[] = strMaxOper[i].split(",");
			for(j=0;j<strEp.length;j++)
			{
				if(strMax.indexOf(strEp[j])==-1)
				{
					strMax+=strEp[j]+str1;
				}
			}
		}
		strFlow = strMax;
		strFlow = strFlow.substring(0,strFlow.length()-1);
		/*	String strFlows[] = strFlow.split(",");
			for(i=0;i<strFlows.length;i++)//根据分割后的编号取得模块名称
			{
				strFlow+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strFlows[i])+str1;
			}
			strFlow = strFlow.substring(0,strFlow.length()-1);*/
	
		return strFlow;
	}

	//通过职工编号得到当前职务的流程权限,没转化为汉字
	public boolean getFlow_new(String bmno,String qx)
	{
		boolean strFlow = false;
		String sql = "";

		String sql1 = " select distinct LCQX as AAA from ZZ_ZGZWB where LCQX is not null and ZGBH in (select ZGBH from ZZ_ZGB where BMBH='"+bmno+"')";
		String sql2 = " select distinct a.LCQX from ZZ_ZWB a,ZZ_ZGZWB b where a.LCQX is not null and a.zwzt<>1 and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH and b.ZGBH in (select ZGBH from ZZ_ZGB where BMBH ='"+bmno+"')";
		String sql3 = " select to_char(MKBH) as AAA from CODE_LCQXB where MRCZ = 1 and SYZT = 0";
		sql = sql1 + " union " + sql2 + " union "+ sql3;
		

		ResultSet rs = selectRecord(sql1);
		Statement stmt = null;
		String t = "";
		try{
		while(rs.next())
		{
			t = rs.getString(1);
			if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
			{
				strFlow = true;
				break;
			}
		}
		}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);}		
		}
		if(!strFlow)
		{

			ResultSet rs2 = selectRecord(sql2);
			try{
			while(rs2.next())
			{
				t = rs2.getString(1);
				//System.out.println("b"+t+"b");
				if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
				{
					strFlow = true;
					break;
				}
			}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs2!=null)try{ stmt = rs2.getStatement(); rs2.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
				if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
			}
		}

		if(!strFlow)
		{
			ResultSet rs3 = selectRecord(sql3);
			try{
			while(rs3.next())
			{
				t = rs3.getString(1);
				if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
				{
					strFlow = true;
					break;
				}
			}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs3!=null)try{ stmt = rs3.getStatement(); rs3.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
				if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
			}
		}		
		return strFlow;
	}

	//通过职工编号得到当前职工的配置参数
	public String getConf()
	{
		String strConf = "";
		String sql = "";
		String str1 = ",";
		String str2 = "@";
		String strBMBH = "";
		String strZWBH = "";
		String strMax = "";
		int i,j,num=0;
		String []xm = new String[10];//{"邮箱空间:","附件大小:","个人通讯录数目:","文件柜大小:",""};//
		String []unit = new String[10];//{"MB","MB","条","MB",""};//

		sql = "select PZBH,PZMC,PZSZ,PZSM from CODE_XTPZ order by PZBH ";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
		while(rs.next())
		{
			xm[num] = ds.toString(rs.getString("PZMC"));
			unit[num] = ds.toString(rs.getString("PZSM"));
			num++;
		}

		sql = "select PZCS from ZZ_ZGB where ZGBH

⌨️ 快捷键说明

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