# 1.项目简介
使用SSM框架搭建的一个简单的员工信息管理系统,实现了基本的增删改查整个流程
直接把war包放到tomcat的webapps目录下,重启即可运行
## 1.1系统架构
![](https://www.writebug.com/myres/static/uploads/2021/10/26/ffec3b7dd7f564357f614ba571cc8084.writebug)
## 1.2功能分解
1. 查询和分页显示
2. 新增员工信息功能
- 数据校验,需要校验用户名和邮箱是否合法
- 前端使用jquery校验,后端使用JSR303
3. 修改员工信息功能
4. 单个删除员工
5. 批量删除员工
6. 使用Rest风格的URI
7. 搜索功能
## 1.3技术点
- 基础框架:SpringMVC+Spring+MyBatis
- 数据库:MySQL
- 前端框架:BootStrap快速搭建
- 项目依赖管理:Maven
- 分页:pagehelper(Mybatis的工具)
- 逆向工程:MyBatis Generator
## 1.4数据库表设计
![](https://www.writebug.com/myres/static/uploads/2021/10/26/3353f74601d72ccf0c188f95217642c0.writebug)
# 2.功能实现
## 2.1查询和分页显示
### 2.1.1数据分析
分析前端UI,分析要从数据库获取的信息
![](https://www.writebug.com/myres/static/uploads/2021/10/26/422de223907c2f8da6a6a487b0c380f4.writebug)
修改Mapper映射文件
![](https://www.writebug.com/myres/static/uploads/2021/10/26/8d2d9b6b2e4b557f1b80d96553cca7c4.writebug)
### 2.1.2业务逻辑分析
1. 访问index.jsp页面
2. 发送ajax请求获取员工数据
3. 服务器返回JSON数据
4. 浏览器解析JSON数据,使用DOM增删页面
### 2.1.3实现
1. 导入jackson包,把对象转换成JSON字符串,在controller中添加ResponseBody注解即可
2. 定义一个新的实体类Msg.java
- 3个属性:
- 响应码(100成功 200失败)
- 提示信息(msg)
- 返回给浏览器的数据(Map<String,Object>封装)
- 3个方法:
- 静态Success:返回Msg对象,设置响应吗100,提示信息处理成功
- 静态Fail:返回Msg对象,设置响应吗200,提示信息处理失败
- Add方法:用于把pageInfo放入到map中
```
public Msg add(String key, Object value) {
this.getExtend().put(key,value);
return this;
}
```
3. index.jsp使用Jquery进行拼接元素,显示表格
### 2.1.4流程图
![](https://www.writebug.com/myres/static/uploads/2021/10/26/abac936b5c8cd0a3a278fcad79d373d8.writebug)
## 2.2新增员工信息功能
### 2.2.1业务逻辑
1. index.jsp页面点击新增
2. 弹出新增员工的对话框(模态框)
3. 数据库查询部门列表,显示在对话框中
4. 用户输入数据
- 校验数据
5. 完成保存
### 2.2.2数据分析
![](https://www.writebug.com/myres/static/uploads/2021/10/26/feb1e4d05525b907658610fa501777ba.writebug)
- 姓名和邮箱要做前端+后端校验
- 部门根据数据库信息返回的添加进去
### 2.2.3查出部门信息
![](https://www.writebug.com/myres/static/uploads/2021/10/26/2a2e32cf5ccf99d3f652cfc7be289c2b.writebug)
### 2.2.4前端校验用户名和邮箱是否合法
![](https://www.writebug.com/myres/static/uploads/2021/10/26/10c4c9622dd40789ac2ae25572a34e6c.writebug)
### 2.2.5后端校验用户名和邮箱是否合法
1. 使用的是JSR303校验
2. 当输入框输入完成移开鼠标之后,发送AJAX到服务器请求用户名是否已经存在,并且是否是合法的用户名
3. 如果校验不通过,那么保存信息的按钮应处于不可用状态
![](https://www.writebug.com/myres/static/uploads/2021/10/26/5ddc32ae14a34a683a51800e3c77e8c9.writebug)
### 2.2.6保存新增的员工信息
调用的是Jquery的serialize()方法,把表单数据包装成对象
![](https://www.writebug.com/myres/static/uploads/2021/10/26/3bdab0ff54324ab6f5986a7d18777b5f.writebug)
## 2.3修改员工信息功能
### 2.3.1逻辑分析
1. 点击修改按钮,发送AJAX信息,请求当前修改员工的数据库信息
2. 弹出模态框,回显员工信息,姓名不允许修改
3. 校验邮箱
**注意**
由于修改和删除按钮都是页面加载完成后,由AJAX发送请求,再添加到页面的,所有click事件不生效,所以要使用dom对象操作
![](https://www.writebug.com/myres/static/uploads/2021/10/26/d4f2249c8c8a532b9b42a01a4348b5fa.writebug)
TOMCAT直接使用PUT请求的时候不会封装请求体数据,要使用SpringMVC的过滤器完成PUT
![](https://www.writebug.com/myres/static/uploads/2021/10/26/2f118cc59ac8cf3c32b9997aa6e25081.writebug)
### 2.3.2数据分析
![](https://www.writebug.com/myres/static/uploads/2021/10/26/f408dda0ed8e8a2ea259c9f6b9c3391e.writebug)
### 2.3.3业务实现
1. 获取部门信息增加到下拉框
2. 获取员工信息添加到模态框
3. 点击保存按钮更新员工信息到数据库
![](https://www.writebug.com/myres/static/uploads/2021/10/26/5faaabc61d2dc7f1ed941102a352d617.writebug)
## 2.4删除功能
### 2.4.1单个删除
![](https://www.writebug.com/myres/static/uploads/2021/10/26/c301ac8485c2102c56ff96c75c6e7174.writebug)
### 2.4.2批量删除
1. 添加选择按钮
2. 实现批量删除
### 2.4.3添加选择按钮
![](https://www.writebug.com/myres/static/uploads/2021/10/26/a12a1f4a399c6f50ebb106fdb9cff333.writebug)
### 2.4.4实现批量删除
![](https://www.writebug.com/myres/static/uploads/2021/10/26/a080bc9b845c66236d59f62281b91f08.writebug)
## 2.5搜索功能
### 2.5.1逻辑
1. 增加一个高级搜索的按钮,跳转到高级搜索的界面query.jsp
2. 后台需要判断输入条件
### 2.5.2数据分析
![](https://www.writebug.com/myres/static/uploads/2021/10/26/6b7b719d8b279deee7db372e0ae8a16b.writebug)
### 2.5.3实现
1. 表现层
```java
/**
* 查询功能的查询员工信息
* 查询出来的员工数据显示在一页上面
*/
@RequestMapping(value="/queryEmps",method=RequestMethod.POST)
@ResponseBody
public Msg queryEmp(Employee employee) {
System.out.println(employee);
List<Employee> emplist = employeeService.queryEmp(employee);
return Msg.success().add("emplist",emplist);
}
```
2. Service层
```java
public List<Employee> queryEmp(Employee employee) {
// TODO Auto-generated method stub
EmployeeExample example = new EmployeeExample();
Criteria criteria = example.createCriteria();
System.out.println("".equals(employee.getEmpName()));
if (!("".equals(employee.getEmpName()))) {
criteria.andEmpNameEqualTo(employee.getEmpName());
}
if(!("".equals(employee.getEmail()))) {
criteria.andEmailEqualTo(employee.getEmail());
}
criteria.andGenderEqualTo(employee.getGender());
criteria.andDIdEqualTo(employee.getdId());
return employeeMapper.selectByExampleWithDept(example);
}
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
实现功能: 查询和分页显示 新增员工信息功能 数据校验,需要校验用户名和邮箱是否合法 前端使用jquery校验,后端使用JSR303 修改员工信息功能 单个删除员工 批量删除员工 使用Rest风格的URI 搜索功能
资源推荐
资源详情
资源评论
收起资源包目录
基于SSM框架+MySQL实现的员工信息管理系统【100012921】 (207个子文件)
access_log.2018-04-12 7KB
index_jsp.class 31KB
query_jsp.class 16KB
EmployeeExample$GeneratedCriteria.class 11KB
EmployeeExample$GeneratedCriteria.class 11KB
EmployeeExample$Criteria.class 7KB
EmployeeExample$Criteria.class 7KB
DepartmentExample$GeneratedCriteria.class 6KB
DepartmentExample$GeneratedCriteria.class 6KB
EmployeeController.class 6KB
EmployeeController.class 6KB
MvcTest.class 4KB
MvcTest.class 4KB
DepartmentExample$Criteria.class 4KB
DepartmentExample$Criteria.class 4KB
EmployeeService.class 4KB
EmployeeService.class 4KB
Employee.class 3KB
Employee.class 3KB
DepartmentExample$Criterion.class 2KB
DepartmentExample$Criterion.class 2KB
EmployeeExample$Criterion.class 2KB
EmployeeExample$Criterion.class 2KB
DepartmentExample.class 2KB
DepartmentExample.class 2KB
EmployeeExample.class 2KB
EmployeeExample.class 2KB
Msg.class 2KB
Msg.class 2KB
MBGTest.class 2KB
MBGTest.class 2KB
DepartmentController.class 1KB
DepartmentController.class 1KB
EmployeeMapper.class 1KB
Department.class 1KB
EmployeeMapper.class 1KB
Department.class 1KB
DepartmentMapper.class 1000B
DepartmentMapper.class 1000B
DepartmentService.class 952B
DepartmentService.class 952B
MapperTest.class 908B
MapperTest.class 908B
.classpath 1KB
org.eclipse.wst.common.component 670B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 143KB
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
bootstrap-theme.css 26KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
bootstrap-theme.min.css 23KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
aspectjweaver-1.8.9.jar 1.78MB
mybatis-3.4.2.jar 1.52MB
jackson-databind-2.8.8.jar 1.18MB
spring-context-4.3.7.RELEASE.jar 1.09MB
spring-core-4.3.7.RELEASE.jar 1.07MB
mysql-connector-java-5.1.41.jar 970KB
spring-webmvc-4.3.7.RELEASE.jar 894KB
spring-web-4.3.7.RELEASE.jar 799KB
spring-beans-4.3.7.RELEASE.jar 745KB
hibernate-validator-5.4.1.Final.jar 744KB
c3p0-0.9.1.2.jar 596KB
spring-test-4.3.7.RELEASE.jar 585KB
mybatis-generator-core-1.3.5.jar 543KB
spring-jdbc-4.3.7.RELEASE.jar 418KB
jstl-1.2.jar 405KB
spring-aop-4.3.7.RELEASE.jar 371KB
jsqlparser-1.0.jar 356KB
junit-4.12.jar 308KB
jackson-core-2.8.8.jar 276KB
spring-tx-4.3.7.RELEASE.jar 261KB
spring-expression-4.3.7.RELEASE.jar 257KB
pagehelper-5.1.2.jar 77KB
jboss-logging-3.3.0.Final.jar 65KB
classmate-1.3.1.jar 63KB
validation-api-1.1.0.Final.jar 62KB
commons-logging-1.2.jar 60KB
spring-aspects-4.3.7.RELEASE.jar 57KB
jackson-annotations-2.8.0.jar 54KB
mybatis-spring-1.3.1.jar 52KB
hamcrest-core-1.3.jar 44KB
index_jsp.java 43KB
query_jsp.java 20KB
EmployeeExample.java 16KB
DepartmentExample.java 9KB
EmployeeController.java 6KB
EmployeeService.java 2KB
MvcTest.java 2KB
Employee.java 2KB
MapperTest.java 2KB
MBGTest.java 1KB
EmployeeMapper.java 1KB
Msg.java 1KB
DepartmentController.java 930B
DepartmentMapper.java 878B
共 207 条
- 1
- 2
- 3
资源评论
神仙别闹
- 粉丝: 2680
- 资源: 7667
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (matlab源码)基于Elman神经网络的电力负荷预测模型MATLAB实现
- 微信小程序源码 趣味互动机器人 - 机器人兔兔下载
- 2022年全国各区县年平均气温
- 05-16 周四 vscode 搭建远程调试环境
- (matlab源码)基于SOM神经网络的柴油机故障诊断MATLAB实现
- 1950-2022年全国各省份逐年平均降水数据
- (matlan源码)粒子群算法的寻优算法MATLAB实现
- MTB095N10KRN3-VB一款SOT23封装N-Channel场效应MOS管
- (MATLAB源码)灰色神经网络对订单需求预测分析与MATLAB实现 (2)
- (matlab源码)基于BP-Adaboost的强分类器设计与MATLAB实现
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功