資源簡(jiǎn)介
Java代碼,實(shí)現(xiàn)企業(yè)人力資源管理,只涉及Java ee部分,

代碼片段和文件信息
package?com.dh.hrmanager.db;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?com.dh.hrmanager.util.Config;
public?class?DBUtil?{
Connection?conn?=?null;
PreparedStatement?pstmt?=?null;
ResultSet?rs?=?null;
/**
?*?得到數(shù)據(jù)庫連接
?*/
public?Connection?getConnection()?throws?ClassNotFoundException?SQLException
InstantiationException?IllegalAccessException?{
String?DRIVER?=?Config.getValue(“driver“);
String?URL?=?Config.getValue(“url“);
String?USERNAME?=?Config.getValue(“username“);
String?PASSWORD?=Config.getValue(“password“);
//System.out.println(DRIVER);
try?{
//?指定驅(qū)動(dòng)程序
Class.forName(DRIVER);
//?建立數(shù)據(jù)庫連結(jié)
conn?=?DriverManager.getConnection(URLUSERNAME?PASSWORD);
return?conn;
}?catch?(Exception?e)?{
//?如果連接過程出現(xiàn)異常,拋出異常信息
throw?new?SQLException(“驅(qū)動(dòng)錯(cuò)誤或連接失?。 埃?
}
}
/**
?*?釋放資源
?*/
public?void?closeAll()??{
//?如果rs不空,關(guān)閉rs
if?(rs?!=?null)?{
try?{
rs.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
}
//?如果pstmt不空,關(guān)閉pstmt
if?(pstmt?!=?null)?{
try?{
pstmt.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
}
//?如果conn不空,關(guān)閉conn
if?(conn?!=?null)?{
try?{
conn.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
}
}
/**
?*?執(zhí)行SQL語句,可以進(jìn)行查詢
?*/
public?ResultSet?executeQuery(String?preparedSql?String[]?param)?{
//?處理SQL執(zhí)行SQL
try?{
//?得到PreparedStatement對(duì)象
pstmt?=?conn.prepareStatement(preparedSql);
if?(param?!=?null)?{
for?(int?i?=?0;?i? //?為預(yù)編譯sql設(shè)置參數(shù)
pstmt.setString(i?+?1?param[i]);
}
}
//?執(zhí)行SQL語句
rs?=?pstmt.executeQuery();
}?catch?(SQLException?e)?{
//?處理SQLException異常
e.printStackTrace();
}
return?rs;
}
/**
?*?執(zhí)行SQL語句,可以進(jìn)行增、刪、改的操作,不能執(zhí)行查詢
?*/
public?int?executeUpdate(String?preparedSql?String[]?param)?{
int?num?=?0;
//?處理SQL執(zhí)行SQL
try?{
//?得到PreparedStatement對(duì)象
pstmt?=?conn.prepareStatement(preparedSql);
if?(param?!=?null)?{
for?(int?i?=?0;?i? //?為預(yù)編譯sql設(shè)置參數(shù)
pstmt.setString(i?+?1?param[i]);
}
}
//?執(zhí)行SQL語句
num?=?pstmt.executeUpdate();
}?catch?(SQLException?e)?{
//?處理SQLException異常
e.printStackTrace();
}
return?num;
}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????355??2012-02-28?09:15??企業(yè)人力資源管理系統(tǒng)\ph10\.classpath
?????文件????????380??2012-02-28?09:13??企業(yè)人力資源管理系統(tǒng)\ph10\.project
?????文件????????629??2012-02-28?09:13??企業(yè)人力資源管理系統(tǒng)\ph10\.settings\org.eclipse.jdt.core.prefs
?????文件???????2774??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\DBUtil.class
?????文件???????2372??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\DepartmentDao.class
?????文件???????4109??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\EvaluationDao.class
?????文件???????5107??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\ReportDao.class
?????文件???????1910??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\RoleDao.class
?????文件??????10107??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\db\UserDao.class
?????文件???????1880??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Admin.class
?????文件????????968??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Department.class
?????文件????????589??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\EditTable.class
?????文件???????3319??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Employee.class
?????文件???????1754??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Evaluation.class
?????文件????????138??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\IWork.class
?????文件???????1812??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Manager.class
?????文件???????1113??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Report.class
?????文件????????956??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Role.class
?????文件???????2463??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\entity\Staff.class
?????文件????????996??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\Config.class
?????文件???????1386??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\Data.class
?????文件???????9255??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\HrHelper.class
?????文件???????6751??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\Menu.class
?????文件????????557??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\StartHr.class
?????文件???????2145??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\util\SwingHrHelper.class
?????文件???????3165??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\view\admin\AddEmployee$1.class
?????文件???????4762??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\view\admin\AddEmployee.class
?????文件???????1093??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\view\admin\AdminMain$1.class
?????文件???????1020??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\view\admin\AdminMain$2.class
?????文件???????1003??2018-11-22?13:47??企業(yè)人力資源管理系統(tǒng)\ph10\bin\com\dh\hrmanager\view\admin\AdminMain$3.class
............此處省略109個(gè)文件信息
評(píng)論
共有 條評(píng)論