一、需求说明
1.实体类:Department
2.数据库访问层:DepartmentDao/DepartmentDaoImpl
3.业务层:DepartmentService/DepartmentServiceImpl
4.Junit测试:
5.控制层:DepartmentServlet extends BaseServlet
6.视图层:system/deptadd.jsp
将HTML修改为jsp
二、数据库设计
创建员工表
##新建员工表
create table dept (
DEPTNO int(10) not null auto_increment,
DEPTNAME varchar(100) not null,
LOCATION varchar(100),
primary key(DEPTNO)
)
三、实体类设计
要继承Serializable,Comparable两个类
package com.facai.entity;
import java.io.Serializable;
public class Department implements Serializable,Comparable<Department>{
private int deptno;//部门编号
private String deptname;//部门名称
private String location;//所在地点
public int getDeptno() {
return deptno;
}
public void setDeptno(int deptno) {
this.deptno = deptno;
}
public String getDeptname() {
return deptname;
}
public void setDeptname(String deptname) {
this.deptname = deptname;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
@Override
public String toString() {
return "Department [deptno=" + deptno + ", deptname=" + deptname