📄 zonghszfenbean.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: ZonghszfenBean.java
package mypackage;
import java.io.PrintStream;
import java.sql.*;
// Referenced classes of package mypackage:
// DataBaseConnection, Zonghszfen
public class ZonghszfenBean
{
private Connection con;
public ZonghszfenBean()
{
con = null;
con = DataBaseConnection.getConnection();
}
public boolean existXuesheng(Zonghszfen zonghszfen)
{
boolean flag = false;
try
{
String s = zonghszfen.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 existZonghszfen(Zonghszfen zonghszfen)
{
ResultSet resultset;
String s = zonghszfen.getStudentId();
String s1 = zonghszfen.getXueqi();
PreparedStatement preparedstatement = con.prepareStatement("select * from zonghszfen where studentId='" + s + "' and xueqi='" + s1 + "'");
resultset = preparedstatement.executeQuery();
Exception exception;
return resultset.next();
exception;
return false;
}
public String addZonghszfen(Zonghszfen zonghszfen)
{
PreparedStatement preparedstatement;
preparedstatement = null;
String s = "";
String s2;
if (existXuesheng(zonghszfen))
break MISSING_BLOCK_LABEL_23;
s2 = "notExist";
return s2;
if (!existZonghszfen(zonghszfen))
break MISSING_BLOCK_LABEL_41;
s2 = "exist";
return s2;
String s1;
try
{
preparedstatement = con.prepareStatement("insert into zonghszfen values(?,?,?,?,?,?,?,?)");
preparedstatement.setString(1, zonghszfen.getStudentId());
preparedstatement.setString(2, zonghszfen.getXueqi());
preparedstatement.setString(3, zonghszfen.getDeyufen());
preparedstatement.setString(4, zonghszfen.getZhiyufen());
preparedstatement.setString(5, zonghszfen.getShenxinfen());
preparedstatement.setString(6, zonghszfen.getMeiyufen());
preparedstatement.setString(7, zonghszfen.getShijianfen());
preparedstatement.setString(8, zonghszfen.getChuanxinfen());
preparedstatement.execute();
s1 = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s1 = "failer";
}
break MISSING_BLOCK_LABEL_219;
local;
try
{
preparedstatement.close();
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
JVM INSTR ret 6;
return s1;
}
public String updateZonghszfen(Zonghszfen zonghszfen)
{
PreparedStatement preparedstatement = null;
String s = "";
try
{
preparedstatement = con.prepareStatement("update zonghszfen set deyufen=?,zhiyufen=?,shenxinfen=?,meiyufen=?,shijianfen=?,chuanxinfen=? where studentId=? and xueqi=?");
preparedstatement.setString(1, zonghszfen.getDeyufen());
preparedstatement.setString(2, zonghszfen.getZhiyufen());
preparedstatement.setString(3, zonghszfen.getShenxinfen());
preparedstatement.setString(4, zonghszfen.getMeiyufen());
preparedstatement.setString(5, zonghszfen.getShijianfen());
preparedstatement.setString(6, zonghszfen.getChuanxinfen());
preparedstatement.setString(7, zonghszfen.getStudentId());
preparedstatement.setString(8, zonghszfen.getXueqi());
preparedstatement.execute();
s = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s = "failer";
}
finally
{
try
{
if (preparedstatement != null)
preparedstatement.close();
if (con != null)
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
}
return s;
}
public String deleteZonghszfen(String s, String s1)
{
PreparedStatement preparedstatement = null;
String s2 = "";
try
{
preparedstatement = con.prepareStatement("delete from zonghszfen where studentId=? and xueqi=?");
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 void executeUpdate(String s)
{
Object obj = null;
try
{
Statement statement = con.createStatement(1005, 1008);
statement.executeUpdate(s);
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
}
}
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 + -