基于javaweb的SpringBoot驾校预约学习系统(java+springboot+maven+mybaits+vue+elementui+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

361524112608

371524112608

381524112608

391524112608

411524112608

421524112608

431524112608

441524112608

451524112608

461524112608

基于javaweb的SpringBoot驾校预约学习系统(java+springboot+maven+mybaits+vue+elementui+mysql)

项目介绍

基于Springboot+vue实现的驾校预约学习系统

系统包含用户、教练、管理员三个角色

用户:登录、注册、主页、查看考试信息(进行考试)、查看教练信息、教练预约、查看学习资料、收藏学习资料、留言板、公告信息查看、个人中心、考试记录、错题本等功能

教练:登录、个人中心、公告信息管理、教练预约管理、留言板管理、学习资料管理、试卷管理、试题管理等功能

管理员:登录、个人中心、教练管理、用户管理、公告信息管理、教练预约管理、留言板管理、学习资料管理、试卷管理、试题管理、考试管理、基础数据管理、系统管理等功能

1
2
3
4
5
6
7
管理员				账户:admin 		密码:123456
教练 账户:a1 密码:123456
教练 账户:a2 密码:123456
教练 账户:a3 密码:123456
用户 账户:a1 密码:123456
用户 账户:a2 密码:123456
用户 账户:a3 密码:123456

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        return R.error(511,"表中有相同数据");
}
}


/**
* 后端修改
*/
@RequestMapping("/examinationUpdate")
public R examinationUpdate(@RequestBody ExampapertopicEntity exampapertopic, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,exampapertopic:{}",this.getClass().getName(),exampapertopic.toString());

String role = String.valueOf(request.getSession().getAttribute("role"));

//根据字段查询是否有相同数据
Wrapper<ExampapertopicEntity> queryWrapper = new EntityWrapper<ExampapertopicEntity>()
.notIn("id",exampapertopic.getId())
.andNew()
.eq("exampaper_id", exampapertopic.getExampaperId())
.eq("examquestion_id", exampapertopic.getExamquestionId())
.eq("exampapertopic_number", exampapertopic.getExampapertopicNumber())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ExampapertopicEntity exampapertopicEntity = exampapertopicService.selectOne(queryWrapper);
if(exampapertopicEntity==null){
ExampapertopicEntity exampapertopicEntity1 = exampapertopicService.selectById(exampapertopic.getId());
if(exampapertopic.getExampaperId() == null){
return R.error("修改时数据未获取到");
}
if(exampapertopicEntity1.getExampapertopicNumber()!=exampapertopic.getExampapertopicNumber()){
ExampaperEntity exampaperEntity = exampaperService.selectById(exampapertopic.getExampaperId());
exampaperEntity.setExampaperMyscore((exampaperEntity.getExampaperMyscore()-exampapertopicEntity1.getExampapertopicNumber())+exampapertopic.getExampapertopicNumber());
exampaperService.updateById(exampaperEntity);
}
exampapertopicService.updateById(exampapertopic);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}

/**
* 删除
*/
@RequestMapping("/examinationDelete")
public R examinationDelete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<ExampapertopicEntity> exampapertopicEntities = exampapertopicService.selectBatchIds(Arrays.asList(ids));
ExampaperEntity exampaperEntity1 = exampaperService.selectById(exampapertopicEntities.get(0).getExampaperId());
for (ExampapertopicEntity topic:exampapertopicEntities) {
exampaperEntity1.setExampaperMyscore(exampaperEntity1.getExampaperMyscore()-topic.getExampapertopicNumber());
}
exampaperService.updateById(exampaperEntity1);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("教练".equals(role))
params.put("jiaolianId",request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = examrecordService.queryPage(params);

//字典表数据转换
List<ExamrecordView> list =(List<ExamrecordView>)page.getList();
for(ExamrecordView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}

/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ExamrecordEntity examrecord = examrecordService.selectById(id);
if(examrecord !=null){
//entity转view
ExamrecordView view = new ExamrecordView();
BeanUtils.copyProperties( examrecord , view );//把实体数据重构到view中
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(examrecord.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//级联表 试卷
//级联表
ExampaperEntity exampaper = exampaperService.selectById(examrecord.getExampaperId());
if(exampaper != null){
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/**
* 重置密码
*/
@GetMapping(value = "/resetPassword")
public R resetPassword(Integer id, HttpServletRequest request) {
YonghuEntity yonghu = yonghuService.selectById(id);
yonghu.setPassword("123456");
yonghuService.updateById(yonghu);
return R.ok();
}

/**
* 修改密码
*/
@GetMapping(value = "/updatePassword")
public R updatePassword(String oldPassword, String newPassword, HttpServletRequest request) {
YonghuEntity yonghu = yonghuService.selectById((Integer)request.getSession().getAttribute("userId"));
if(newPassword == null){
return R.error("新密码不能为空") ;
}
if(!oldPassword.equals(yonghu.getPassword())){
return R.error("原密码输入错误");
}
if(newPassword.equals(yonghu.getPassword())){
return R.error("新密码不能和原密码一致") ;
}
yonghu.setPassword(newPassword);
yonghuService.updateById(yonghu);
return R.ok();
}



/**
* 忘记密码
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) {
YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));
if(yonghu!=null){
yonghu.setPassword("123456");
yonghuService.updateById(yonghu);
return R.ok();
}else{
return R.error("账号不存在");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
        //修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}

/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ExamrewrongquestionEntity examrewrongquestion = examrewrongquestionService.selectById(id);
if(examrewrongquestion !=null){
//entity转view
ExamrewrongquestionView view = new ExamrewrongquestionView();
BeanUtils.copyProperties( examrewrongquestion , view );//把实体数据重构到view中
//级联表 用户
//级联表
YonghuEntity yonghu = yonghuService.selectById(examrewrongquestion.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//级联表 试卷
//级联表
ExampaperEntity exampaper = exampaperService.selectById(examrewrongquestion.getExampaperId());
if(exampaper != null){
BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setExampaperId(exampaper.getId());
}
//级联表 试题表
//级联表
ExamquestionEntity examquestion = examquestionService.selectById(examrewrongquestion.getExamquestionId());
if(examquestion != null){
BeanUtils.copyProperties( examquestion , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setExamquestionId(examquestion.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
        return R.ok();
}



/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
List<ExamredetailsEntity> oldExamredetailsList =examredetailsService.selectBatchIds(Arrays.asList(ids));//要删除的数据
examredetailsService.deleteBatchIds(Arrays.asList(ids));

return R.ok();
}


/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName, HttpServletRequest request){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
try {
List<ExamredetailsEntity> examredetailsList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
        BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}

}

/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZiliaoLiuyanEntity ziliaoLiuyan, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,ziliaoLiuyan:{}",this.getClass().getName(),ziliaoLiuyan.toString());

String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
else if("用户".equals(role))
ziliaoLiuyan.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

ziliaoLiuyan.setCreateTime(new Date());
ziliaoLiuyan.setInsertTime(new Date());
ziliaoLiuyanService.insert(ziliaoLiuyan);

return R.ok();
}

/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZiliaoLiuyanEntity ziliaoLiuyan, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,ziliaoLiuyan:{}",this.getClass().getName(),ziliaoLiuyan.toString());
ZiliaoLiuyanEntity oldZiliaoLiuyanEntity = ziliaoLiuyanService.selectById(ziliaoLiuyan.getId());//查询原先数据

String role = String.valueOf(request.getSession().getAttribute("role"));


项目链接:
https://javayms.github.io?id=371524522608201pk
https://javayms.pages.dev?id=371524522608201pk