Eclipse+Java+Swing实现企业人事管理系统_第1页
Eclipse+Java+Swing实现企业人事管理系统_第2页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论