java課程設(shè)計(jì)(人事管理系統(tǒng))_第1頁
java課程設(shè)計(jì)(人事管理系統(tǒng))_第2頁
java課程設(shè)計(jì)(人事管理系統(tǒng))_第3頁
java課程設(shè)計(jì)(人事管理系統(tǒng))_第4頁
java課程設(shè)計(jì)(人事管理系統(tǒng))_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、人事管理系統(tǒng).系統(tǒng)需求分析:2( 1) 系統(tǒng)的功能設(shè)計(jì)2( 2) 系統(tǒng)功能結(jié)構(gòu)2( 3) 數(shù)據(jù)庫設(shè)計(jì)2.功能模塊開發(fā)3( 1) 查詢?nèi)藛T信息界面3( 2) 添加員工界面3( 3) 修改員工信息界面4( 4) 刪除員工界面5( 5) 員工考核界面5( 6) 員工考核歷史記錄界面6. 各個(gè)類說明6. 程序代碼9( 1) Manager9( 2) CardEmploy11( 3) SelEmploy12( 4) AddEmploy14( 5) ReviseEmploy161 UpdDialog18( 6) DelEmploy21( 7) AllEmploy23( 8) Examine23( 9) H

2、istory27( 10) EmployModel29( 11) AppraisalModel30( 12) SqlHelper3335.系統(tǒng)需求分析:(1)系統(tǒng)的功能設(shè)計(jì)i員工信息管理:員工信息管理包括對(duì)員工基本信息和情況進(jìn)行查詢、添加、刪除和修改及部門管理ii員工考核管理:包括對(duì)員工的考核情況進(jìn)行操作,還可以對(duì)歷史考核情況進(jìn)行瀏覽(2)系統(tǒng)功能結(jié)構(gòu)人事管理的系統(tǒng)結(jié)構(gòu)功能結(jié)構(gòu)如圖所示:人事管理系統(tǒng)O-i(3)數(shù)據(jù)庫設(shè)計(jì)員工基本表(Employinfo)名稱字段名稱數(shù)據(jù)類型主鍵非空工號(hào)Empnovarchar(10)YesYes姓名Enamevarchar(10)Noyes性別Sexvarch

3、ar(4)Noyes出生年月BirthdayDatetimeNoYes部門DeptNoChar(10)NoYes職務(wù)EjobChar(20)NoYes工資SalfloatNoYes員工考核表(Appraisal)名稱字段名稱數(shù)據(jù)類型主鍵非空工號(hào)Empnovarchar(10)yesyes考核Consequencevarchar(10)noyes變更日期RegDatedatetimeNoYes考核歷史記錄(History)名稱字段名稱數(shù)據(jù)類型主鍵非空流水號(hào)JourNoIntYesyes工號(hào)Empnovarchar(10)noyes姓名Enamevarchar(10)NoYes上次考核OldInf

4、ovarchar(10)NoYes本次考核NewInfovarchar(10)NoYes變更日期RegDatedatetimeNoYes功能模塊開發(fā)(1)查詢?nèi)藛T信息界面實(shí)例一個(gè)SelEmploy類,當(dāng)點(diǎn)擊“查詢”時(shí)調(diào)用EmployModel類的queryEmploy方法實(shí)現(xiàn)查詢(2)添加員工界面實(shí)例一個(gè)AddEmploy類當(dāng)點(diǎn)擊“添加”時(shí)調(diào)用EmployModel類的updEmploy方法實(shí)現(xiàn)添加功能(3)修改員工信息界面實(shí)例一個(gè)ReviseEmploy類當(dāng)點(diǎn)擊“修改”時(shí),先調(diào)用UpdDialo彈跳由一個(gè)修改信息對(duì)話框,信息修改完畢后,調(diào)用EmployModel類的updEmploy方法實(shí)現(xiàn)

5、修改功能(4)刪除員工界面實(shí)例一個(gè)DelEmploy類當(dāng)點(diǎn)擊“刪除”時(shí)調(diào)用EmployModel類的updEmploy方法實(shí)現(xiàn)刪除功能(5)員工考核界面實(shí)例一個(gè)Examine類當(dāng)點(diǎn)擊“確認(rèn)”時(shí)調(diào)用AppraisalModel類的updAppraisal方法來完成考核功能(6)員工考核歷史記錄界面實(shí)例一個(gè)History類當(dāng)點(diǎn)擊時(shí)調(diào)用AppraisalModel類的updAppraisal方法來完成考核功能三.各個(gè)類說明類之間的關(guān)系圖1. Manager類Manager類的一個(gè)實(shí)例,從而生成了人事管理系統(tǒng)的界面,用JSplitPane類將整個(gè)界面分為左右兩個(gè)部分。其中左側(cè)實(shí)現(xiàn)了人事管理系統(tǒng)的功能樹

6、,采用JTree類構(gòu)建,同時(shí)實(shí)現(xiàn)了TreeSelectionListener接口,定義了該接口所必須實(shí)現(xiàn)的valueChanged(TreeSelectionEvent助法,JSplitPane右邊力口入卡片布局CardEmploy類。當(dāng)JTree的TreeSelectionEvent事件發(fā)生時(shí),調(diào)用CardEmploy的c.show方法切換不同卡片,實(shí)現(xiàn)不同的管理界面。2. CardEmploy類CardEmploy為卡片布局類的面板,主要功能是添加各個(gè)界面的卡片,當(dāng)JTree的TreeSelectionEvent事件發(fā)生時(shí)。切換不同的卡片3. EmployModel、AppraisalMo

7、del類這兩個(gè)類繼承了AbstractTableModel,主要實(shí)現(xiàn)的功能是,存放調(diào)用sqlhelper類得到的數(shù)據(jù)??梢酝ㄟ^調(diào)用sqlhelper實(shí)現(xiàn)增刪查改功能4. SqlHelper類主要就是連接數(shù)據(jù)庫的一些基礎(chǔ)操作是,方便代碼修改,重復(fù)使用5. SelEmploy這個(gè)類繼承Panel,為“查詢員工”的界面。實(shí)現(xiàn)了Actionlistener接口,當(dāng)ActionEvent事件發(fā)生時(shí),調(diào)用EmployModel類的queryEmploy方法實(shí)現(xiàn)查詢6. AddEmploy、ReviseEmploy、DelEmploy類這些類繼承Pane,分別為“添加員工信息”“修改員工信息”“刪除員工信息

8、”的界面,這些類實(shí)現(xiàn)了Actionlistener接口,當(dāng)ActionEvent事件發(fā)生時(shí),調(diào)用EmployModel類的updEmploy方法實(shí)現(xiàn)添加、查詢、刪除、功能7. Examine類這個(gè)類繼承Panel,為“考核員工”界面。這個(gè)類實(shí)現(xiàn)了Actionlistener接口,當(dāng)ActionEvent事件發(fā)生時(shí),(1)先通過調(diào)用AppraisalModel的queryAppraisal獲取上次考核成績,(2)修改Appraisal表的考核成績(3)再把上次考核成績跟本次考核成績加到History表中8. History這個(gè)類主要是把History表中的信息顯示到界面上。四.程序代碼(1)Ma

9、nagerpackagecom.Manager;importimportimportimportimportimportjava.awt.*;javax.swing.*;javax.swing.event.TreeSelectionEvent;javax.swing.event.TreeSelectionListener;javax.swing.tree.*;java.awt.event.*;publicclassManagerextendsJFrameimplementsTreeSelectionListenerJPaneljp;JSplitPanejs;JScrollPanejsp;JTr

10、eetree;DefaultMutableTreeNoderoot,t1,t2,t1_1,t1_2,t1_3,t1_4,t1_5t2_1,t2_2;CardEmployae;EmployModelem;publicstaticvoidmain(String口args)Managermanager=newManager。;publicManager()/給樹的各個(gè)結(jié)點(diǎn)賦值root=newDefaultMutableTreeNode(“人事管理系統(tǒng)”);t1=newDefaultMutableTreeNode(t1_1=newDefaultMutableTreeNode(t1_2=newDefau

11、ltMutableTreeNode(t1_3=newDefaultMutableTreeNode(t1_4=newDefaultMutableTreeNode(t1_5=newDefaultMutableTreeNode(基本信息管理”);查詢員工);添加員工);“修改員工信息);”刪除員工資料);”查詢?nèi)w員工);t2=newDefaultMutableTreeNode(人員考核管理);t2_1=newDefaultMutableTreeNode(人員考核);t2_2=newDefaultMutableTreeNode(考核歷史查詢);t1.add(t1_1);t1.add(t1_2);t1

12、.add(t1_3);t1.add(t1_4);t1.add(t1_5);t2.add(t2_1);t2.add(t2_2);root.add(t1);root.add(t2);tree=newJTree(root);/對(duì)樹進(jìn)行監(jiān)聽tree.addTreeSelectionListener(this);/實(shí)例化CardEmploy面板并加到j(luò)splitpane的邊ae=newCardEmploy();js=newJSplitPane();js.setLeftComponent(tree);js.setRightComponent(ae);this.getContentPane().add(js

13、);this.setTitle(人事管理系統(tǒng));this.setVisible(true);this.setSize(600,500);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);publicvoidvalueChanged(TreeSelectionEvente)tree/獲取點(diǎn)擊結(jié)點(diǎn)名稱DefaultMutableTreeNodedpath=(DefaultMutableTreeNode).getLastSelectedPathComponent();/通過點(diǎn)擊不同結(jié)點(diǎn)切換不同界面if(dpath.equals(t1_1)ae.c

14、.show(ae,1);elseif(dpath.equals(t1_2)ae.c.show(ae,2);elseif(dpath.equals(ae.c.show(ae,3);elseif(dpath.equals(ae.c.show(ae,4);elseif(dpath.equals(ae.c.show(ae,5);elseif(dpath.equals(ae.c.show(ae,6);elseif(dpath.equals(ae.c.show(ae,7);(2)CardEmploy/*用卡片布局設(shè)置各個(gè)界面*/packagecom.Manager;importjavax.swing.*;

15、importjava.awt.*;publicclassCardEmployextendst1_3 ) t1_4 ) t1_5 ) t2_1 ) t2_2 ) PanelCardLayoutc;/查詢表SelEmployselE;/添加表AddEmployaddE;/修改員工信息表ReviseEmployrevE;/刪除員工表格DelEmploydelE/所有員工信息AllEmployallE/員工考核表ExamineexaE;/歷史記錄界面HistoryHis;publicCardEmploy()/查詢員工表selE=newSelEmploy();/添加員工表addE=newAddEmplo

16、y();/修改員工信息revE=newReviseEmploy();/刪除員工表格delE=newDelEmploy();/所有員工信息allE=newAllEmploy();/員工考核表exaE=newExamine。;/歷史記錄界面His=newHistory。;JPaneljp=_newJPanel();(3)/*SelEmploy/定義cardemploy面板為卡片布局/把各個(gè)面板加入到C的卡片布局中c=newCardLayout();this.setLayout(c);this.add(selE,1);this.add(addE,2);this.add(revE,3);this.ad

17、d(delE,4);this.add(allE,5);this.add(exaE,6);this.add(His,7);* SelEmploy類設(shè)置查詢員工界面*/packagecom.Manager;importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;publicclassSelEmployextendsPanelimplementsActionListenerEmployModelem;JLabeljl;JTextFieldjtf;JButtonjb;JTablejt;JScrollPanejsp;JPaneljp1;pu

18、blicSelEmploy()/北部jp1=newJPanel();jl=newJLabel(輸入員工號(hào):);jtf=newJTextField(20);jb=newJButton(查詢);/對(duì)查詢按鈕監(jiān)聽this );jb.addActionListener(jp1.add(jl);jp1.add(jtf);jp1.add(jb);/中部em=newEmployModel();String口paras=1;em.queryEmploy(select*fromEmployinfowhere1=?,paras);jt=newJTable(em);jsp=newJScrollPane(jt);th

19、is.setLayout(newBorderLayout();this.add(jp1,BorderLayout.NORTH);this.add(jsp,BorderLayout.CENTER);publicvoidactionPerformed(ActionEvente)if(e.getSource()=jb)Stringname=this.jtf.getText().trim();Stringsql=select*fromEmployinfowhereEmpno=?String口paras=name;em=newEmployModel();em.queryEmploy(sql,paras)

20、;/查找成功更新表jt.setModel(em);(4)AddEmploypackagecom.Manager;importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;publicclassAddEmployextendsPanelimplementsActionListenerJLabeljl,jl1,jl2,jl3,jl4,jl5,jl6,jl7;JButtonjb1,jb2;JTextFieldjtf1,jtf2,jtf3,jtf4,jtf5,jtf6,jtf7;JPaneljp1,jp2,jp3,jp4;EmployMod

21、elem;publicAddEmploy()jl1=newJLabel(工號(hào):)jl2=newJLabel(姓名:)jl3=newJLabel(“性別:)jl4=newJLabel(出生年月jl5=newJLabel(“部門:)jl6=newJLabel(職位:)jl7=newJLabel(工資:)jtf1=newJTextField(20);jtf2=newJTextField(20);jtf3=newJTextField(20);jtf4=newJTextField(20);jtf5=newJTextField(20);jtf6=newJTextField(20);jtf7=newJTex

22、tField(20);jb1=newJButton(添加);jb2=newJButton(取消);/監(jiān)聽添加取消按鈕jb1.addActionListener(this);jb2.addActionListener(this);jp1=newJPanel(newGridLayout(7,1);jp2=newJPanel(newGridLayout(7,1);jp3=newJPanel();jp1.add(jl1);jp1.add(jl2);jp1.add(jl3);jp1.add(jl4);jp1.add(jl5);jp1.add(jl6);jp1.add(jl7);jp2.add(jtf1)

23、;jp2.add(jtf2);jp2.add(jtf3);jp2.add(jtf4);jp2.add(jtf5);jp2.add(jtf6);jp2.add(jtf7);jp3.add(jb1);jp3.add(jb2);jp4=newJPanel(newBorderLayout();jp4.add(jp1,BorderLayout.WEST);jp4.add(jp2,BorderLayout.EAST);jp4.setSize(300,300);this.setLayout(newFlowLayout();this.add(jp4);this.add(jp3);publicvoidactio

24、nPerformed(ActionEvente)if(e.getSource()=jb1)/調(diào)用EmployModel里的updEmploy方法,實(shí)現(xiàn)對(duì)表格的添加Stringsql=insertintoEmployinfovalues(?,?,?,?,?,?,?)Stringparas=jtf1.getText(),jtf2.getText(),jtf3.getText(),jtf4.getText(),jtf5.getText(),jtf6.getText(),jtf7.getText();em=newEmployModel();if(em.updEmploy(sql,paras)/當(dāng)添加新

25、員工成功時(shí),則彈出”添加成功“的對(duì)話框JOptionPane.showMessageDialog(this,添加成功);elseif(!em.updEmploy(sql,paras)JOptionPane.showMessageDialog(this,添加失敗);/當(dāng)新員工加入成功后,要把新加入員工的工號(hào)加到考核表AppraisalModeltemp=newAppraisalModel();Stringsql1=insertintoAppraisal(Empno)values(?)Stringparas1=jtf1.getText();temp.updAppraisal(sql1,paras1

26、);elseif(e.getSource()=jb2)jtf1.setText();jtf2.setText();jtf3.setText();jtf4.setText();jtf5.setText();jtf6.setText();jtf7.setText();(5)ReviseEmploypackagecom.Manager;/*修改員工界面*/importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassReviseEmployextendsPanelimplementsActionListenerJTabl

27、ejt;JScrollPanejsp;JButtonjb1,jb2;JPaneljp1,jp2;EmployModelem;JLabeljl1;publicReviseEmploy()jl1=newJLabel(修改員工信息”JLabel.CENTER);jl1.setFont(newFont(宋體,F(xiàn)ont.BOLD,28);jp2=newJPanel();jp2.add(jl1);em=newEmployModel();String口paras=1;em.queryEmploy(select*fromEmployinfowhere1=?”,paras);jt=newJTable(em);j

28、sp=newJScrollPane(jt);jb1=newJButton(修改);jb2=newJButton(刷新);/對(duì)兩個(gè)按鈕進(jìn)行監(jiān)聽jb1.addActionListener(this);jb2.addActionListener(this);this.setLayout(newBorderLayout();jp1=newJPanel();jp1.add(jb1);jp1.add(jb2);this.add(jp2,BorderLayout.NORTH);this.add(jsp,BorderLayout.CENTER);this.add(jp1,BorderLayout.SOUTH)

29、;publicvoidactionPerformed(ActionEvente)if(e.getSource()=jb1)introwNum=this.jt.getSelectedRow();if(rowNum=-1)JOptionPane.showMessageDialog(this,請(qǐng)選擇一行);return;/彈出修改對(duì)話框newUpdDialog(em,rowNum);elseif(e.getSource()=jb2)/刷新修改界面中的表格em=newEmployModel();where 1 = ? , paras1);String口paras1=1;em.queryEmploy(s

30、elect*fromEmployinfojt.setModel(em);iUpdDialogpackagecom.Manager;*彈出修改界面*/importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;publicclassUpdDialogextendsJDialogimplementsActionListenerJLabeljl1,jl2,jl3,jl4,jl5,jl6,jl7;JButtonjb1,jb2;JTextFieldjtf1,jtf2,jtf3,jtf4,jtf5,jtf6,jtf7;JPaneljp1,jp2,

31、jp3;int rowNums) publicUpdDialog(EmployModelem,jl1=newJLabel(工號(hào):);jl2=newJLabel(姓名:);jl3=newJLabel(性別:);jl4=newJLabel(出生年月:”jl5=newJLabel(部門:);jl6=newJLabel(職位:);jl7=newJLabel(工資:);jtfl=newJTextField(20);jtf2=newJTextField(30);jtf3=newJTextField(30);jtf4=newJTextField(30);jtf5=newJTextField(30);jtf6

32、=newJTextField(30);jtf7=newJTextField(30);/初始化jtextfield數(shù)據(jù)jtfl.setText(String)em.getValueAt(rowNums,0);jtfl.setEditable(false);jtf2.setText(String)em.getValueAt(rowNums,1);jtf3.setText(String)em.getValueAt(rowNums,2);jtf4.setText(String)em.getValueAt(rowNums,3);jtf5.setText(String)em.getValueAt(rowN

33、ums,4);jtf6.setText(String)em.getValueAt(rowNums,5);jtf7.setText(String)em.getValueAt(rowNums,6);jb1=newJButton(修改);jb2=newJButton(取消);/對(duì)兩個(gè)按鈕監(jiān)聽jb1.addActionListener(this);jb2.addActionListener(this);jp1=newJPanel();jp2=newJPanel();jp3=newJPanel();/設(shè)置布局jp1.setLayout(newGridLayout(7,1);jp2.setLayout(n

34、ewGridLayout(7,1);/添加組件jp1.add(jl1);jp1.add(jl2);jp1.add(jl3);jp1.add(jl4);jp1.add(jl5);jp1.add(jl6);jp1.add(jl7);jp2.add(jtf1)jp2.add(jtf2)jp2.add(jtf3)jp2.add(jtf4)jp2.add(jtf5)jp2.add(jtf6)jp2.add(jtf7)jp3.add(jb1);jp3.add(jb2);this.add(jp1,BorderLayout.WEST);this.add(jp2,BorderLayout.CENTER);thi

35、s.add(jp3,BorderLayout.SOUTH);this.setSize(300,250);this.setVisible(true);this.setLocation(200,200);this.addWindowListener(newWindowAdapter()publicvoidwindowClosing(WindowEvente)dispose。;);publicvoidactionPerformed(ActionEvente)if(e.getSource()=jb1)/修改員工信息的sql_語句,paras為待注入的值Stringsql=updateEmployinf

36、oset+Ename=?,Sex=?,Birthday=?,DeptNo=?,Ejob,Sal=?whereEmpno=?;String口paras=jtf2.getText(),jtf3.getText(),jtf4.getText(),jtf5.getText(),jtf6.getText(),jtf7.getText(),jtf1.getText();EmployModeltemp=newEmployModel();/如果修改語句運(yùn)行成功則彈出修改成功”對(duì)話框if(temp.updEmploy(sql,paras)JOptionPane.showMessageDialog(this,修改

37、成功);this.dispose。;elseif(e.getSource()=jb2)/關(guān)閉對(duì)話框this.dispose。;/*(6) DelEmploy刪除員工*/packagecom.Manager;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;publicclassDelEmployextendsPanelimplementsActionListenerJTablejt;JScrollPanejsp;JButtonjb1,jb2;JPaneljp1,jp2;JLabeljl1;EmployModelem;publ

38、icDelEmploy()/北部jl1=newJLabel(刪除員工,JLabel.CENTER);jl1.setFont(newFont(黑體,F(xiàn)ont.BOLD,30);jp2=newJPanel();jp2.add(jl1);/中部em=newEmployModel();String口paras=1;,paras);em.queryEmploy(select*fromEmployinfowhere1=?jt=newJTable(em);jsp=newJScrollPane(jt);/南部jp1=newJPanel();jb1=newJButton(刪除);jb2=newJButton(取

39、消);jb1.addActionListener(this);jp1.add(jb1);jp1.add(jb2);this.setLayout(newBorderLayout();this.add(jp2,BorderLayout.NORTH);this.add(jsp,BorderLayout.CENTER);this.add(jp1,BorderLayout.SOUTH);publicvoidactionPerformed(ActionEvente)if(e.getSource()=jb1)/返回用戶點(diǎn)中的行introwNum=this.jt.getSelectedRow();if(row

40、Num=-1)JOptionPane.showMessageDialog(this,請(qǐng)選擇一行);return;/得到學(xué)生編號(hào)StringEmpno=(String)em.getValueAt(rowNum,0);/刪除記錄的sql語句Stringsql=deletefromEmployinfowhereEmpno=?;Stringparas=Empno;EmployModeltemp=newEmployModel();temp.updEmploy(sql,paras);/刪除員工成功后,更新員工表em=newEmployModel();Stringparas1=1;em.queryEmplo

41、y(select*fromEmployinfowhere1=?,paras1);jt.setModel(em);AllEmploy/*遍歷所有員工*/packagecom.Manager;importjava.awt.*;importjavax.swing.*;publicclassAllEmployextendsPanelEmployModelem;JTablejt;JScrollPanejsp;JLabeljl1;JPaneljp;publicAllEmploy()/北部jp=newJPanel();jl1=newJLabel(全體員工JLabel.CENTER);jl1.setFont(

42、newFont(黑體,F(xiàn)ont.BOLD,30);jp.add(jl1);/中部em=newEmployModel();String口paras=1;em.queryEmploy(select*fromEmployinfowhere1=?,paras);jt=newJTable(em);jsp=newJScrollPane(jt);this.setLayout(newBorderLayout();this.add(jp,BorderLayout.NORTH);this.add(jsp,BorderLayout.CENTER);(8)Examine/*員工考核界面*/packagecom.Man

43、ager;importjava.awt.*;importjava.awt.event.*;importjava.sql.ResultSet;importjava.util.Vector;importjava.sql.*;importjavax.swing.*;publicclassExamineextendsPanelimplementsActionListenerJLabeljl1,jl2,jl3,jl4;JTablejt;JScrollPanejsp;JTextFieldjtf1,jtf2;Choicech;JButtonjb1,jb2;JPaneljp1,jp2,jp3,jp4;Appr

44、aisalModelam;SqlHelpersqh;publicExamine。/北部為標(biāo)題文字jp4=newJPanel();jl1=newJLabel(員工考核,JLabel.CENTER);jl1.setFont(newFont(黑體,F(xiàn)ont.BOLD,30);jp4.add(jl1);/中部am=newAppraisalModel();am.queryAppraisal(selectas A where E.Empno=A.Empno);E.Empno,E.Ename,A.Consequence,A.RegDatefrom+EmployinfoasE,Appraisaljt=newJ

45、Table(am);jsp=newJScrollPane(jt);/監(jiān)聽jtable點(diǎn)擊表格時(shí)獲取點(diǎn)擊的行數(shù)并通過鼠標(biāo)點(diǎn)擊事件給jtf1,jtf2賦值jt.addMouseListener(newMouseAdapter()publicvoidmouseClicked(MouseEvente)introwNum=jt.getSelectedRow();jtf1.setText(String)am.getValueAt(rowNum,0);jtf2.setText(String)am.getValueAt(rowNum,1););jl2=newJLabel(工號(hào):);jl3=newJLabel(

46、姓名:);jl4=newJLabel(考核);jtf1=newJTextField(10);jtf2=newJTextField(10);jtf1.setEditable(false);jtf2.setEditable(false);/實(shí)例單選框組件,并賦值ch=newChoice();ch.add(未考核);ch.add(不合格);ch.add(合格);ch.add(優(yōu)秀);jp1=newJPanel();jp1.add(jl2);jp1.add(jtf1);jp1.add(jl3);jp1.add(jtf2);jp1.add(jl4);jp1.add(ch);jp2=newJPanel(n

47、ewBorderLayout();jp2.add(jsp,BorderLayout.CENTER);jp2.add(jp1,BorderLayout.SOUTH);/南部jb1=newJButton(確認(rèn));jb2=newJButton(刷新);jp3=newJPanel();jb1.addActionListener(this);jb2.addActionListener(this);jp3.add(jb1);jp3.add(jb2);this.setLayout(newBorderLayout();this.add(jp4,BorderLayout.NORTH);this.add(jp2,

48、BorderLayout.CENTER);this.add(jp3,BorderLayout.SOUTH);publicifvoid actionPerformed(ActionEvent e) (e.getSource()= String Empno = String Ename =jtf1jtf2String Consequence =/先獲取上次考核記錄jb1 ) .getText();.getText();ch .getSelectedItem();String sql =select Consequence from Appraisal where Empno=?;String口 p

49、aras = Empno ;String OldInfo =;try sqh = new SqlHelper();ResultSet rs = sqh .queryExecute(sql, paras); rs.next();OldInfo = rs.getString(1); catch (Exception e1) e1.printStackTrace(); finally sqh .close();/對(duì)考核表進(jìn)行修改修改考核記錄的sql語句String sql1 = update Appraisal set Consequence = ? whereEmpno=?;Stringparas

50、1=Consequence,Empno;AppraisalModeltemp=newAppraisalModel();if(temp.updAppraisal(sql1,paras1)JOptionPane.showMessageDialog(this,考核成功);/再把上次考核記錄以及本次操作記錄插入到history表中Stringsql2=insertintoHistory(Empno,Ename,OldInfo,NewInfo)values(?,?,?,?);Stringparas2=Empno,Ename,OldInfo,Consequence;AppraisalModeltemp1=

51、newAppraisalModel();temp1.updAppraisal(sql2,paras2);elseif(e.getSource()=jb2)/刷新員工考核表am=newAppraisalModel();String口paras3=1;am.queryAppraisal(selectE.Empno,E.Ename,A.Consequence,A.RegDatefrom+EmployinfoasE,AppraisalasAwhereE.Empno=A.Empno);this.jt.setModel(am);/*(9)History歷史記錄界面*/packagecom.Manager;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassHistoryextendsPanelimplementsActionListenerAppraisalModelam;JTablejt;JScrollPanejsp;JLabeljl1;JPaneljp,jp1,jp2;JButtonjb1,jb2;

溫馨提示

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

評(píng)論

0/150

提交評(píng)論