

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、Eclipse+Java+Swing 實現企業事管理系統、系統介紹本系統實現的功能:戶登錄、員信息的增刪改查、導出Execl、計算器、記事本、信息排序。采AES加密算法,數據庫使Mysql8.0.13,界良好。、系統展登錄頁主頁添加員信息修改員信息計算器記事本導出Execl三、系統實現AccountDao.javapackage;importimportimportimportTbPerson;importimportimportDataAccessException;BeanPropertyRowMapper;JdbcTemplate;import;public class AccountD
2、ao private static JdbcTemplate template =new JdbcTemplate(.getDataSource();public static ListTbAccountfindAllAccount() try String sql =select * from tb_account;ListTbAccounta =template.query(sql, new BeanPropertyRowMapperTbAccount(TbAccount.class);return a; catch (DataAccessException e) e.printStack
3、Trace();return null;public static String findAccountMoneyById(int i) try String sql =select * from tb_account where timecard_id=? ;TbAccount tbAccount =template.queryForObject(sql, new BeanPropertyRowMapperTbAccount(TbAccount.class),i);importimportimportimportimportpublic static ListTbDeptfindAllDep
4、t() String sql =select * from tb_dept;ListTbDepttbDept =template.query(sql, new BeanPropertyRowMapperTbDept(TbDept.class);return tbDept; catch (DataAccessException e) e.printStackTrace();return null;public static int findDeptIdByName(String item) String sql =select * from tb_dept where name=? ;TbDep
5、t dept =template.queryForObject(sql, new BeanPropertyRowMapperTbDept(TbDept.class), item);public static ListTbDeptfindAllDeptExceptZero() try String sql =select * from tb_dept where id0 ;ListTbDepttbDept =template.query(sql, new BeanPropertyRowMapperTbDept(TbDept.class);return tbDept; catch (DataAcc
6、essException e) e.printStackTrace();return null;public static TbDept findDeptByName(String name) try String sql =select * from tb_dept where name=? ;public static void addDept(TbDept d2) try String sql =insert into tb_dept(name) values (?) ;template.update(sql, d2.getName(); catch (DataAccessExcepti
7、on e) e.printStackTrace();public static void deleteDeptById(int id) package;importimportList;TbPerson;importimportimportDataAccessException;BeanPropertyRowMapper;JdbcTemplate;importimport;PwEncryption;public class PersonDao private static JdbcTemplate template =new JdbcTemplate(.getDataSource();publ
8、ic static TbPerson queryRecordByNum(String num) try String sql =select * from tb_person where record_number=? ;TbPerson tbRecord =template.queryForObject(sql, new BeanPropertyRowMapperTbPerson(TbPerson.class), num);return tbRecord; catch (DataAccessException e) e.printStackTrace();public static TbPe
9、rson findPersonByRecordNumber(String recordNumber) try String sql =select * from tb_person where record_number=? ;TbPerson tbPerson =template.queryForObject(sql, new BeanPropertyRowMapperTbPerson(TbPerson.class),recordNumber);return tbPerson; catch (DataAccessException e) System.out.println(查找員為空數據
10、);e.printStackTrace();return null;public static void updatePerson(TbPerson person) try catch (Exception e) e.printStackTrace();public static void updatePersonPassword(TbPerson person) try String sql =update tb_person set password = ? where record_number= ? ;template.update(sql, person.getPassword(),
11、 person.getRecordNumber(); catch (Exception e) e.printStackTrace();public static ListTbPersonlikePersonByName(String name) try String sql =select * from tb_person where name like % ? % ;ListTbPersontbPerson =template.query(sql, new BeanPropertyRowMapperTbPerson(TbPerson.class), name);return tbPerson
12、; catch (DataAccessException e) e.printStackTrace();return null;public static void main(String args) String userName =T00001;String password =123456;TbPerson person =new TbPerson(userName, PwEncryption.encrypt(password, key);login(person);importimportimportimportimportimportimport/* Druid連接池具類,將來dao
13、層調*/private static DataSource dataSource; / 定義成員變量DataSource/ 獲取DataSource/*獲取連接*/public static Connection getConnection() throws SQLException return dataSource.getConnection();/*釋放資源*/public static void close(Statement statement, Connection connection) close(null, statement, connection);public stat
14、ic void close(ResultSet resultSet, Statement statement, Connection connection) if (resultSet != null) try resultSet.close(); catch (SQLException e) e.printStackTrace();if (statement != null) try statement.close(); catch (SQLException e) e.printStackTrace();connection.close();/ 歸還連接/*/;importimportim
15、portimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportimportJFrame;JLabel;EmptyBorder;SwingConstants;importimportTbPerson;BeautyEyeLNFHelper;importimportimportimportTxtExport;/*登陸窗體類,為戶第窗體* author 22219*/public class LoginFrame extends
16、JFrame /*串版本標識serialVersionUID*/private JPanel contentPane;public static JTextField userNameTxt;private JPasswordField passwordTxt;public static String time;/*/*/setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);lblNewLabel_2.setIcon(new ImageIcon(LoginFrame.class.getResource(/images/password.png);user
17、NameTxt =new JTextField();passwordTxt =new JPasswordField(););this.addWindowListener(new WindowAdapter() / bg-this.getContentPane().add(lbBg);/ bg-TimerTask task =new TimerTask() public void run() String sdate =(new SimpleDateFormat(yyyy-MM-dd HH:mm:ss).format(new Date();timeLabel.setText(sdate);Tim
18、er t =new Timer();/* param e*/private void loginActionPerformed(ActionEvent e) / 導出登陸志(戶id+時間)TxtExport.writeTxtFile(Id +userNameTxt.getText() +t +time);/*重置事件處理* param e*/this.passwordTxt.setText();userNameTxt.requestFocus();/*注冊事件處理* param e*/private void enrollValueActionPerformed(ActionEvent e) String str =JOptionPane.showInputDialog(this, , , 2);TbPerson p =PersonDao.fi
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- DB32/T 3668-2019凹凸棒石粘土礦分級規范
- DB32/T 3658-2019蕎麥生產技術規程
- DB32/T 3571-2019水稻全程機械化生產技術規范
- DB32/T 1967-2021迷你南瓜春播早熟生產技術規程
- DB31/T 942.1-2015節能消費領跑者評價方法(生產企業)第1部分:家用空調器生產企業
- DB31/T 715-2013汽車玻璃用膜安全節能技術要求
- DB31/T 688-2013建筑工程施工質量安全風險管理規范
- DB31/T 656-2021鋁及鋁合金熔解保溫爐節能運行評價指標
- DB31/T 560-2011道路清掃保潔作業道班房設置和設計要求
- DB31/T 551-2011星級飯店建筑合理用能指南
- GB/T 8813-2008硬質泡沫塑料壓縮性能的測定
- 中小學學習《民法典》主題班會精品模板ppt
- 國開經濟學(本)1-14章練習試題及答案
- 《企業銷售費用控制研究(論文)8600字》
- 二0二三年度六年級上冊Module1《多維閱讀》第八級DifferentPlants教學設計
- 公司網銀盾交接單
- JT∕T 784-2022 組合結構橋梁用波形鋼腹板
- 汽車客運有限公司成本費用管理規定
- 緩刑期滿個人總結
- 市政道路中線測量內容及計算方法
- 南瓜種植PPT演示課件(PPT 46頁)
評論
0/150
提交評論