JAVA課設(shè)職工信息管理系統(tǒng)方案_第1頁
JAVA課設(shè)職工信息管理系統(tǒng)方案_第2頁
JAVA課設(shè)職工信息管理系統(tǒng)方案_第3頁
JAVA課設(shè)職工信息管理系統(tǒng)方案_第4頁
JAVA課設(shè)職工信息管理系統(tǒng)方案_第5頁
已閱讀5頁,還剩51頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、. . . . *實(shí)踐教學(xué)* 理工大學(xué)計(jì)算機(jī)與通信學(xué)院JAVA課程設(shè)計(jì)題 目:職工信息管理系統(tǒng) 專業(yè)班級:計(jì)算機(jī)科學(xué)與技術(shù)2班 姓 名: 曉剛 學(xué) 號:10240235 指導(dǎo)教師: 永 成 績:53 / 56 摘 要用計(jì)算機(jī)管理職工信息具有可靠、方便、省時省力的特點(diǎn)。當(dāng)今各種管理軟件大部分只針對一個公司或者更大的圍來編寫,它具有通用性良好的特點(diǎn),但對于小領(lǐng)域如一個系來說,它就很難適應(yīng)這個系特殊的管理。而該設(shè)計(jì)正是基于職工信息管理的特點(diǎn)來開發(fā)的。它可以實(shí)現(xiàn)職工信息的錄入、添加、修改、刪除、查詢、保存到數(shù)據(jù)庫等基本功能。同時還為管理者提供統(tǒng)計(jì)、制表、系統(tǒng)日志、開介紹信等特色功能。該系統(tǒng)具有界面友好

2、、操作方便、成本低廉、符合管理者習(xí)慣的特點(diǎn)。另外,系統(tǒng)采用Java語言開發(fā),具有可移植性良好、不依賴于操作系統(tǒng)的特點(diǎn)。同時采用My SQL數(shù)據(jù)庫管理系統(tǒng)做數(shù)據(jù)庫,是因?yàn)樗哂泄芾矸奖?存儲量大的特點(diǎn),適合計(jì)算機(jī)系信息管理的要求,它主要包含以下幾個模塊:系統(tǒng)權(quán)限的設(shè)定、原始數(shù)據(jù)錄入、數(shù)據(jù)的匯總與查詢等。本文系統(tǒng)的分析了軟件開發(fā)的背景以過程;首先介紹了軟件的開發(fā)環(huán)境,其次介紹了本軟件的詳細(xì)設(shè)計(jì)過程:數(shù)據(jù)庫的設(shè)計(jì)、各個模塊的設(shè)計(jì)和實(shí)現(xiàn),以與具體界面的設(shè)計(jì)和功能。關(guān)鍵詞:職工 管理 信息系統(tǒng) 職工信息目 錄一、需求分析1二、總體設(shè)計(jì)2三、詳細(xì)設(shè)計(jì)33.1基礎(chǔ)數(shù)據(jù)定義33.2主要功能實(shí)現(xiàn)5 3.3數(shù)據(jù)庫

3、表定義.25四、測試284.1登錄主界面284.2管理員身份登錄主界面284.3普通用戶身份登錄主界面294.4t添加職工信息294.5修改職工信息304.6職工信息查詢304.6刪除職工信息.314.6添加用戶信息.314.6修改用戶信息.324.6用戶信息查詢.324.6刪除用戶信息.334.6用戶密碼修改.33設(shè)計(jì)總結(jié)34參考文獻(xiàn)35致36一、需求分析1.1問題描述對職工信息進(jìn)行管理,包括:職工信息的錄入、修改、刪除、更新,還有對登錄用戶進(jìn)行管理,包括用戶信息的錄入、刪除、修改,密碼修改等管理,還有對用戶信息的現(xiàn)實(shí)打印,查找等。1.2要求(1)該管理軟件將對用戶信息進(jìn)行管理和統(tǒng)計(jì),對職工

4、的信息進(jìn)行錄入更新管理和統(tǒng)計(jì);(2)該管理軟件將為用戶提供賬號管理工具,以便用戶對賬號進(jìn)行管理,具體為添加用戶、刪除用戶、修改用戶密碼;(4)該管理軟件提供人員管理,能夠?qū)T工的分類管理,新員工的加入以與員工刪除,修改進(jìn)本信息等功能。1.3實(shí)現(xiàn)功能(1)由鍵盤輸入職工對象,以數(shù)據(jù)庫方式保存。程序執(zhí)行時將文件錄入數(shù)據(jù)庫。(2)對職工對象進(jìn)行查找,修改,刪除,更新等操作。(3)對用戶對象進(jìn)行查找,修改,刪除,更新等操作。二、總體設(shè)計(jì)根據(jù)需求分析,整個職工管理系統(tǒng)的功能結(jié)構(gòu)如圖1所示:職工信息管理系統(tǒng)基礎(chǔ)功能信息維護(hù)查詢管理系統(tǒng)管理職工信息錄入用戶信息維護(hù) 信息刪除 修改更新職工信息查詢 密碼修改

5、退出系統(tǒng)圖1 系統(tǒng)功能結(jié)構(gòu)圖三、詳細(xì)設(shè)計(jì)3.1基礎(chǔ)數(shù)據(jù)類定義3.1.1職工數(shù)據(jù)定義publicclass Staff private String id; / 職工號private String name; / private String type; / 任職類型private String xueli; / 學(xué)歷private String address; / 地址private String sex; / 性別privateintage; / 年齡privatedoublesalary; / 工資3.1.2用戶數(shù)據(jù)定義publicclass User private String id

6、; / 用戶編號private String name; / 用戶private String sex; / 性別private String type; / 用戶類別3.1.3數(shù)據(jù)庫操作定義publicclass BaseDao protectedstatic String driver = ".mysql.jdbc.Driver" / 數(shù)據(jù)庫驅(qū)動protectedstatic String url = "jdbc:mysql:/localhost:3306/projectdata?userUnicode=true&characterEncoding=u

7、tf8" / 連接urlprotectedstatic String dbUser = "root" / 數(shù)據(jù)庫用戶名protectedstatic String dbPwd = "root" / 數(shù)據(jù)庫密碼privatestatic Connection conn = null;/ 構(gòu)造方法,創(chuàng)建數(shù)據(jù)庫連接private BaseDao() try if (conn = null) Class.forName(driver); / 加載數(shù)據(jù)庫驅(qū)動conn = DriverManager.getConnection(url, dbUser, d

8、bPwd); / 建立數(shù)據(jù)庫連接 elsereturn; catch (Exception ee) System.out.println("數(shù) 據(jù) 庫 連 接 失 敗 !");ee.printStackTrace();/ 執(zhí)行數(shù)據(jù)庫查詢操作publicstatic ResultSet executeQuery(String sql) try if (conn = null)new BaseDao();returnconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).e

9、xecuteQuery(sql); / 執(zhí)行數(shù)據(jù)庫查詢 catch (SQLException e) e.printStackTrace();returnnull;/ 執(zhí)行數(shù)據(jù)庫更新操作publicstaticint executeUpdate(String sql) try if (conn = null)new BaseDao();returnconn.createStatement().executeUpdate(sql); / 執(zhí)行數(shù)據(jù)庫更新 catch (SQLException e) System.out.println("錯誤信息:"+e.getMessage

10、();return -1; finally publicstaticvoid close() try conn.close(); catch (SQLException e) e.printStackTrace(); finally conn = null;3.2主要功能實(shí)現(xiàn)3.2.1 職工信息錄入publicclassStaffAddextends JFrame private JPanel dialogPane;private JPanel contentPanel;private JLabel lb_id;private JTextField tf_id;private JLabel l

11、b_name;private JTextField tf_name;private JLabel lb_type;private JComboBox cb_type;private JLabel lb_xueli;private JTextField tf_xueli;private JLabel lb_address;private JTextField tf_address;private JLabel lb_sex;private JTextField tf_sex;private JLabel lb_salary;private JTextField tf_salary;private

12、 JLabel lb_age;private JTextField tf_age;private JPanel buttonBar;private utton btn_save;private utton btn_close;public StaffAdd() initComponents();privatevoid initComponents() dialogPane = new JPanel();contentPanel = new JPanel();lb_id = new JLabel();tf_id = new JTextField();lb_name = new JLabel();

13、tf_name = new JTextField();lb_type = new JLabel();cb_type = new JComboBox(Constant.STAFF_TYPES);lb_xueli = new JLabel();tf_xueli = new JTextField();lb_address = new JLabel();tf_address = new JTextField();lb_sex = new JLabel();tf_sex = new JTextField();lb_salary = new JLabel();tf_salary = new JTextFi

14、eld();lb_age = new JLabel();tf_age = new JTextField();buttonBar = new JPanel();btn_save = new utton();btn_close = new utton();setTitle("添加職工");setResizable(false);Container contentPane = getContentPane();contentPane.setLayout(new BorderLayout();dialogPane.setBorder(new EmptyBorder(12, 12,

15、12, 12);dialogPane.setLayout(new BorderLayout();contentPanel.setLayout(new GridLayout(5, 4, 6, 6);lb_id.setText("職工號:");lb_id.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_id);contentPanel.add(tf_id);lb_sex.setText("性別:");lb_sex.setHorizontalAlignment(SwingCons

16、tants.RIGHT);contentPanel.add(lb_sex);contentPanel.add(tf_sex);lb_name.setText(":");lb_name.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_name);contentPanel.add(tf_name);lb_type.setText("任職類型:");lb_type.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.

17、add(lb_type);contentPanel.add(cb_type);lb_xueli.setText("學(xué)歷:");lb_xueli.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_xueli);contentPanel.add(tf_xueli);lb_salary.setText("工資:");lb_salary.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_salary);c

18、ontentPanel.add(tf_salary);lb_address.setText("地址:");lb_address.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_address);contentPanel.add(tf_address);lb_age.setText("年齡:");lb_age.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_age);contentPanel.a

19、dd(tf_age);dialogPane.add(contentPanel, BorderLayout.CENTER);buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0);buttonBar.setLayout(new GridBagLayout();(GridBagLayout) buttonBar.getLayout().columnWidths = newint 0, 85, 80 ;(GridBagLayout) buttonBar.getLayout().columnWeights = newdouble 1.0, 0.0, 0.0 ;

20、btn_save.setText("保存");btn_save.addActionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_saveActionPerformed(e););buttonBar.add(btn_save, new GridBagConstraints(1, 0, 1, 1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)

21、;btn_close.setText("關(guān)閉");btn_close.addActionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_closeActionPerformed(e););buttonBar.add(btn_close, new GridBagConstraints(2, 0, 1, 1,0.0, 0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0, 0, 0, 0),

22、0, 0);dialogPane.add(buttonBar, BorderLayout.SOUTH);contentPane.add(dialogPane, BorderLayout.CENTER);setSize(625, 260);setLocationRelativeTo(getOwner();show();privatevoid btn_saveActionPerformed(ActionEvent e) String id = tf_id.getText();String name = tf_name.getText();String type = cb_type.getSelec

23、tedItem().toString();String xueli = tf_xueli.getText();String address = tf_address.getText();String sex = tf_sex.getText();String salary = tf_salary.getText();String age = tf_age.getText();String sql = "insert into staff(id,name,type,xueli,address,sex,salary,age) values('"+ id+ "&

24、#39;,'"+ name+ "','"+ type+ "','"+ xueli+ "','"+ address + "','" + sex + "','" + salary + "','" + age + "')"int i = BaseDao.executeUpdate(sql);if (i = 1) JOptionPane.sho

25、wMessageDialog(null, "添加成功");dispose();privatevoid btn_closeActionPerformed(ActionEvent e) dispose();3.2.2職工信息修改publicclassStaffUpdateextends JFrame private JPanel dialogPane;private JPanel contentPanel;private JLabel lb_cx_id;private JTextField tf_cx_id;private utton btn_query;private JLa

26、bel label12;private JLabel lb_id;private JTextField tf_id;private JLabel lb_name;private JTextField tf_name;private JLabel lb_type;private JComboBox cb_type;private JLabel lb_xueli;private JTextField tf_xueli;private JLabel lb_address;private JTextField tf_address;private JLabel lb_sex;private JText

27、Field tf_sex;private JLabel lb_salary;private JTextField tf_salary;private JLabel lb_age;private JTextField tf_age;private JPanel buttonBar;private utton btn_save;private utton btn_close;public StaffUpdate() initComponents();privatevoid initComponents() dialogPane = new JPanel();contentPanel = new J

28、Panel();lb_cx_id = new JLabel();tf_cx_id = new JTextField();btn_query = new utton();label12 = new JLabel();lb_id = new JLabel();tf_id = new JTextField();lb_name = new JLabel();tf_name = new JTextField();lb_type = new JLabel();cb_type = new JComboBox(Constant.STAFF_TYPES);lb_xueli = new JLabel();tf_x

29、ueli = new JTextField();lb_address = new JLabel();tf_address = new JTextField();lb_sex = new JLabel();tf_sex = new JTextField();lb_salary = new JLabel();tf_salary = new JTextField();lb_age = new JLabel();tf_age = new JTextField();buttonBar = new JPanel();btn_save = new utton();btn_close = new utton(

30、);setTitle("修改職工信息");setResizable(false);Container contentPane = getContentPane();contentPane.setLayout(new BorderLayout();dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12);dialogPane.setLayout(new BorderLayout();contentPanel.setLayout(new GridLayout(6, 4, 6, 6);lb_cx_id.setText("職

31、工號:");lb_cx_id.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_cx_id);contentPanel.add(tf_cx_id);btn_query.setText("查詢");btn_query.addActionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_queryActionPerformed(e););contentPanel.add(btn_query

32、);label12.setText("text");label12.setVisible(false);contentPanel.add(label12);lb_id.setText("職工號:");lb_id.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_id);tf_id.setEditable(false);contentPanel.add(tf_id);lb_name.setText(":");lb_name.setHorizontalAlig

33、nment(SwingConstants.RIGHT);contentPanel.add(lb_name);contentPanel.add(tf_name);lb_type.setText("任職類型:");lb_type.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_type);contentPanel.add(cb_type);lb_xueli.setText("學(xué)歷:");lb_xueli.setHorizontalAlignment(SwingConstants

34、.RIGHT);contentPanel.add(lb_xueli);contentPanel.add(tf_xueli);lb_address.setText("地址:");lb_address.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_address);contentPanel.add(tf_address);lb_sex.setText("性別:");lb_sex.setHorizontalAlignment(SwingConstants.RIGHT);cont

35、entPanel.add(lb_sex);contentPanel.add(tf_sex);lb_salary.setText("工資:");lb_salary.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_salary);contentPanel.add(tf_salary);lb_age.setText("年齡:");lb_age.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_age)

36、;contentPanel.add(tf_age);dialogPane.add(contentPanel, BorderLayout.CENTER);buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0);buttonBar.setLayout(new GridBagLayout();(GridBagLayout) buttonBar.getLayout().columnWidths = newint 0, 85, 80 ;(GridBagLayout) buttonBar.getLayout().columnWeights = newdouble

37、1.0, 0.0, 0.0 ;btn_save.setText("保存");btn_save.addActionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_saveActionPerformed(e););buttonBar.add(btn_save, new GridBagConstraints(1, 0, 1, 1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(0,

38、0, 0, 5), 0, 0);btn_close.setText("關(guān)閉");btn_close.addActionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_closeActionPerformed(e););buttonBar.add(btn_close, new GridBagConstraints(2, 0, 1, 1,0.0, 0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Inset

39、s(0, 0, 0, 0), 0, 0);dialogPane.add(buttonBar, BorderLayout.SOUTH);contentPane.add(dialogPane, BorderLayout.CENTER);setSize(625, 260);setLocationRelativeTo(getOwner();show();privatevoid btn_saveActionPerformed(ActionEvent e) / 獲取用戶輸入信息String id = tf_id.getText();String name = tf_name.getText();Strin

40、g type = cb_type.getSelectedItem().toString();String xueli = tf_xueli.getText();String address = tf_address.getText();String sex = tf_sex.getText();String salary = tf_salary.getText();String age = tf_age.getText();/ 拼接sqlString sql = "update staff set name='" + name + "',type=

41、'" + type+ "',xueli='" + xueli + "',address='" + address + "',sex='"+ sex + "',salary=" + Double.parseDouble(salary) + ",age="+ age + " where id='" + id + "'"/ 執(zhí)行數(shù)據(jù)庫操作int i = BaseDao.ex

42、ecuteUpdate(sql);if (i = 1) JOptionPane.showMessageDialog(null, "修改成功");dispose();privatevoid btn_queryActionPerformed(ActionEvent e) String id = tf_cx_id.getText(); / 職工號Staff staff = StaffDao.selectStaff(id); / 根據(jù)編號查詢職工信息/ 設(shè)置職工信息if (staff != null) tf_id.setText(staff.getId();tf_name.setT

43、ext(staff.getName();cb_type.setSelectedItem(staff.getType();tf_xueli.setText(staff.getXueli();tf_address.setText(staff.getAddress();tf_sex.setText(staff.getSex();tf_salary.setText(String.valueOf(staff.getSalary();tf_age.setText(String.valueOf(staff.getAge();privatevoid btn_closeActionPerformed(Actio

44、nEvent e) dispose();3.2.3職工信息刪除publicclassStaffDeleteextends JFrame private JPanel dialogPane;private JPanel contentPanel;private JLabel lb_cx_id;private JTextField tf_cx_id;private utton btn_query;private JLabel label12;private JLabel lb_id;private JTextField tf_id;private JLabel lb_name;private JT

45、extField tf_name;private JLabel lb_type;private JComboBox cb_type;private JLabel lb_xueli;private JTextField tf_xueli;private JLabel lb_address;private JTextField tf_address;private JLabel lb_sex;private JTextField tf_sex;private JLabel lb_salary;private JTextField tf_salary;private JLabel lb_age;pr

46、ivate JTextField tf_age;private JPanel buttonBar;private utton btn_del;private utton btn_close;public StaffDelete() initComponents();privatevoid initComponents() dialogPane = new JPanel();contentPanel = new JPanel();lb_cx_id = new JLabel();tf_cx_id = new JTextField();btn_query = new utton();label12

47、= new JLabel();lb_id = new JLabel();tf_id = new JTextField();lb_name = new JLabel();tf_name = new JTextField();lb_type = new JLabel();cb_type = new JComboBox();lb_xueli = new JLabel();tf_xueli = new JTextField();lb_address = new JLabel();tf_address = new JTextField();lb_sex = new JLabel();tf_sex = n

48、ew JTextField();lb_salary = new JLabel();tf_salary = new JTextField();lb_age = new JLabel();tf_age = new JTextField();buttonBar = new JPanel();btn_del = new utton();btn_close = new utton();setTitle("刪除職工");setResizable(false);Container contentPane = getContentPane();contentPane.setLayout(n

49、ew BorderLayout();dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12);dialogPane.setLayout(new BorderLayout();contentPanel.setLayout(new GridLayout(6, 4, 6, 6);lb_cx_id.setText("職工號:");contentPanel.add(lb_cx_id);contentPanel.add(tf_cx_id);btn_query.setText("查詢");btn_query.addAct

50、ionListener(new ActionListener() publicvoid actionPerformed(ActionEvent e) btn_queryActionPerformed(e););contentPanel.add(btn_query);label12.setText("text");label12.setVisible(false);contentPanel.add(label12);lb_id.setText("職工號:");lb_id.setHorizontalAlignment(SwingConstants.RIGHT

51、);contentPanel.add(lb_id);tf_id.setEditable(false);contentPanel.add(tf_id);lb_name.setText(":");lb_name.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_name);tf_name.setEditable(false);contentPanel.add(tf_name);lb_type.setText("任職類型:");lb_type.setHorizontalAlignm

52、ent(SwingConstants.RIGHT);contentPanel.add(lb_type);cb_type.setEnabled(false);contentPanel.add(cb_type);lb_xueli.setText("學(xué)歷:");lb_xueli.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_xueli);tf_xueli.setEnabled(false);contentPanel.add(tf_xueli);lb_address.setText("地址:");lb_address.setHorizontalAlignment(SwingConstants.RIGHT);contentPanel.add(lb_address);tf_address.setEnabled(false);contentPanel.a

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論