📄 chengfabean.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: ChengfaBean.java
package mypackage;
import java.io.PrintStream;
import java.sql.*;
// Referenced classes of package mypackage:
// DataBaseConnection, Chengfa
public class ChengfaBean
{
private Connection con;
public ChengfaBean()
{
con = null;
con = DataBaseConnection.getConnection();
}
public boolean existXuesheng(Chengfa chengfa)
{
boolean flag = false;
try
{
String s = chengfa.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 String addChengfa(Chengfa chengfa)
{
PreparedStatement preparedstatement;
preparedstatement = null;
String s = "";
String s2;
if (existXuesheng(chengfa))
break MISSING_BLOCK_LABEL_23;
s2 = "notExist";
return s2;
String s1;
try
{
preparedstatement = con.prepareStatement("insert into chengfa(chengfaName,studentId,chengfaDate,chengfaType,chengfaDescript) values(?,?,?,?,?)");
preparedstatement.setString(1, chengfa.getChengfaName());
preparedstatement.setString(2, chengfa.getStudentId());
preparedstatement.setString(3, chengfa.getChengfaDate());
preparedstatement.setString(4, chengfa.getChengfaType());
preparedstatement.setString(5, chengfa.getChengfaDescript());
preparedstatement.execute();
s1 = "sucess";
}
catch (SQLException sqlexception)
{
System.err.println(sqlexception.getMessage());
s1 = "failer";
}
break MISSING_BLOCK_LABEL_165;
local;
try
{
preparedstatement.close();
con.close();
}
catch (Exception exception1)
{
exception1.printStackTrace();
}
JVM INSTR ret 6;
return s1;
}
public String updateChengfa(Chengfa chengfa)
{
PreparedStatement preparedstatement = null;
String s = "";
try
{
preparedstatement = con.prepareStatement("update chengfa set chengfaName=?,chengfaDate=?,chengfaType=?,chengfaDescript=? where chengfaId=?");
preparedstatement.setString(1, chengfa.getChengfaName());
preparedstatement.setString(2, chengfa.getChengfaDate());
preparedstatement.setString(3, chengfa.getChengfaType());
preparedstatement.setString(4, chengfa.getChengfaDescript());
preparedstatement.setInt(5, chengfa.getChengfaId());
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 deleteChengfa(int i)
{
PreparedStatement preparedstatement = null;
String s = "";
try
{
preparedstatement = con.prepareStatement("delete from chengfa where chengfaId=?");
preparedstatement.setInt(1, i);
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 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 + -