基于SSH开发的健康管理系统 JAVA MySQL
10101基于SSH开发的健康管理系统
鏈-路:https://pan.baidu.com/s/1a01LN31IJLzHxmVgwtVjbg (将 . 替换为 . 即可正常访问)
趧-紶-碼:9768
此段使用百度网盘手机应用打开后,“caizao”功能更加便捷哦
技术
Spring + Struts + Hibernate
工具
eclipse + tomact + mysql + jdk
功能详情
| 前台功能 | 后台功能 |
|---|---|
| 系统首页 | 管理员管理 |
| 教师体检管理 | 健康新闻管理 |
| 疾病精准评估 | 教师个人信息管理 |
| 教师饮食管理 | 教师体检信息管理 |
| 教师健康日志 |
系统相关截图
● 系统首页

● 后台首页

作为负责处理HTTP请求的RESTful服务容器,
映射到指定URL,
随后,
类UserController被定义。
@GetMapping("/list")
public JSONObject listUser(Requesting request) {
// 将Requesting转换为JSON格式
JSONObject json = CommonUtil.request2Json(request);
// 通过服务层获取数据
return userService.listUser(json);
}
}
@author: hxy
@description: 用户/角色/权限相关controller
@date: 2017/11/2 10:19
*/
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
/**
- 查询用户列表
- @param request 用户请求
- @return 用户JSON数据
*/
// 查询用户列表时需满足的权限要求
@RequiresPermissions(user: "user:list")
@SuppressWarnings("user")
// 获取用户JSON数据
@GetMapping("/list")
public JSONObject listUser(Request request) {
// 调用服务端获取用户的数据
return userService.listUser(request);
}
基于角色权限控制("user")的读取操作。
发布用户请求至指定路径 "/addUser"。
定义一个名为 addUser 的方法:
输入参数为 requestObject 类型的 JSON 对象。
输出结果为 JSONObject 类型的数据。
使用 CommonUtil 检查 requestObject 中是否包含(“用户名”,“密码”,“昵称”,“角色ID”)四个字段。
最终返回服务层处理后的数据结果。
@RequiresPermissions("account:edit")
该资源将被发布到 /updateUser 位置。
public JSONObject updateUser(@RequestBody JSONObject requestObject) {
CommonUtil.hasAllRequired(requestObject, "username, roleID, 是否删除状态以及 userId");
return userService.updateUser(requestObject);
}
@RequiresPermissions(values = {{"user:add", "user:update"}}, logical = Logical.OR)
@SuppressWarnings("com.example.UserService")
@(anyone, roles)
@ReturnsPublicObject()
public JSONObject getAllRoles() {
return userService.getAllRoles();
}
/** * 角色列表
* * @return
*/
@RequiresPermissions(“role:list”)
@GetMapping("/listRole")
public JSONObject listRole() {
return userService.listRole();
}
/**
- 获取角色的所有权限信息
- @return
*/
public JSONObject listAllPermission() {
return userService.listAllPermission();
}
@RequiresPermissions(roleNames) // 调用此方法前需确保roleNames数组已定义
@When("/listAllPermission")
public JSONObject listAllPermission() {
return userService.listAllPermission();
}
/**
* 新增角色功能模块
* 返回值:@return
*/
@RequiresPermissions("role:add")
@PostMapping("/addRole")
public JSONObject addRole(@RequestBody JSONObject requestJson) {
CommonUtil.hasAllRequired(requestJson, "角色名称及权限");
return userService.addRole(requestJson);
}
/** * 修改角色
* * @return
*/
@RequiresPermissions(“role:update”)
@PostMapping("/updateRole")
public JSONObject updateRole(@RequestBody JSONObject requestJson) {
CommonUtil.hasAllRequired(requestJson, “roleId,roleName,permissions”);
return userService.updateRole(requestJson);
}
……
}
package com;
导入用于构建微服务的Spring Boot组件-容器框架。
配置应用程序连接到JDBC数据源。
设置JDBC数据源的配置选项。
集成Spring Boot组件内射框架以实现组件内射功能。
// 排除特定配置类的应用
@SpringBootApplication(exclusion = {DataSourceAutoConfiguration.class})
public class BlogStarter {
public static void main(String[] args) {
SpringApplication.run(BlogStarter.class, args);
}
}
4.0.0
org.example
Spike
1.0-SNAPSHOT
Spike
org.springframework.boot
spring-boot-starter-parent
2.0.5.RELEASE
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target>
org.springframework.boot
spring-boot-starter-web
junit
junit
4.11
test
maven-clean-plugin
3.1.0
maven-resources-plugin
3.0.2
maven-compiler-plugin
3.8.0
maven-surefire-plugin
2.22.1
maven-jar-plugin
3.0.2
maven-install-plugin
2.5.2
maven-deploy-plugin
2.8.2
maven-site-plugin
3.7.1
maven-project-info-reports-plugin
3.0.0
package org.example;
import org.springframework.boot.frameworkBundle;
import org.springframework.boot.frameworkBundle自动配置启用;
@WebApplication
@Controller
//SpringBoot会帮我们启动tomcat,并加载默认配置
@EnableAutoConfiguration
//SpringMVC相关配置
@RestController
public class App {
@RequestMapping("/")
public String home(){
//网页中输出
return “Hello World!”;
}
public static void main( String[] args ){
//控制台输出
System.out.println( “Hello World!” );
SpringApplication.run(App.class,args);
}
}
2
3 <project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
4 xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
5 4.0.0
6
7 org.example
8 Spike
9 1.0-SNAPSHOT
10
11 Spike
12
13 http://www.example.com
14
15
16 org.springframework.boot
17 spring-boot-starter-parent
18 2.0.5.RELEASE
19
20
21
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <maven.compiler.source>1.8</maven.compiler.source>
24 <maven.compiler.target>1.8</maven.compiler.target>
25
26
27
28
29 org.springframework.boot
30 spring-boot-starter-web
31
32
33 mysql
34 mysql-connector-java
35 5.1.6
36
37
38 com.alibaba
39 druid
40 1.1.3
41
42
43 org.mybatis.spring.boot
44 mybatis-spring-boot-starter
45 1.3.1
46
47
48 junit
49 junit
50 4.11
51 test
52
53
54 org.mybatis.generator
55 mybatis-generator-core
56 1.3.5
57
58
59
60
61
62
63
64
65 maven-clean-plugin
66 3.1.0
67
68
69
70 maven-resources-plugin
71 3.0.2
72
73
74 maven-compiler-plugin
75 3.8.0
76
77
78 maven-surefire-plugin
79 2.22.1
80
81
82 maven-jar-plugin
83 3.0.2
84
85
86 maven-install-plugin
87 2.5.2
88
89
90 maven-deploy-plugin
91 2.8.2
92
93
94
95
96 maven-site-plugin
97 3.7.1
98
99
100 maven-project-info-reports-plugin
101 3.0.0
102
103
104
105 org.mybatis.generator
106 mybatis-generator-maven-plugin
107 1.3.5
108
109
110 org.mybatis.generator
111 mybatis-generator-core
112 1.3.5
113
114
115 mysql
116 mysql-connector-java
117 5.1.6
118
119
120
121
122 mybatis generator
123 package
124
125 generate
126
127
128
129
130
131 true
132
133 true
134
135
136 src/main/resource/mybatis-generator.xml
137
138
139
140
141
142
143
144 package org.example;
import org.example.dao.UserDoMapper;
import org.example.dataobject.UserDo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//SpringBoot能够自动启动Tomcat服务并加载其默认配置参数
@SpringBootApplication
scannedBase Packages 设置为包含 "org.example"
注
注
@RequestMapping("/")
public String home(){
UserDo userDo = userDoMapper.retrieveSingleUser(1);
if(userDo == null){
return "该用户对象信息未找到";
}else{
return userDo.getName();
}
}
public static void main(String[] args){
//控制台输出
System.out.println("Hello World!");
SpringApplication.run(App.class, args);
}
}
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserDoMapper userDoMapper;
@Autowired
private UserPasswordDOMapper userPasswordDOMapper;
Reimplementing the method to retrieve a user by their ID.
public UserModel convertFromDataObject(UserDo userDo, UserPasswordDO userPasswordDO) {
if(userDo == null){
return null;
}
UserModel userModel = new UserModel();
BeanUtils.copyProperties(userDo,userModel);
if(userPasswordDO != null){
userModel.setEncriptPassword(userPasswordDO.getEncriptPassword());
}
return userModel;
}
}@Controller(“user”)
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/get")
@ResponseBody
public UserVO getUser(@RequestParam(name=“id”) Integer id) {
//调用service服务获取对应id的用户对象并返回给前端
UserModel userModel = userService.getUserById(id);
//将核心领域模型对象转化为可供UI使用的viewobject
return convertFromModel(userModel);
}
private UserVO convertFromModel(UserModel userModel){
if(userModel == null){
return null;
}
UserVO userVO = new UserVO();
BeanUtils.copyProperties(userModel,userVO);
return userVO;
}
}package org.example.response;
public class CommonReturnType {
【表名
此段代码旨在提供一个通用的方法来生成返回值。
public static CommonReturnType create(Object result) {
return CommonReturnType.create(result, "指定结果参数和默认状态字符串");
}
public static CommonReturnType create(Object dataObject, String resultCode) {
CommonReturnType instance = new CommonReturnType();
instance.setStatus(resultCode);
instance.setData(dataObject);
return instance;
}
public String getStatus() {
return resultCode;
}
public void setStatus(String status) {
本方法将字符串状态设置为指定的字符串参数。
}
public Object getData() {
本方法将返回当前的数据。
}
public void setData(Object data) {
本方法将对象数据设置为指定的对象参数。
}
