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

📄 sysconfbean.java

📁 在系统开发过程中用到了javabean和jsp技术
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		return 1;
	}

	//设置FTP
	public int setFtp(String ip)
	{
		String sql = "";
		String strFtpIP = ip;
		Vector vect = new Vector();
		vect.add("NB_FTPSET");
		vect.add(addVector("FTPIP",strFtpIP,"CHAR"));
		sql = "select * from news.NB_FTPSET";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
			if(!rs.next())
				return insertRecord(vect);
		}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);}		
		}
		sql = "update news.NB_FTPSET set FTPIP = '"+ip+"'";
		executeUpdate(sql);
		return 0;
	}

	//增加CSS样式表信息
	public int addCss(Hashtable hash,Hashtable hs)
	{
		String strMRZT = "0";
		int intId = db.makeID("NB_YSB","ID","","",true);
		String strStyle = ds.toString((String)hash.get("STYLE"));
		String strFileName = ds.toString("css"+String.valueOf(intId)+".css");
		String strIsnow = ds.toString((String)hash.get("ISNOW"));

		Vector vect =new Vector();
		vect.add("NB_YSB");
		vect.add(addVector("ID",String.valueOf(intId),"NUM"));
		vect.add(addVector("STYLE",strStyle,"CHAR"));
		vect.add(addVector("FILENAME",strFileName,"CHAR"));
		vect.add(addVector("ISNOW",strIsnow,"NUM"));

		//检验是否已经存在
		ResultSet rs = selectRecord("select * from news.NB_YSB where STYLE='"+strStyle+"'");
		Statement stmt = null;
		try{
			if(!rs.next())
			{
				if(strIsnow.equals("1"))
				{
					ResultSet rst = selectRecord("select * from news.NB_YSB");
					try{
						if(rst.next())
						{
							String sql = "update news.NB_YSB set ISNOW = "+strMRZT+"";
							executeUpdate(sql);
						}
					}catch(Exception e){System.out.println("运行时出错:"+e);}
					finally{
						if(rst!=null)try{ stmt = rst.getStatement(); rst.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
						if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
					}
				}
				String path = ds.toString((String)hash.get("path"));
				newCssFile(hs,path,strFileName);
				return insertRecord(vect);
			}
		}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 1;
	}

	//修改CSS样式表信息
	public int modCss(Hashtable hash,Hashtable hs)
	{
		String strMRZT = "0";
		String strStyle = ds.toString((String)hash.get("STYLE"));
		String strIsnow = ds.toString((String)hash.get("ISNOW"));
		String strFileName = ds.toString("css"+String.valueOf(id)+".css");

		Vector vect = new Vector();
		vect.add("NB_YSB");
		vect.add(addVector("STYLE",strStyle,"CHAR"));
		vect.add(addVector("ISNOW",strIsnow,"NUM"));
		vect.add("ID="+id+"");

		if (strIsnow.equals("1"))
		{
			Vector vet = new Vector();
			vet.add("NB_YSB");
			vet.add(addVector("ISNOW",strMRZT,"NUM"));
			vet.add("ID!="+id+"");
			updateRecord(vet);
		}
		String path = ds.toString((String)hash.get("path"));
		newCssFile(hs,path,strFileName);
		return updateRecord(vect);
	}

	//删除信息
	public int delData()
	{
		String sql="";
		String strSYZT="1";
		switch (type)
		{
			case 14: sql = "delete from news.NB_ZYSZB where ID = "+id+"";break;
			case 15: sql = "delete from news.NB_YSB where ID = "+id+"";break;
			case 21: sql = "delete from news.NB_LINK where LINKID = "+id+"";break;
			default:break;
		}
		return deleteRecord(sql);
	}

	//把模块名称转化为模块编号
	public String toId(String name)
	{
		String sql = "";
		sql = "select distinct ID1 from news.MENU where MENU1 = '"+name+"'";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
			if(rs.next())
			{
				String strId = ds.toString(rs.getString("ID1"));
				return strId;
			}
		}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 "0";
	}

	//把模块编号转化为模块名称
	public String toName(String id)
	{
		String sql = "";
		sql = "select  distinct MENU1 from news.MENU where ID1 = "+id+"";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
		if(rs.next())
		{
			String strMenu = ds.toString(rs.getString("MENU1"));
			return strMenu;
		}
		}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 "0";
	}

	//初始化,模块信息
	public void initMain()
	{
		String sql = "";
		String sql1 = "";
		String strId="";
		Hashtable hash = new Hashtable();
		String strNum = "12";
		String strIsShowtime = "1";

		hash.put("NUM",strNum);
		hash.put("ISSHOWTIME",strIsShowtime);

		//删除菜单中没有的模块
		String sql2="";
		sql2 = "select ID from news.NB_ZYSZB where ID<18";
		ResultSet rs2 = selectRecord(sql2);
		Statement stmt = null;
		try{
			while(rs2.next())
			{
				String strId2 = rs2.getString("ID");
				String sql3 = "select * from news.MENU where ID1="+strId2+"";
				ResultSet rs3 = selectRecord(sql3);
				try{
				if(!rs3.next())
					deleteRecord("delete from news.NB_ZYSZB where ID = "+strId2+"");
				}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);}		
				}
			}
		}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);}		
		}
		//初始化没有的模块
		sql = "select distinct ID1 from news.MENU";
		ResultSet rs = selectRecord(sql);
		try{
			while(rs.next())
			{
				strId = rs.getString("ID1");
				sql1 = "select * from news.NB_ZYSZB where ID = "+strId+"";
				ResultSet rst = selectRecord(sql1);
				try{
					if(!rst.next())
					{
						hash.put("ID",strId);
						addMain(hash);
					}
				}catch(Exception e){System.out.println("运行时出错:"+e);}
				finally{
					if(rst!=null)try{ stmt = rst.getStatement(); rst.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
					if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
				}
			}
		}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);}		
		}
	}

	//生成css文件
	public void newCssFile(Hashtable hash,String path,String filename)
	{
		//System.out.println(hash);

		appendCssStr(path+filename,"BODY\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"TABLE\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"TD\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"TR\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"P\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"INPUT\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"SELECT\r\n"
									+"{\r\n"
									+"	FONT-SIZE:12px\r\n"
									+"}\r\n"
									+"INPUT\r\n"
									+"{\r\n"
									+"	BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc\r\n"
									+"}\r\n"
									+"TEXTAREA\r\n"
									+"{\r\n"
									+"	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #ffffff; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000\r\n"
									+"}\r\n"
									+"SELECT\r\n"
									+"{\r\n"
									+"	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #ffffff; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000\r\n"
									+"}\r\n"
									+"A:link\r\n"
									+"{\r\n"
									+"	COLOR:"+(String)hash.get("txt_a_link")+";TEXT-DECORATION: none\r\n"
									+"}\r\n"
		                            +"A:hover\r\n"
									+"{\r\n"
									+"	COLOR:"+(String)hash.get("txt_a_hover")+";TEXT-DECORATION: none\r\n"
									+"}\r\n"
		                            +"A:visited\r\n"
									+"{\r\n"
									+"	COLOR:"+(String)hash.get("txt_a_visited")+";TEXT-DECORATION: none\r\n"
									+"}\r\n"
		                            +"A:unknown\r\n"
									+"{\r\n"
									+"	TEXT-DECORATION: none\r\n"
									+"}\r\n"
		                            +"h\r\n"
									+"{\r\n"

⌨️ 快捷键说明

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