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

📄 shixikaohebean.java

📁 JSP开发的学生信息管理系统
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ShixiKaoheBean.java

package mypackage;

import java.io.PrintStream;
import java.sql.*;

// Referenced classes of package mypackage:
//			DataBaseConnection, ShixiKaohe

public class ShixiKaoheBean
{

	private Connection con;

	public ShixiKaoheBean()
	{
		con = null;
		con = DataBaseConnection.getConnection();
	}

	public boolean existXuesheng(ShixiKaohe shixikaohe)
	{
		boolean flag = false;
		try
		{
			String s = shixikaohe.getStudentId();
			PreparedStatement preparedstatement = con.prepareStatement("select studentId from xuesheng where studentId='" + s + "' and flag='" + 1 + "'");
			ResultSet resultset = preparedstatement.executeQuery();
			if (resultset.next())
				flag = true;
			if (resultset != null)
				resultset.close();
			if (preparedstatement != null)
				preparedstatement.close();
		}
		catch (Exception exception)
		{
			exception.printStackTrace();
		}
		return flag;
	}

	public boolean existShixiKaohe(ShixiKaohe shixikaohe)
	{
		ResultSet resultset;
		String s = shixikaohe.getStudentId();
		String s1 = shixikaohe.getCheckTime();
		PreparedStatement preparedstatement = con.prepareStatement("select * from shixiKaohe where studentId='" + s + "' and checkTime='" + s1 + "'");
		resultset = preparedstatement.executeQuery();
		Exception exception;
		return resultset.next();
		exception;
		return false;
	}

	public String addShixiKaohe(ShixiKaohe shixikaohe)
	{
		PreparedStatement preparedstatement;
		preparedstatement = null;
		String s = "";
		String s2;
		if (existXuesheng(shixikaohe))
			break MISSING_BLOCK_LABEL_23;
		s2 = "notExist";
		return s2;
		if (!existShixiKaohe(shixikaohe))
			break MISSING_BLOCK_LABEL_41;
		s2 = "exist";
		return s2;
		String s1;
		try
		{
			preparedstatement = con.prepareStatement("insert into shixiKaohe values(?,?,?,?,?,?)");
			preparedstatement.setString(1, shixikaohe.getStudentId());
			preparedstatement.setString(2, shixikaohe.getContent());
			preparedstatement.setString(3, shixikaohe.getCheckTime());
			preparedstatement.setString(4, shixikaohe.getAddress());
			preparedstatement.setString(5, shixikaohe.getGrade());
			preparedstatement.setString(6, shixikaohe.getRemark());
			preparedstatement.execute();
			s1 = "sucess";
		}
		catch (SQLException sqlexception)
		{
			System.err.println(sqlexception.getMessage());
			s1 = "failer";
		}
		break MISSING_BLOCK_LABEL_195;
		local;
		try
		{
			preparedstatement.close();
			con.close();
		}
		catch (Exception exception1)
		{
			exception1.printStackTrace();
		}
		JVM INSTR ret 6;
		return s1;
	}

	public String updateShixiKaohe(ShixiKaohe shixikaohe)
	{
		PreparedStatement preparedstatement = null;
		String s = "";
		try
		{
			preparedstatement = con.prepareStatement("update shixiKaohe set content=?,address=?,grade=?,remark=? where studentId=? and checkTime=?");
			preparedstatement.setString(1, shixikaohe.getContent());
			preparedstatement.setString(2, shixikaohe.getAddress());
			preparedstatement.setString(3, shixikaohe.getGrade());
			preparedstatement.setString(4, shixikaohe.getRemark());
			preparedstatement.setString(5, shixikaohe.getStudentId());
			preparedstatement.setString(6, shixikaohe.getCheckTime());
			preparedstatement.execute();
			s = "sucess";
		}
		catch (SQLException sqlexception)
		{
			System.err.println(sqlexception.getMessage());
			s = "failer";
		}
		finally
		{
			try
			{
				preparedstatement.close();
				con.close();
			}
			catch (Exception exception1)
			{
				exception1.printStackTrace();
			}
		}
		return s;
	}

	public String deleteShixiKaohe(String s, String s1)
	{
		PreparedStatement preparedstatement = null;
		String s2 = "";
		try
		{
			preparedstatement = con.prepareStatement("delete from shixiKaohe where studentId=? and checkTime=?");
			preparedstatement.setString(1, s);
			preparedstatement.setString(2, s1);
			preparedstatement.execute();
			s2 = "sucess";
		}
		catch (SQLException sqlexception)
		{
			System.err.println(sqlexception.getMessage());
			s2 = "failer";
		}
		finally
		{
			try
			{
				preparedstatement.close();
				con.close();
			}
			catch (Exception exception1)
			{
				exception1.printStackTrace();
			}
		}
		return s2;
	}

	public ResultSet executeQuery(String s)
	{
		Object obj = null;
		ResultSet resultset = null;
		try
		{
			Statement statement = con.createStatement(1005, 1008);
			resultset = statement.executeQuery(s);
		}
		catch (SQLException sqlexception)
		{
			System.err.println(sqlexception.getMessage());
		}
		return resultset;
	}

	public void close()
	{
		try
		{
			con.close();
		}
		catch (SQLException sqlexception)
		{
			sqlexception.printStackTrace();
		}
	}

	public String getAllClass()
	{
		Object obj = null;
		Object obj1 = null;
		StringBuffer stringbuffer = new StringBuffer();
		try
		{
			Statement statement = con.createStatement(1005, 1008);
			String s;
			for (ResultSet resultset = statement.executeQuery("select distinct className from banji"); resultset.next(); stringbuffer.append("<option value='" + s + "'>" + s + "</option>\n"))
				s = resultset.getString("className");

		}
		catch (SQLException sqlexception)
		{
			return "";
		}
		return stringbuffer.toString();
	}
}

⌨️ 快捷键说明

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