10097基于JSP开发的驾驶员在线考试系统
代码:
鏈-椄:https://pan@baidu@com/s/1a01LN31IJLzHxmVgwtVjbg (把@换成 . 就可正常访问)
趧-紶-碼:9768
f/u枝此段-吶傛打开baidu網盤手机App,caozuo更方便哦
技术
JAVA + JSP
工具
eclipse + tomact + mysql + jdk
功能详情
管理员权限 | 学生权限 |
---|---|
系统管理 | 个人信息管理 |
题库管理 | 在线测试 |
考生管理 | 成绩查询 |
系统管理 |
系统相关截图
@RestController
@RequestMapping("/user")
之后
public class UserController {
@GetMapping("/list")
public JSONObject listUser(HttpServletRequest request) {
return userService.listUser(CommonUtil.request2Json(request));
}
}/**
-
@author: hxy
-
@description: 用户/角色/权限相关controller
-
@date: 2017/11/2 10:19
*/
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;/**
- 查询用户列表
- @param request
- @return
*/
@RequiresPermissions(“user:list”)
@GetMapping("/list")
public JSONObject listUser(HttpServletRequest request) {
return userService.listUser(CommonUtil.request2Json(request));
}
@RequiresPermissions(“user:add”)
@PostMapping("/addUser")
public JSONObject addUser(@RequestBody JSONObject requestJson) {
CommonUtil.hasAllRequired(requestJson, “username, password, nickname, roleId”);
return userService.addUser(requestJson);
}@RequiresPermissions(“user:update”)
@PostMapping("/updateUser")
public JSONObject updateUser(@RequestBody JSONObject requestJson) {
CommonUtil.hasAllRequired(requestJson, " nickname, roleId, deleteStatus, userId");
return userService.updateUser(requestJson);
}@RequiresPermissions(value = {“user:add”, “user:update”}, logical = Logical.OR)
@GetMapping("/getAllRoles")
public JSONObject getAllRoles() {
return userService.getAllRoles();
}/**
- 角色列表
- @return
*/
@RequiresPermissions(“role:list”)
@GetMapping("/listRole")
public JSONObject listRole() {
return userService.listRole();
}
/**
- 查询所有权限, 给角色分配权限时调用
- @return
*/
@RequiresPermissions(“role:list”)
@GetMapping("/listAllPermission")
public JSONObject listAllPermission() {
return userService.listAllPermission();
}
/**
- 新增角色
- @return
*/
@RequiresPermissions(“role:add”)
@PostMapping("/addRole")
public JSONObject addRole(@RequestBody JSONObject requestJson) {
CommonUtil.hasAllRequired(requestJson, “roleName,permissions”);
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;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication(exclude= {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
http://www.example.com
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.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//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);
}
}<?xml version="1.0" encoding="UTF-8"?>
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(scanBasePackages = {“org.example”})
//SpringMVC相关配置
@RestController
@MapperScan(“org.example.dao”)
public class App {
@Autowired
private UserDoMapper userDoMapper;
@RequestMapping("/")
public String home(){
UserDo userDo = userDoMapper.selectByPrimaryKey(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;
@Override
public UserModel getUserById(Integer id) {
UserDo userDo = userDoMapper.selectByPrimaryKey(id);
if(userDo == null){
return null;
}
//通过用户id获取对应的用户加密密码信息
UserPasswordDO userPasswordDO = userPasswordDOMapper.selectByUserId(userDo.getId());
return convertFromDataObject(userDo,userPasswordDO);
}
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 {
//表名对应请求的返回处理结果,success/fail
private String status;
//若status返回success,则data内返回前端需要的json数据
//若status返回success,则data内使用通用的错误码格式
private Object data;
//定义一个通用的创建方法
public static CommonReturnType create(Object result){
return CommonReturnType.create(result,“success”);
}
public static CommonReturnType create(Object result,String status){
CommonReturnType type = new CommonReturnType();
type.setStatus(status);
type.setData(result);
return type;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}