CS系统设计与开发——人事档案管理系统的设计与实现

《CS系统设计与开发》
实训报告

系统名称: 人事档案管理系统的设计与实现
专 业: 计算机科学与技术
姓 名:
班 级:
学 号:
指导教师:
成 绩:

完成日期: 2020 年 12 月 24 日

1 系统分析与设计
1.1 需求分析
人事档案的管理是企业管理中的一个重要内容,随着时代的进步,企业也逐渐变得庞大起来。如何管理好企业内部员工的信息,成为企业管理中的一个大问题。在这种情况下,开发一个人事档案管理系统就显得非常必要。本系统结合公司实际的人事、制度,经过实际的需求分析,采用功能强大的Myeclipse 作为开发工具而开发出来的人事档案管理系统。整个系统从符合操作简便、界面友好、灵活、实用、安全的要求出发,本企业人事档案管理系统具有如下功能:主要实现对员工的人事档案资料进行有效的录入、修改和删除,根据职工编号或姓名对符合条件的员工人事档案资料进行修改以及根据职工编号或姓名对符合条件的员工人事档案资料进行删除,根据职工编号或姓名查询符合条件的员工人事档案资料,并打印查询结果等功能。
全文主要分五个部分:第一部分,是木课题的来源和课题研究的目的和意义;第二部分,是开发工具的选择,本系统主要运用的是 Myeclipse 作为系统前台应用程序开发工具,MySQL 作为后台数据库:第三部分,是系统的需求分析,主要是人事档案管理系统的需求分析、系统功能设计和数据库的设计;第四部分,主要介绍了各个功能模块的功能和主要的代码:第五部分,是软件的测试。
1.2 系统功能设计
档案信息管理系统主要设计了档案信息管理,员工基本信息管理和员工登录管理。

  1. 档案信息管理功能
    管理员可以添加并且查询和修改档案里员工的档案编号,员工编号,员工姓名,员工性别,民族,部门,职位和电话号的信息。
  2. 员工基本信息管理功能
    管理员可以添加并且查询和修改档案里员工的编号,名字,政治面貌,婚姻状况,身份号,籍贯,学历和毕业学校的信息;及对员工的教育背景进行查看和添加。
  3. 员工管理功能
    管理员可以对员工的登录信息如登录名和密码进行添加和删除。

本系统功能模块设计如图1.1所示。

图1.1 系统功能结构图
2 数据库设计
2.1 数据库概念结构设计
此处介绍系统E-R图、实体属性图等
档案实体属性图如图2.1所示。

图2.1档案实体属性图
员工实体属性图如图2.2所示。

图2.2 员工实体属性图
教育背景实体属性图如图2.3所示。

图2.3 教育背景实体属性图
2.2 数据库逻辑结构设计
由实体关系图转换关系模式如下,结果如下:
1.档案(档案序号,档案编号,员工编号,员工姓名,员工性别,职位,部门,名字,电话号)。
2.员工基本情况(员工序号,员工编号,员工姓名,政治面貌,婚姻状况,学历,年龄,毕业学校)。
3.教育背景(序号,员工姓名,受教育时间,年级,学校名称,所任职务)。
2.3 数据库物理结构设计去

  1. 人事档案(personalfile)表
    人事档案表是用来存放人事档案的信息,包括档案序号(filenum),档案编号(fileid),员工编号(employeeid),员工姓名(employeename),员工性别(sex),职位(position), 电话号(number), 部门(department), 民族(word)人事档案表结构如表3.1所示:
    表3.1 人事档案(personalfile)表
    属性 列名 数据类型 长度 约束
    档案序号
    档案编号 Filenum
    fileid char
    char 50
    50 主键
    非空
    员工编号 employeeid char 50 非空
    员工姓名
    员工性别
    职位
    电话号
    部门
    民族 employeename
    sex
    position
    number
    departmentid
    word char
    char
    char
    char
    char
    char 50
    50
    50
    50
    50
    50 非空
    非空
    非空
    非空
    非空
    非空

  2. 员工(employee)表
    员工表是用来存放员工的信息,包括员工序号(employeenum),员工编号(employeeid),员工姓名(employeename),身份证号(personid),年龄(age),政治面貌(politistic),婚姻状况(marrage),学历(eduground),毕业学校(graduation)员工表结构如表1.1所示:
    表3.2 员工(employee)表
    属性 列名 数据类型 长度 约束
    员工序号
    员工编号 employeenum
    employeeid Char
    char 50
    50 主健
    非空
    员工姓名 employeename char 50 非空
    身份证号
    年龄
    政治面貌
    婚姻状况
    学历
    毕业学校 Personid
    Age
    Politistic
    Marriage
    Eduground
    Graduation char
    char
    char
    char
    char
    char 50
    50
    50
    50
    50
    50 非空
    非空
    非空
    非空
    非空
    非空

  3. 教育背景(Personeduation)表
    工资表是用来存放工资的信息,包括序号(id),员工姓名(employeename),受教育时间(pereduatime),学校名称(schoolname), 年级(grade),所任职务(position)工资表。结构如表1.3所示:

表3.3工资(wage)表
属性 列名 数据类型 长度 约束
序号 id char 50 主健
员工姓名 Employename char 50 非空
受教育时间
学校名称
年级
所任职务 pereduatime schoolname
grade
position char
char
char
char 50
50
50
50 非空
非空
非空
非空

3 主要功能模块设计
3.1 系统设计
登录窗体是用户进入系统的钥匙,只有合法的登录才是有效的登录,这里主要是利用输入的用户表信息跟 users(用户表)里面的信息进行比对。如果是非
法用户登录的话,就会跳转到错误页面。在本系统中预设了两种用户:管理员用
户和普通用户,管理员对普通用户有管理的功能,管理员可以添加登录也可以删
除用户。
1.登录界面如图所示4.1

表4.1 登录表
2.登录成功后转到主界面如图所示4.2

表4.2 主界面表
3.点击档案信息管理中的档案信息添加之后可跳转到档案信息添加界面如图4.3
表4.3 档案信息添加表

4.点击档案信息管理中的档案信息查询与修改之后,可跳转到档案信息查询与修改界面如图4.4

表4.4 档案信息查询与修改表
5.点击员工基本信息信息管理中的员工基本信息添加之后可跳转到员工基本信息添加界面如图4.5

表4.5 档案信息查询与修改表
6.点击员工基本信息管理中的员工基本信息查询与修改之后,可跳转到员工基本信息查询与修改界面如图4.6

表4.6 员工基本信息查询与修改表
5.点击员工教育背景信息信息管理中的员工教育背景信息添加之后可跳转到员工教育背景信息添加界面如图4.5

表4.7 教育背景信息查询与修改表

7.点击员工教育背景信息管理中的员工教育背景信息查询与修改之后,可跳转到员工教育背景信息查询与修改界面如图4.7

表4.6 员工教育背景信息查询与修改表
8.点击员工管理中的员工添加之后可跳转到员工添加界面如图4.8

表4.8 添加用户表
9.点击员工管理中的员工删除之后可跳转到员工删除界面如图4.9

表4.8 删除用户表

4 主要代码
4.1 登录界面
package com.bbm.view;

import java.awt.Container;
import java.awt.Font;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Toolkit;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

import com.bbm.model.Users;

public class Login extends JFrame {
private static final long serialVersionUID=1L;
private JPanel textJP,loginJP1,buttonJP;
private Font f1=new Font(“黑体”,Font.BOLD,32);
private JLabel textJL,usernameJL,passwordJL;
private JTextField usernameJTF;
private JPasswordField pwdJPF;
private JButton loginJB,resetJB;
private Container loginJP;
private static Users user;
public Login(){
setSize(260,180);
int width=Toolkit.getDefaultToolkit().getScreenSize().width;
int height=Toolkit.getDefaultToolkit().getScreenSize().height;
this.setLocation(width/2-130,height/2-90);

	setTitle("档案用户登陆界面");
	
	textJP=new JPanel();
	loginJP=new JPanel();
	buttonJP=new JPanel();
	textJL=new JLabel();
	textJL.setFont(f1);
	textJL.setText("档案管理系统");
	textJP.add(textJL);
	this.add(textJP,BorderLayout.NORTH);
	
	loginJP.setLayout(new GridLayout(2, 2));
	usernameJL=new JLabel("用户名:");
	usernameJL.setHorizontalAlignment(SwingConstants.CENTER);
	usernameJTF=new JTextField();
	passwordJL= new JLabel("密码:");
	passwordJL.setHorizontalAlignment( SwingConstants.CENTER);
	pwdJPF=new JPasswordField();
	loginJP.add(usernameJL);
	loginJP. add(usernameJTF);
	loginJP. add( passwordJL);
    loginJP. add( pwdJPF);
	this.add(loginJP, BorderLayout.CENTER);
	
	loginJB= new JButton("登录");
	resetJB = new JButton("重置");
	buttonJP.add(loginJB);
	buttonJP.add(resetJB);
	this.add(buttonJP, BorderLayout.SOUTH);
	
	setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
	this.setVisible(true);
    setResizable(false);
    }
	public static void setUser(Users user){
	Login.setUser(user);
   }
	public static Users getUser(){
      return user;
   }
	public static void main(String[] args){
		new Login();
	}
	public JPanel getLoginJP1() {
		return loginJP1;
	}
	public void setLoginJP1(JPanel loginJP1) {
		this.loginJP1 = loginJP1;
	}
   }

4.2 功能主界面

package com.bbm.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import com.lhm.view.UserAdd;
import com.lhm.view.UserDel;

public class file extends JFrame{
	private static final long serialVersionUID = 1L;
	//构造方法
	public file(){
		setSize(800,600);    
		setTitle("档案管理系统");		
		JMenuBar menuBar=createJMenuBar();//创建菜单栏
		setJMenuBar(menuBar);//添加菜单栏到主窗体,设置窗体菜单栏
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//关闭窗口时,退出程序
		this.setVisible(true);//设置窗体显示,否则不显示。	
	}
	private JMenuBar createJMenuBar(){
		JMenuBar jMenuBar=new JMenuBar();//菜单栏
		

		JMenu FileManageJMenu=new JMenu("档案信息管理");
		JMenuItem FileinformAddJMI=new JMenuItem("档案信息添加"); 
		FileManageJMenu.add(FileinformAddJMI);
		JMenuItem FileinformSelUpdJMI=new JMenuItem("档案信息查询与修改");	
		FileManageJMenu.add(FileinformSelUpdJMI);

		JMenu PersoneduationJMenu=new JMenu("员工基本信息管理");
		JMenuItem PersoninformAddJMI=new JMenuItem("员工基本信息添加");
		PersoneduationJMenu.add(PersoninformAddJMI);
		JMenuItem PersoninformSelUpdJMI=new JMenuItem("员工基本信息查询与修改");
		PersoneduationJMenu.add(PersoninformSelUpdJMI);
		JMenuItem PersoneduationAddJMI=new JMenuItem("员工教育背景信息添加");
		PersoneduationJMenu.add(PersoneduationAddJMI);
		JMenuItem PersoneduationSelectJMI=new JMenuItem("员工教育背景信息查询");		
		PersoneduationJMenu.add(PersoneduationSelectJMI);

		
		

		
		JMenu UserJMenu=new JMenu("员工管理");
		JMenuItem UserAddJMI=new JMenuItem("员工添加");
		UserJMenu.add(UserAddJMI);
		JMenuItem UserDelJMI=new JMenuItem("员工删除");
		UserJMenu.add(UserDelJMI);



		jMenuBar.add(FileManageJMenu);
		jMenuBar.add(PersoneduationJMenu);

		jMenuBar.add(UserJMenu);
		

		
	
	FileinformAddJMI.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			new FileinformAdd();
		}
	});


	FileinformSelUpdJMI.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
	// TODO Auto-generated method stub
	new FileinformSelUpd();
}

});
PersoninformAddJMI.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new PersoninformAdd();
}
});
PersoninformSelUpdJMI.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new PersoneduationSelUpd();
}
});
PersoneduationAddJMI.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new PersoneduationAdd();
}
});
PersoneduationSelectJMI.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new PersoneduationAdd();
}
});

	UserAddJMI.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			new UserAdd();
		}
	});
	UserDelJMI.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			new UserDel();
		}

});

return jMenuBar;
}

public static void main(String[] args){
new file();
}
}

4.3 档案信息添加界面
package com.bbm.view;

import javax.swing.*;

import com.bbm.db.FileinformDao;

import java.awt.event.*;

import java.awt.*;
import java.util.List;
@SuppressWarnings(“serial”)
public class FileinformAdd extends JFrame {
private JLabel fileJL,personidJL,personnameJL,wordJL,departmentJL,positionJL,genderJL,numberJL;
private JPanel northJP,genderJP,southJP;
private ButtonGroup buttonGroup = new ButtonGroup();
private JTextField fileJTF,personidJTF,personnameJTF,wordJTF,departmentJTF,positionJTF,numberJTF,priceJTF;
private JButton addJB,manjb,womanjb,resiteJB,closeJB;

	FileinformAdd(){
		northJP=new JPanel();
		southJP=new JPanel();
		northJP.setLayout(new GridLayout(4,4));
		
		fileJL=new JLabel("档案编号");
		fileJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(fileJL);
		fileJTF=new JTextField();
		fileJTF.setColumns(15);
		northJP.add(fileJTF);
		
		personidJL=new JLabel("员工编号");
		personidJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(personidJL);
		personidJTF=new JTextField();
		personidJTF.setColumns(15);
		northJP.add(personidJTF);	
		
		personnameJL=new JLabel("员工姓名");
		personnameJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(personnameJL);
		personnameJTF=new JTextField();
		personnameJTF.setColumns(15);
		northJP.add(personnameJTF);
		
		genderJL = new JLabel("性别:");
		genderJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(genderJL);
		
		genderJP = new JPanel();
		final FlowLayout flowLayout = new FlowLayout();
		flowLayout.setHgap(0);
		flowLayout.setVgap(0);
		genderJP.setLayout(flowLayout);
		northJP.add(genderJP);
		manjb = new JButton();
		genderJP.add(manjb);
		manjb.setSelected(true);
		buttonGroup.add(manjb);
		manjb.setText("男");
		womanjb = new JButton();
		genderJP.add(womanjb);
		buttonGroup.add(womanjb);
		womanjb.setText("女");
		
		wordJL=new JLabel("民族");
		wordJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(wordJL);
		wordJTF=new JTextField();
		wordJTF.setColumns(15);
		northJP.add(wordJTF);
		

		departmentJL=new JLabel("部门");
		departmentJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(departmentJL);
		departmentJTF=new JTextField();
		departmentJTF.setColumns(15);
		northJP.add(departmentJTF);
		
		positionJL=new JLabel("职位");
		positionJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(positionJL);
		positionJTF=new JTextField();
		northJP.add(positionJTF);
		
		numberJL=new JLabel("电话号");
		numberJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(numberJL);
		numberJTF=new JTextField(); 
		numberJTF.setColumns(15);
		northJP.add(numberJTF);
		
		
		addJB=new JButton();
		addJB.setText("添加");
		addJB.addActionListener(new addAction());
		southJP.add(addJB);
		resiteJB=new JButton();
		resiteJB.setText("重置");
		resiteJB.addMouseListener(new resiteAction());
		southJP.add(resiteJB);
		closeJB=new JButton();
		closeJB.setText("关闭");
		closeJB.addMouseListener(new closeAction());
		southJP.add(closeJB);
		
		this.add(northJP,BorderLayout.CENTER);
		this.add(southJP,BorderLayout.SOUTH);
		this.setVisible(true);
		setTitle("档案信息添加");
		setResizable(false);
		this.setBounds(15, 15,600, 200);

	}
	 class addAction implements ActionListener
	 {
		public void actionPerformed(ActionEvent e) {
			String f=fileJL.getText().trim();
			String p=personidJTF.getText().trim();
			String n=personnameJTF.getText().trim();
			String w=wordJTF.getText().trim();
			String d=departmentJTF.getText().trim();
			String po=positionJTF.getText().trim();
			String nu=numberJTF.getText().trim();
			
			if (f.length()==0){
				JOptionPane.showMessageDialog(null,"档案编号不能为空");
				FileinformAdd.this.setVisible(false);
			}if (p.length()==0){
				JOptionPane.showMessageDialog(null,"员工编号不能为空");
				FileinformAdd.this.setVisible(false);
			}if (n.length()==0){
				JOptionPane.showMessageDialog(null,"员工姓名不能为空");
				FileinformAdd.this.setVisible(false);
			}if (w.length()==0){
				JOptionPane.showMessageDialog(null,"民族不能为空");
				FileinformAdd.this.setVisible(false);
			}if (d.length()==0){
				JOptionPane.showMessageDialog(null,"部门不能为空");
				FileinformAdd.this.setVisible(false);
			}if (po.length()==0){
				JOptionPane.showMessageDialog(null,"职位不能为空");
				FileinformAdd.this.setVisible(false);
			}if (nu.length()<=11){
				JOptionPane.showMessageDialog(null,"请输入11位电话号");
				FileinformAdd.this.setVisible(false);
			}else if(nu.length()==11){
				String file=fileJTF.getText().trim();
				String person=personidJTF.getText().trim();
				String personname=personnameJTF.getText().trim();
				String word=wordJTF.getText().trim();
				String department=departmentJTF.getText().trim();
				String position=positionJTF.getText().trim();
				String number=numberJTF.getText().trim();
				Double price=Double.parseDouble(priceJTF.getText().trim());
				int j=FileinformDao.insert(file,person,personname, word, department, position, number, price);
				if(j>0){
					JOptionPane.showMessageDialog(null,"添加成功");
					FileinformAdd.this.setVisible(false);
				}
			}
		}
	 }
	class resiteAction extends MouseAdapter
	{
		@Override
		public void mouseClicked(MouseEvent e) {
			// TODO Auto-generated method stub
			super.mouseClicked(e);
			if(e.getSource()==resiteJB){
				fileJTF.setText("");
				personidJTF.setText("");
				personnameJTF.setText("");
				genderJP.setToolTipText("男");
				wordJTF.setText("");
				departmentJTF.setText("");
				positionJTF.setText("");
				numberJTF.setText("");
				
			}
		}
	}
	class closeAction extends MouseAdapter
	{
		public void mouseClicked(MouseEvent e) {
			super.mouseClicked(e);
			FileinformAdd.this.setVisible(false);
		}
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new FileinformAdd();
	}

	public static List<students> selectReader() {
		// TODO Auto-generated method stub
		return null;
	}

}

4.4 档案信息查询与修改界面
package com.bbm.view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.bbm.db.FileinformDao;

public class FileinformSelUpd extends JFrame {
private static final long serialVersionUID=1L;
private JPanel selectJP,select_conditionJP,select_resultJP,wordJP,updateJP,buttonJP;
private ButtonGroup buttonGroup=new ButtonGroup();
private JRadioButton JRB1,JRB2;
private JLabel IDJL,typeJL,personnameJL,wordJL,departmentJL,positionJL,genderJL,regJL;
private JTextField select_conditionJTF,IDJTF,personnameJTF,departmentJTF,positionJTF,genderJTF,regJTF;
private JComboBox conditionJCB,readertypeJCB;
private JScrollPane jscrollPane;
private JTable jtable;
private JButton selectJB,updateJB,closeJB;
private String[] readersearch={“档案编号”,“员工编号”,“员工姓名”,“性别”,“部门”,“职位”,“电话号”,“注册日期”};
private Object[][] getSelect(List list){
Object[][] results =new Object[list.size()][readersearch.length];
for(int i=0;i<list.size();i++){
students reader=list.get(i);
results[i][0]=reader.getfile();
results[i][1]=reader.getpersonid();
results[i][2]=reader.getpersonname();
results[i][3]=reader.getgender();
results[i][4]=reader.getword();
results[i][5]=reader.getdepartment();
results[i][6]=reader.getposition();
results[i][7]=reader.getnumber();
}
return results;
}
//构造方法
public FileinformSelUpd(){
this.setBounds(200,200,500,500);
this.setTitle(“档案信息查询与修改”);
//读者信息查询面板设计
selectJP=new JPanel();
selectJP.setLayout(new BorderLayout());
//查询条件面板
//查询条件下拉面板
select_conditionJP=new JPanel();
conditionJCB=new JComboBox();
String[] array={“档案编号”,“员工姓名”,“员工编号”,“系部”};
for(int i=0;i<array.length;i++){
conditionJCB.addItem(array[i]);
}
select_conditionJP.add(conditionJCB);
//查询条件文本框
select_conditionJTF=new JTextField();
select_conditionJTF.setColumns(20);
select_conditionJP.add(select_conditionJTF);
//查询按钮
selectJB=new JButton();
selectJB.addActionListener(new SelectAction());
selectJB.setText(“查询”);
select_conditionJP.add(selectJB);
selectJP.add(select_conditionJP,BorderLayout.NORTH);
//查询结果面板
select_resultJP=new JPanel();
jscrollPane=new JScrollPane();
jscrollPane.setPreferredSize(new Dimension(400,200));
Object[][] results=getSelect(FileinformDao.selectReader());
jtable=new JTable(results,readersearch);
jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jtable.addMouseListener(new TableListener());
jscrollPane.setViewportView(jtable);
select_resultJP.add(jscrollPane);
selectJP.add(select_resultJP,BorderLayout.CENTER);

	updateJP=new JPanel();
	updateJP.setBorder(new EmptyBorder(10,40,10,40));
	GridLayout gridLayout=new GridLayout(4,4);
	gridLayout.setHgap(10);
	gridLayout.setVgap(10); 
	updateJP.setLayout(gridLayout);

	IDJL=new JLabel("档案编号:");
	IDJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(IDJL);
	IDJTF=new JTextField();
	updateJP.add(IDJTF);

	personnameJL =new JLabel("员工姓名:");
	personnameJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(personnameJL);
	personnameJTF=new JTextField();
	updateJP.add(personnameJTF);

	typeJL=new JLabel("员工编号:");
	typeJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(typeJL);

	readertypeJCB=new JComboBox();
	updateJP.add(readertypeJCB);
	List<studentstype> list = studentstypeDao.selectstudentstype();
	for(int i = 0; i < list.size(); i++){
		studentstype readertype = list.get(i);
		readertypeJCB.addItem(readertype.getpersonname());
	}

	genderJL=new JLabel("部门:");
	genderJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(genderJL);
	genderJTF=new JTextField();
	updateJP.add(genderJTF);
	
	wordJL=new JLabel("性别:");
	wordJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(wordJL);
	wordJP=new JPanel();
	final FlowLayout flowLayout=new FlowLayout();
	flowLayout.setHgap(0);
	flowLayout.setVgap(0);
	wordJP.setLayout(flowLayout);
	JRB1=new JRadioButton();
	wordJP.add(JRB1);
	JRB1.setSelected(true);
	buttonGroup.add(JRB1);
	JRB1.setText("男");
	JRB2=new JRadioButton();
	wordJP.add(JRB2);
	buttonGroup.add(JRB2);
	JRB2.setText("女");
	updateJP.add(wordJP);

	departmentJL=new JLabel("职位:");
	departmentJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(departmentJL);
	departmentJTF=new JTextField();
	updateJP.add(departmentJTF);

	positionJL=new JLabel("电话号:");
	positionJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(positionJL);
	positionJTF=new JTextField();
	updateJP.add(positionJTF);

	regJL=new JLabel("注册日期:");
	regJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(regJL);
	regJTF=new JTextField();
	updateJP.add(regJTF);
	//按钮面板设计
	buttonJP=new JPanel();
	updateJB=new JButton("修改");
	updateJB.addActionListener(new UpdActionListener());
	closeJB=new JButton("关闭");
	closeJB.addActionListener(new CloseActionListener());
	buttonJP.add(updateJB);
	buttonJP.add(closeJB);
	//添加面板到该界面中
	this.add(selectJP,BorderLayout.NORTH);
	this.add(updateJP,BorderLayout.CENTER);
	this.add(buttonJP,BorderLayout.SOUTH);

	this.setResizable(false);
	this.setVisible(true);
}
//按条件查询读者监听器类
class SelectAction implements ActionListener{
	public void actionPerformed(ActionEvent arg0) {
		//condition用来存放用户选择的查询条件
		String condition=(String) conditionJCB.getSelectedItem();
		//按读者编号查询
		if(condition.equals("档案编号")){
			Object[][] results = getSelect(studentsDao.selectstudentsById(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			//对表格添加监听,用于响应用户选择的某一读者信息操作
			jtable.addMouseListener(new TableListener());
		//按读者员工姓名查询
		}
		else if(condition.equals("员工姓名")){
			Object[][] results=getSelect(studentsDao.selectstudentsBypersonname(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
		//按读者员工编号查询
		else if(condition.equals("员工编号")){
			Object[][] results=getSelect(studentsDao.selectstudentsByType(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
		//按读者所在的系部查询
		else if(condition.equals("电话号")){
			Object[][] results=getSelect(studentsDao.selectstudentsByDept(positionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
		//文本框内无值查询全部
		/*else if(condition.equals("")){
			Object[][] results=getSelect(ReaderDao.selectReader());
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}*/
	}
}
//鼠标选中表格填入信息监听器类
class TableListener extends MouseAdapter{
	public void mouseClicked(MouseEvent e) {
		//变量selRow保存选中的行
		int selRow =jtable.getSelectedRow();
		//通过jtable.getValueAt(setRow,0)的方法获取选中行中的每一列,注意从0开始
		IDJTF.setText(jtable.getValueAt(selRow, 0).toString().trim());
		readertypeJCB.setSelectedItem(jtable.getValueAt(selRow, 1).toString().trim());
		personnameJTF.setText(jtable.getValueAt(selRow, 2).toString().trim());
		genderJTF.setText(jtable.getValueAt(selRow, 3).toString().trim());
		departmentJTF.setText(jtable.getValueAt(selRow, 5).toString().trim());
		positionJTF.setText(jtable.getValueAt(selRow, 6).toString().trim());
		regJTF.setText(jtable.getValueAt(selRow, 7).toString().trim());
		if(jtable.getValueAt(selRow, 4).toString().trim().equals("男"))
			JRB1.setSelected(true);
		else
			JRB2.setSelected(true);
	}
}
//修改按钮监听器类
class UpdActionListener implements ActionListener{
	public void actionPerformed(ActionEvent e) {
		String id=IDJTF.getText().trim();
		String type= (String) readertypeJCB.getSelectedItem();
		String personname=personnameJTF.getText().trim();
		String gender=genderJTF.getText().trim();
		String word="男";
		if(JRB2.isSelected())
			word="女";
		String department=departmentJTF.getText().trim();
		String position=positionJTF.getText().trim();
		String number=regJTF.getText().trim();
		if(department.length()>11){
			JOptionPane.showMessageDialog(null, "职位不可大于11位");
			departmentJTF.setText("");
			return;
		}
	//执行对读者信息表的修改
		int i=studentsDao.updatestudents(id, type, personname, gender, word, department, position, number);
		System.out.println(i);
		if(i==1){
			JOptionPane.showMessageDialog(null, "修改成功");
			Object[][] results=getSelect(studentsDao.selectReader());
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
	}
}
//关闭按钮监听器类
class CloseActionListener implements ActionListener{
	public void actionPerformed(final ActionEvent e){
		setVisible(false);
	}
}
public static void main(String[] args) {
	new FileinformSelUpd();
}

}
4.5 员工基本信息添加界面
package com.bbm.view;

import javax.swing.*;

import com.bbm.db.personinformDao;

import java.awt.event.*;

import java.awt.*;
@SuppressWarnings(“serial”)
public class PersoninformAdd extends JFrame {
private JLabel personidJL,personnameJL,politicsJL,IDnumberJL,native1JL,edugroundJL,marriageJL,graduationJL;
private JPanel northJP,marriageJP,southJP;
private ButtonGroup buttonGroup = new ButtonGroup();
private JTextField personidJTF,personnameJTF,politicsJTF,IDnumberJTF,native1JTF,edugroundJTF,graduationJTF,priceJTF;
private JButton addJB,unmarriedjb,marriedjb,resiteJB,closeJB;

	PersoninformAdd(){
		northJP=new JPanel();
		southJP=new JPanel();
		northJP.setLayout(new GridLayout(4,4));
		
		personidJL=new JLabel("员工编号");
		personidJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(personidJL);
		personidJTF=new JTextField();
		personidJTF.setColumns(15);
		northJP.add(personidJTF);
		
		personnameJL=new JLabel("员工姓名");
		personnameJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(personnameJL);
		personnameJTF=new JTextField();
		personnameJTF.setColumns(15);
		northJP.add(personnameJTF);	
		
		politicsJL=new JLabel("政治面貌");
		politicsJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(politicsJL);
		politicsJTF=new JTextField();
		politicsJTF.setColumns(15);
		northJP.add(politicsJTF);
		
		marriageJL = new JLabel("婚姻状况:");
		marriageJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(marriageJL);
		
		marriageJP = new JPanel();
		final FlowLayout flowLayout = new FlowLayout();
		flowLayout.setHgap(0);
		flowLayout.setVgap(0);
		marriageJP.setLayout(flowLayout);
		northJP.add(marriageJP);
		unmarriedjb = new JButton();
		marriageJP.add(unmarriedjb);
		unmarriedjb.setSelected(true);
		buttonGroup.add(unmarriedjb);
		unmarriedjb.setText("未婚");
		marriedjb = new JButton();
		marriageJP.add(marriedjb);
		buttonGroup.add(marriedjb);
		marriedjb.setText("已婚");
		
		IDnumberJL=new JLabel("身份证号");
		IDnumberJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(IDnumberJL);
		IDnumberJTF=new JTextField();
		IDnumberJTF.setColumns(15);
		northJP.add(IDnumberJTF);
		

		native1JL=new JLabel("籍贯");
		native1JL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(native1JL);
		native1JTF=new JTextField();
		native1JTF.setColumns(15);
		northJP.add(native1JTF);
		
		edugroundJL=new JLabel("学历");
		edugroundJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(edugroundJL);
		edugroundJTF=new JTextField();
		northJP.add(edugroundJTF);
		
		graduationJL=new JLabel("毕业学校");
		graduationJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(graduationJL);
		graduationJTF=new JTextField(); 
		graduationJTF.setColumns(15);
		northJP.add(graduationJTF);
		
		
		addJB=new JButton();
		addJB.setText("添加");
		addJB.addActionListener(new addAction());
		southJP.add(addJB);
		resiteJB=new JButton();
		resiteJB.setText("重置");
		resiteJB.addMouseListener(new resiteAction());
		southJP.add(resiteJB);
		closeJB=new JButton();
		closeJB.setText("关闭");
		closeJB.addMouseListener(new closeAction());
		southJP.add(closeJB);
		
		this.add(northJP,BorderLayout.CENTER);
		this.add(southJP,BorderLayout.SOUTH);
		this.setVisible(true);
		setTitle("员工基本信息信息添加");
		setResizable(false);
		this.setBounds(15, 15,600, 200);

	}
	 class addAction implements ActionListener
	 {
		public void actionPerformed(ActionEvent e) {
			String pi=personidJL.getText().trim();
			String pn=personnameJTF.getText().trim();
			String po=politicsJTF.getText().trim();
			String in=IDnumberJTF.getText().trim();
			String na=native1JTF.getText().trim();
			String ed=edugroundJTF.getText().trim();
			String gr=graduationJTF.getText().trim();
			
			if (pi.length()==0){
				JOptionPane.showMessageDialog(null,"员工编号不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (pn.length()==0){
				JOptionPane.showMessageDialog(null,"员工姓名不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (po.length()==0){
				JOptionPane.showMessageDialog(null,"政治面貌不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (in.length()==0){
				JOptionPane.showMessageDialog(null,"身份证号不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (na.length()==0){
				JOptionPane.showMessageDialog(null,"籍贯不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (ed.length()==0){
				JOptionPane.showMessageDialog(null,"学历不能为空");
				PersoninformAdd.this.setVisible(false);
			}if (gr.length()<=13){
				JOptionPane.showMessageDialog(null,"请输入11位毕业学校");
				PersoninformAdd.this.setVisible(false);
			}else if(pi.length()==6){
				String personid=personidJTF.getText().trim();
				String personname=personnameJTF.getText().trim();
				String politics=politicsJTF.getText().trim();
				String IDnumber=IDnumberJTF.getText().trim();
				String native1=native1JTF.getText().trim();
				String eduground=edugroundJTF.getText().trim();
				String graduation=graduationJTF.getText().trim();
				Double price=Double.parseDouble(priceJTF.getText().trim());
				int j=personinformDao.insert(personid,personname,politics, IDnumber, native1, eduground, graduation, price);
				if(j>0){
					JOptionPane.showMessageDialog(null,"添加成功");
					PersoninformAdd.this.setVisible(false);
				}
			}
		}
	 }
	class resiteAction extends MouseAdapter
	{
		@Override
		public void mouseClicked(MouseEvent e) {
			// TODO Auto-generated method stub
			super.mouseClicked(e);
			if(e.getSource()==resiteJB){
				personidJTF.setText("");
				personnameJTF.setText("");
				politicsJTF.setText("");
				marriageJP.setToolTipText("未婚");
				IDnumberJTF.setText("");
				native1JTF.setText("");
				edugroundJTF.setText("");
				graduationJTF.setText("");
				
			}
		}
	}
	class closeAction extends MouseAdapter
	{
		public void mouseClicked(MouseEvent e) {
			super.mouseClicked(e);
			PersoninformAdd.this.setVisible(false);
		}
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new PersoninformAdd();
	}

}

4.6 员工基本信息查询与修改界面
package com.bbm.view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.bbm.db.FileinformDao;

public class FileinformSelUpd extends JFrame {
private static final long serialVersionUID=1L;
private JPanel selectJP,select_conditionJP,select_resultJP,wordJP,updateJP,buttonJP;
private ButtonGroup buttonGroup=new ButtonGroup();
private JRadioButton JRB1,JRB2;
private JLabel IDJL,typeJL,personnameJL,wordJL,departmentJL,positionJL,genderJL,regJL;
private JTextField select_conditionJTF,IDJTF,personnameJTF,departmentJTF,positionJTF,genderJTF,regJTF;
private JComboBox conditionJCB,readertypeJCB;
private JScrollPane jscrollPane;
private JTable jtable;
private JButton selectJB,updateJB,closeJB;
private String[] readersearch={“档案编号”,“员工编号”,“员工姓名”,“性别”,“部门”,“职位”,“电话号”,“注册日期”};
private Object[][] getSelect(List list){
Object[][] results =new Object[list.size()][readersearch.length];
for(int i=0;i<list.size();i++){
students reader=list.get(i);
results[i][0]=reader.getfile();
results[i][1]=reader.getpersonid();
results[i][2]=reader.getpersonname();
results[i][3]=reader.getgender();
results[i][4]=reader.getword();
results[i][5]=reader.getdepartment();
results[i][6]=reader.getposition();
results[i][7]=reader.getnumber();
}
return results;
}
//构造方法
public FileinformSelUpd(){
this.setBounds(200,200,500,500);
this.setTitle(“档案信息查询与修改”);
//读者信息查询面板设计
selectJP=new JPanel();
selectJP.setLayout(new BorderLayout());
//查询条件面板
//查询条件下拉面板
select_conditionJP=new JPanel();
conditionJCB=new JComboBox();
String[] array={“档案编号”,“员工姓名”,“员工编号”,“系部”};
for(int i=0;i<array.length;i++){
conditionJCB.addItem(array[i]);
}
select_conditionJP.add(conditionJCB);
//查询条件文本框
select_conditionJTF=new JTextField();
select_conditionJTF.setColumns(20);
select_conditionJP.add(select_conditionJTF);
//查询按钮
selectJB=new JButton();
selectJB.addActionListener(new SelectAction());
selectJB.setText(“查询”);
select_conditionJP.add(selectJB);
selectJP.add(select_conditionJP,BorderLayout.NORTH);
//查询结果面板
select_resultJP=new JPanel();
jscrollPane=new JScrollPane();
jscrollPane.setPreferredSize(new Dimension(400,200));
Object[][] results=getSelect(FileinformDao.selectReader());
jtable=new JTable(results,readersearch);
jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jtable.addMouseListener(new TableListener());
jscrollPane.setViewportView(jtable);
select_resultJP.add(jscrollPane);
selectJP.add(select_resultJP,BorderLayout.CENTER);

	updateJP=new JPanel();
	updateJP.setBorder(new EmptyBorder(10,40,10,40));
	GridLayout gridLayout=new GridLayout(4,4);
	gridLayout.setHgap(10);
	gridLayout.setVgap(10); 
	updateJP.setLayout(gridLayout);

	IDJL=new JLabel("档案编号:");
	IDJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(IDJL);
	IDJTF=new JTextField();
	updateJP.add(IDJTF);

	personnameJL =new JLabel("员工姓名:");
	personnameJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(personnameJL);
	personnameJTF=new JTextField();
	updateJP.add(personnameJTF);

	typeJL=new JLabel("员工编号:");
	typeJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(typeJL);

	readertypeJCB=new JComboBox();
	updateJP.add(readertypeJCB);
	List<studentstype> list = studentstypeDao.selectstudentstype();
	for(int i = 0; i < list.size(); i++){
		studentstype readertype = list.get(i);
		readertypeJCB.addItem(readertype.getpersonname());
	}

	genderJL=new JLabel("部门:");
	genderJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(genderJL);
	genderJTF=new JTextField();
	updateJP.add(genderJTF);
	
	wordJL=new JLabel("性别:");
	wordJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(wordJL);
	wordJP=new JPanel();
	final FlowLayout flowLayout=new FlowLayout();
	flowLayout.setHgap(0);
	flowLayout.setVgap(0);
	wordJP.setLayout(flowLayout);
	JRB1=new JRadioButton();
	wordJP.add(JRB1);
	JRB1.setSelected(true);
	buttonGroup.add(JRB1);
	JRB1.setText("男");
	JRB2=new JRadioButton();
	wordJP.add(JRB2);
	buttonGroup.add(JRB2);
	JRB2.setText("女");
	updateJP.add(wordJP);

	departmentJL=new JLabel("职位:");
	departmentJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(departmentJL);
	departmentJTF=new JTextField();
	updateJP.add(departmentJTF);

	positionJL=new JLabel("电话号:");
	positionJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(positionJL);
	positionJTF=new JTextField();
	updateJP.add(positionJTF);

	regJL=new JLabel("注册日期:");
	regJL.setHorizontalAlignment(SwingConstants.CENTER);
	updateJP.add(regJL);
	regJTF=new JTextField();
	updateJP.add(regJTF);
	//按钮面板设计
	buttonJP=new JPanel();
	updateJB=new JButton("修改");
	updateJB.addActionListener(new UpdActionListener());
	closeJB=new JButton("关闭");
	closeJB.addActionListener(new CloseActionListener());
	buttonJP.add(updateJB);
	buttonJP.add(closeJB);
	//添加面板到该界面中
	this.add(selectJP,BorderLayout.NORTH);
	this.add(updateJP,BorderLayout.CENTER);
	this.add(buttonJP,BorderLayout.SOUTH);

	this.setResizable(false);
	this.setVisible(true);
}
//按条件查询读者监听器类
class SelectAction implements ActionListener{
	public void actionPerformed(ActionEvent arg0) {
		//condition用来存放用户选择的查询条件
		String condition=(String) conditionJCB.getSelectedItem();
		
		if(condition.equals("档案编号")){
			Object[][] results = getSelect(studentsDao.selectstudentsById(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			//对表格添加监听,用于响应用户选择的某一读者信息操作
			jtable.addMouseListener(new TableListener());
		
		}
		else if(condition.equals("员工姓名")){
			Object[][] results=getSelect(studentsDao.selectstudentsBypersonname(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
	
		else if(condition.equals("员工编号")){
			Object[][] results=getSelect(studentsDao.selectstudentsByType(select_conditionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
		
		else if(condition.equals("电话号")){
			Object[][] results=getSelect(studentsDao.selectstudentsByDept(positionJTF.getText().trim()));
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
		//文本框内无值查询全部
		/*else if(condition.equals("")){
			Object[][] results=getSelect(ReaderDao.selectReader());
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}*/
	}
}
//鼠标选中表格填入信息监听器类
class TableListener extends MouseAdapter{
	public void mouseClicked(MouseEvent e) {
		//变量selRow保存选中的行
		int selRow =jtable.getSelectedRow();
		//通过jtable.getValueAt(setRow,0)的方法获取选中行中的每一列,注意从0开始
		IDJTF.setText(jtable.getValueAt(selRow, 0).toString().trim());
		readertypeJCB.setSelectedItem(jtable.getValueAt(selRow, 1).toString().trim());
		personnameJTF.setText(jtable.getValueAt(selRow, 2).toString().trim());
		genderJTF.setText(jtable.getValueAt(selRow, 3).toString().trim());
		departmentJTF.setText(jtable.getValueAt(selRow, 5).toString().trim());
		positionJTF.setText(jtable.getValueAt(selRow, 6).toString().trim());
		regJTF.setText(jtable.getValueAt(selRow, 7).toString().trim());
		if(jtable.getValueAt(selRow, 4).toString().trim().equals("男"))
			JRB1.setSelected(true);
		else
			JRB2.setSelected(true);
	}
}
//修改按钮监听器类
class UpdActionListener implements ActionListener{
	public void actionPerformed(ActionEvent e) {
		String id=IDJTF.getText().trim();
		String type= (String) readertypeJCB.getSelectedItem();
		String personname=personnameJTF.getText().trim();
		String gender=genderJTF.getText().trim();
		String word="男";
		if(JRB2.isSelected())
			word="女";
		String department=departmentJTF.getText().trim();
		String position=positionJTF.getText().trim();
		String number=regJTF.getText().trim();
		if(department.length()>11){
			JOptionPane.showMessageDialog(null, "职位不可大于11位");
			departmentJTF.setText("");
			return;
		}
	
		int i=studentsDao.updatestudents(id, type, personname, gender, word, department, position, number);
		System.out.println(i);
		if(i==1){
			JOptionPane.showMessageDialog(null, "修改成功");
			Object[][] results=getSelect(studentsDao.selectReader());
			jtable=new JTable(results,readersearch);
			jscrollPane.setViewportView(jtable);
			jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
			jtable.addMouseListener(new TableListener());
		}
	}
}
//关闭按钮监听器类
class CloseActionListener implements ActionListener{
	public void actionPerformed(final ActionEvent e){
		setVisible(false);
	}
}
public static void main(String[] args) {
	new FileinformSelUpd();
}

}
4.7 员工背景信息添加界面
package com.bbm.view;

import javax.swing.*;

import com.bbm.db.peredutimeinformDao;

import java.awt.event.*;

import java.awt.*;
@SuppressWarnings(“serial”)
public class PersoneduationAdd extends JFrame {
private JLabel peredutimeJL,schoolnameJL,gradeJL,positionJL,numberJL;
private JPanel northJP,genderJP,southJP;
private JTextField peredutimeJTF,schoolnameJTF,gradeJTF,wordJTF,departmentJTF,positionJTF,numberJTF,priceJTF;
private JButton addJB,manjb,womanjb,resiteJB,closeJB;

	PersoneduationAdd(){
		northJP=new JPanel();
		southJP=new JPanel();
		northJP.setLayout(new GridLayout(4,4));
		
		peredutimeJL=new JLabel("受教育时间");
		peredutimeJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(peredutimeJL);
		peredutimeJTF=new JTextField();
		peredutimeJTF.setColumns(15);
		northJP.add(peredutimeJTF);
		
		schoolnameJL=new JLabel("学校名称");
		schoolnameJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(schoolnameJL);
		schoolnameJTF=new JTextField();
		schoolnameJTF.setColumns(15);
		northJP.add(schoolnameJTF);	
		
		gradeJL=new JLabel("年级");
		gradeJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(gradeJL);
		gradeJTF=new JTextField();
		gradeJTF.setColumns(15);
		northJP.add(gradeJTF);
		

		positionJL=new JLabel("所任职务");
		positionJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(positionJL);
		positionJTF=new JTextField();
		northJP.add(positionJTF);
		

		
		
		addJB=new JButton();
		addJB.setText("添加");
		addJB.addActionListener(new addAction());
		southJP.add(addJB);
		resiteJB=new JButton();
		resiteJB.setText("重置");
		resiteJB.addMouseListener(new resiteAction());
		southJP.add(resiteJB);
		closeJB=new JButton();
		closeJB.setText("关闭");
		closeJB.addMouseListener(new closeAction());
		southJP.add(closeJB);
		
		this.add(northJP,BorderLayout.CENTER);
		this.add(southJP,BorderLayout.SOUTH);
		this.setVisible(true);
		setTitle("信息添加");
		setResizable(false);
		this.setBounds(15, 15,600, 200);

	}
	 class addAction implements ActionListener
	 {
		public void actionPerformed(ActionEvent e) {
			String f=peredutimeJL.getText().trim();
			String p=schoolnameJTF.getText().trim();
			String n=gradeJTF.getText().trim();
			String w=wordJTF.getText().trim();
			String d=departmentJTF.getText().trim();
			String po=positionJTF.getText().trim();
			String nu=numberJTF.getText().trim();
			
			if (f.length()==0){
				JOptionPane.showMessageDialog(null,"受教育时间不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (p.length()==0){
				JOptionPane.showMessageDialog(null,"学校名称不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (n.length()==0){
				JOptionPane.showMessageDialog(null,"年级不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (w.length()==0){
				JOptionPane.showMessageDialog(null,"所任职务不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (d.length()==0){
				JOptionPane.showMessageDialog(null,"部门不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (po.length()==0){
				JOptionPane.showMessageDialog(null,"职位不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (nu.length()<=13){
				JOptionPane.showMessageDialog(null,"请输入11位电话号");
				PersoneduationAdd.this.setVisible(false);
			}else if(nu.length()==11){
				String peredutime=peredutimeJTF.getText().trim();
				String schoolname=schoolnameJTF.getText().trim();
				String grade=gradeJTF.getText().trim();
				String word=wordJTF.getText().trim();
				String department=departmentJTF.getText().trim();
				String position=positionJTF.getText().trim();
				String number=numberJTF.getText().trim();
				Double price=Double.parseDouble(priceJTF.getText().trim());
				int j=peredutimeinformDao.insert(peredutime,schoolname,grade, word, department, position, number, price);
				if(j>0){
					JOptionPane.showMessageDialog(null,"添加成功");
					PersoneduationAdd.this.setVisible(false);
				}
			}
		}
	 }
	class resiteAction extends MouseAdapter
	{
		@Override
		public void mouseClicked(MouseEvent e) {
			// TODO Auto-generated method stub
			super.mouseClicked(e);
			if(e.getSource()==resiteJB){
				peredutimeJTF.setText("");
				schoolnameJTF.setText("");
				gradeJTF.setText("");
				wordJTF.setText("");
				departmentJTF.setText("");
				positionJTF.setText("");
				numberJTF.setText("");
				
			}
		}
	}
	class closeAction extends MouseAdapter
	{
		public void mouseClicked(MouseEvent e) {
			super.mouseClicked(e);
			PersoneduationAdd.this.setVisible(false);
		}
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new PersoneduationAdd();
	}

}

4.8 员工背景信息查询与修改界面
package com.bbm.view;

import javax.swing.*;

import com.bbm.db.peredutimeinformDao;

import java.awt.event.*;

import java.awt.*;
@SuppressWarnings(“serial”)
public class PersoneduationAdd extends JFrame {
private JLabel peredutimeJL,schoolnameJL,gradeJL,wordJL,departmentJL,positionJL,genderJL,numberJL;
private JPanel northJP,genderJP,southJP;
private ButtonGroup buttonGroup = new ButtonGroup();
private JTextField peredutimeJTF,schoolnameJTF,gradeJTF,wordJTF,departmentJTF,positionJTF,numberJTF,priceJTF;
private JButton addJB,manjb,womanjb,resiteJB,closeJB;

	PersoneduationAdd(){
		northJP=new JPanel();
		southJP=new JPanel();
		northJP.setLayout(new GridLayout(4,4));
		
		peredutimeJL=new JLabel("受教育时间");
		peredutimeJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(peredutimeJL);
		peredutimeJTF=new JTextField();
		peredutimeJTF.setColumns(15);
		northJP.add(peredutimeJTF);
		
		schoolnameJL=new JLabel("学校名称");
		schoolnameJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(schoolnameJL);
		schoolnameJTF=new JTextField();
		schoolnameJTF.setColumns(15);
		northJP.add(schoolnameJTF);	
		
		gradeJL=new JLabel("年级");
		gradeJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(gradeJL);
		gradeJTF=new JTextField();
		gradeJTF.setColumns(15);
		northJP.add(gradeJTF);
		

		positionJL=new JLabel("所任职务");
		positionJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(positionJL);
		positionJTF=new JTextField();
		northJP.add(positionJTF);
		
		numberJL=new JLabel("电话号");
		numberJL.setHorizontalAlignment(SwingConstants.CENTER);
		northJP.add(numberJL);
		numberJTF=new JTextField(); 
		numberJTF.setColumns(15);
		northJP.add(numberJTF);
		
		
		addJB=new JButton();
		addJB.setText("添加");
		addJB.addActionListener(new addAction());
		southJP.add(addJB);
		resiteJB=new JButton();
		resiteJB.setText("重置");
		resiteJB.addMouseListener(new resiteAction());
		southJP.add(resiteJB);
		closeJB=new JButton();
		closeJB.setText("关闭");
		closeJB.addMouseListener(new closeAction());
		southJP.add(closeJB);
		
		this.add(northJP,BorderLayout.CENTER);
		this.add(southJP,BorderLayout.SOUTH);
		this.setVisible(true);
		setTitle("档案信息添加");
		setResizable(false);
		this.setBounds(15, 15,600, 200);

	}
	 class addAction implements ActionListener
	 {
		public void actionPerformed(ActionEvent e) {
			String f=peredutimeJL.getText().trim();
			String p=schoolnameJTF.getText().trim();
			String n=gradeJTF.getText().trim();
			String w=wordJTF.getText().trim();
			String d=departmentJTF.getText().trim();
			String po=positionJTF.getText().trim();
			String nu=numberJTF.getText().trim();
			
			if (f.length()==0){
				JOptionPane.showMessageDialog(null,"受教育时间不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (p.length()==0){
				JOptionPane.showMessageDialog(null,"学校名称不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (n.length()==0){
				JOptionPane.showMessageDialog(null,"年级不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (w.length()==0){
				JOptionPane.showMessageDialog(null,"所任职务不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (d.length()==0){
				JOptionPane.showMessageDialog(null,"部门不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (po.length()==0){
				JOptionPane.showMessageDialog(null,"职位不能为空");
				PersoneduationAdd.this.setVisible(false);
			}if (nu.length()<=13){
				JOptionPane.showMessageDialog(null,"请输入11位电话号");
				PersoneduationAdd.this.setVisible(false);
			}else if(nu.length()==11){
				String peredutime=peredutimeJTF.getText().trim();
				String schoolname=schoolnameJTF.getText().trim();
				String grade=gradeJTF.getText().trim();
				String word=wordJTF.getText().trim();
				String department=departmentJTF.getText().trim();
				String position=positionJTF.getText().trim();
				String number=numberJTF.getText().trim();
				Double price=Double.parseDouble(priceJTF.getText().trim());
				int j=peredutimeinformDao.insert(peredutime,schoolname,grade, word, department, position, number, price);
				if(j>0){
					JOptionPane.showMessageDialog(null,"添加成功");
					PersoneduationAdd.this.setVisible(false);
				}
			}
		}
	 }
	class resiteAction extends MouseAdapter
	{
		@Override
		public void mouseClicked(MouseEvent e) {
			// TODO Auto-generated method stub
			super.mouseClicked(e);
			if(e.getSource()==resiteJB){
				peredutimeJTF.setText("");
				schoolnameJTF.setText("");
				gradeJTF.setText("");
				wordJTF.setText("");
				departmentJTF.setText("");
				positionJTF.setText("");
				numberJTF.setText("");
				
			}
		}
	}
	class closeAction extends MouseAdapter
	{
		public void mouseClicked(MouseEvent e) {
			super.mouseClicked(e);
			PersoneduationAdd.this.setVisible(false);
		}
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new PersoneduationAdd();
	}

}

4.9 员工登录添加界面
package com.lhm.view;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import com.lhm.view.UserDao;
public class UserAdd extends JFrame {
private static final long serialVersionUID=1L;
private JPanel userJP,buttonJP;
private JLabel userNameJL,passWordJL;
private JTextField userNameJTF;
private JPasswordField passWordJPF;
private JButton addJB,cancelJB;
public UserAdd(){
this.setTitle(“添加用户”);
this.setBounds(500, 500, 350, 150);
//用户信息面板设计
userJP=new JPanel();
userJP.setBorder(new EmptyBorder(10,40,10,40));
GridLayout gridLayout=new GridLayout(2,2);
gridLayout.setHgap(10);
gridLayout.setVgap(10);
userJP.setLayout(gridLayout);
//创建用户名标签,并添加到userJP
userNameJL=new JLabel(“用户名:”);
userNameJL.setHorizontalAlignment(SwingConstants.CENTER);
userJP.add(userNameJL);
userNameJTF=new JTextField();
userJP.add(userNameJTF);
//创建密码标签,并添加到userJP
passWordJL=new JLabel(“密码:”);
passWordJL.setHorizontalAlignment(SwingConstants.CENTER);
userJP.add(passWordJL);
passWordJPF=new JPasswordField();
userJP.add(passWordJPF);
//按钮面板设计
buttonJP=new JPanel();
addJB=new JButton(“添加”);
addJB.addActionListener(new AddListener());
cancelJB=new JButton(“取消”);
cancelJB.addActionListener(new closeListener());
buttonJP.add(addJB);
buttonJP.add(cancelJB);
this.add(userJP,BorderLayout.NORTH);
this.add(buttonJP,BorderLayout.SOUTH);
this.setResizable(false);
this.setVisible(true);
}
//添加用户功能实现
class AddListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
String name=userNameJTF.getText().trim();
String pwd=String.valueOf(passWordJPF.getPassword());
int i=UserDao.intsertUser(name, pwd);
if(i1){
JOptionPane.showMessageDialog(null, “添加成功”);
}
}
}
//取消按钮监听器类
class closeListener implements ActionListener{
public void actionPerformed(ActionEvent e){
setVisible(false);
}
}
public static void main(String[] args) {
new UserAdd();
}
}
4.10 员工登录删除界面
package com.lhm.view;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import com.lhm.view.UserDao;
import com.lhm.view.Users;
public class UserDel extends JFrame {
private static final long serialVersionUID=1L;
private JPanel userJP, buttonJP;
private JTable jtable;
private JScrollPane jscrollPane;
private JButton delJB,exitJB;
String[] array={“用户名”,“密码”};
private Object[][] getSelect(List list){
Object[][] results=new Object[list.size()][array.length];
for(int i=0;i<list.size();i++){
Users users=list.get(i);
results[i][0]=users.getName();
results[i][1]=users.getPassword();
}
return results;
}
//构造方法
public UserDel(){
this.setTitle(“删除用户”);
this.setBounds(500, 500, 500, 300);
//用户面板信息设计
userJP=new JPanel();
jscrollPane=new JScrollPane();
jscrollPane.setPreferredSize(new Dimension(400,200));
Object[][] results=getSelect(UserDao.selectUser());
jtable=new JTable(results,array);
jscrollPane.setViewportView(jtable);
userJP.add(jscrollPane);
//按钮面板设计
buttonJP=new JPanel();
delJB=new JButton(“删除”);
delJB.addActionListener(new DeleteListener());
exitJB=new JButton(“退出”);
exitJB.addActionListener(new closeListener());
buttonJP.add(delJB);
buttonJP.add(exitJB);
//将面板添加到该界面中
this.add(userJP,BorderLayout.CENTER);
this.add(buttonJP,BorderLayout.SOUTH);
this.setResizable(false);
this.setVisible(true);
}
//删除用户功能实现
class DeleteListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
int selRow =jtable.getSelectedRow();
String name=(String) jtable.getValueAt(selRow,0);
int d=UserDao.deleteUser(name);
if(d
1){
JOptionPane.showMessageDialog(null, “删除成功”);
Object[][] results=getSelect(UserDao.selectUser());
jtable=new JTable(results,array);
jscrollPane.setViewportView(jtable);
}}}
//退出按钮监听器类
class closeListener implements ActionListener{
public void actionPerformed(ActionEvent e){
setVisible(false);
}
}
public static void main(String[] args) {
new UserDel();
}
}
5 测试过程
(1)测试登录界面
打开档案管理系统,输入用户名和密码,然后点击确定,看是否可以进入主界面,如果可以则成功
(2)测试界面之间的跳转
点击档案信息管理然后再点击档案信息添加,看是否可以正常跳转,同样的方法测试档案信息查询与修改,员工基本信息添加,员工基本信息查询与修改,员工教育背景信息添加,员工教育背景信息查询与修改,用户登录信息添加和用户登录信息删除。测试每个界面是否可以正常跳转,如果可以则界面之间的跳转没有问题。
(3)测试界面
点击档案信息管理然后再点击档案信息添加,然后再点击档案信息管理然后再点击档案信息查询与修改看是否信息添加成功,同样的方法测试员工的基本信息和员工的教育背景信息;另外点击档案信息管理然后再点击员工添加,添加员工登录信息然后重新登录看是否能够实现,用户信息删除以同样的方法测试。

总结
人事档案管理系统的完成,能实现对员工的人事档案资料进行有效的录入、
修改和删除,根据职工编号或姓名对符合条件的员工人事档案资料进行修改以及
根据职工编号或姓名对符合条件的员工人事档案资料进行删除,根据职工编号或
姓名查询符合条件的员工人事档案资料。在本系统的开发过程中,由于本人是初
次开发软件,在知识、经验方面都存在着不足。另外,在整个开发的过程中,时
间也比较仓促。因此,该系统必然会存在一些缺陷和不足。因为对人事档案管理
的整个流程不够熟悉,在需求分析时未能做到完全满足用户的需求。虽然在人事
档案系统中的网络的应用不是很多,但是未来的发展还是比较好的,在本次开发
过程由于硬件、软件、和知识储备的限制,未能实现网络功能,因此在以后的系
统更新过程中可能会造成一些不必要的数据损头。
尽管本管理系统存在着很多不足,但其功能基本符合要求、易于日后程序更
新、数据库管理容易、界面友好、操作方便等优点是本管理系统所必需的。相信
本人事档案管理系统是一套公司在日常管理人事档案中必不可少的管理软件,通
过开发这个系统,我掌握了做一般软件的基本过程,了解的基本知识巩了固了我
对 MyEclipse 6.0.1和sql的学习,但在这次毕业设计中的最大收获并不是掌握这儿门开发工具的应用,而是学会了设计系统的思维方法,以及与同学们之间粗互帮助的精神。

  • 3
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

轩辕椿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值