基于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的不要搞前后端分离项目

适用

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

功能说明

341524092608

351524092608

361524092608

371524092608

381524092608

401524092608

411524092608

421524092608

431524092608

441524092608

基于javaweb的SpringBoot智慧校园管理系统(java+springboot+maven+mybaits+vue+elementui+mysql)

项目介绍

基于Springboot + vue实现的智慧校园管理系统

系统包含学生、老师、管理员三个角色,分为前后台;

学生:登录、注册、查看计算机软件(收藏、下载、留言)、查看课程(在线观看、下载、留言)、查看音乐(收藏、播放、留言)、个人中心、我的收藏、记事本管理、备忘录管理、宿舍管理、成绩管理等

老师:登录、个人中心、计算机软件管理、计算机软件留言管理、课程管理、课程留言管理、宿舍管理、宿舍人员管理、宿舍归寝管理、宿舍报修管理、音乐管理、成绩管理等

管理员:登录、个人中心、基础数据管理、记事本管理、备忘录管理、计算机软件管理、计算机软件留言管理、课程管理、课程留言管理、宿舍管理、宿舍人员管理、宿舍归寝管理、宿舍报修管理、音乐管理、成绩管理、用户管理、轮播图管理等

技术栈

后端:SpringBoot+Mybaits

前端:Vue+elementui

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
管理员:
admin 123456

教师:
t1 123456
t2 123456
t3 123456

用户:
s1 123456
s2 123456
s3 123456


后端启动类:StartApplication
前端启动命令:npm run serve

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

// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = jisuanjizhuanyeruanjianCollectionService.queryPage(params);

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

/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
JisuanjizhuanyeruanjianCollectionEntity jisuanjizhuanyeruanjianCollection = jisuanjizhuanyeruanjianCollectionService.selectById(id);
if(jisuanjizhuanyeruanjianCollection !=null){


//entity转view
JisuanjizhuanyeruanjianCollectionView view = new JisuanjizhuanyeruanjianCollectionView();
BeanUtils.copyProperties( jisuanjizhuanyeruanjianCollection , view );//把实体数据重构到view中

//级联表
JisuanjizhuanyeruanjianEntity jisuanjizhuanyeruanjian = jisuanjizhuanyeruanjianService.selectById(jisuanjizhuanyeruanjianCollection.getJisuanjizhuanyeruanjianId());
if(jisuanjizhuanyeruanjian != null){
BeanUtils.copyProperties( jisuanjizhuanyeruanjian , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setJisuanjizhuanyeruanjianId(jisuanjizhuanyeruanjian.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(jisuanjizhuanyeruanjianCollection.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
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

//字典表数据转换
List<SusheGuiqinView> list =(List<SusheGuiqinView>)page.getList();
for(SusheGuiqinView 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);
SusheGuiqinEntity susheGuiqin = susheGuiqinService.selectById(id);
if(susheGuiqin !=null){
//entity转view
SusheGuiqinView view = new SusheGuiqinView();
BeanUtils.copyProperties( susheGuiqin , view );//把实体数据重构到view中

//级联表
YonghuEntity yonghu = yonghuService.selectById(susheGuiqin.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到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 SusheGuiqinEntity susheGuiqin, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,susheGuiqin:{}",this.getClass().getName(),susheGuiqin.toString());

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

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
		}

for(int i =0; i<legend.size(); i++){
yAxis.add(new ArrayList<String>());
}

Set<String> keys = dataMap.keySet();
for(String key:keys){
xAxis.add(key);
HashMap<String, String> map = dataMap.get(key);
for(int i =0; i<legend.size(); i++){
List<String> data = yAxis.get(i);
if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
data.add(map.get(legend.get(i)));
}else{
data.add("0");
}
}
}
System.out.println();
}

Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis",xAxis);
resultMap.put("yAxis",yAxis);
resultMap.put("legend",legend);
return R.ok().put("data", resultMap);
}

/**
* 柱状图统计
*/
@RequestMapping("/barCount")
public R barCount(@RequestParam Map<String,Object> params) {
logger.debug("barCount方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
Boolean isJoinTableFlag = false;//是否有级联表相关
String one = "";//第一优先
String two = "";//第二优先

//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
            ;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
KechengCollectionEntity kechengCollectionEntity = kechengCollectionService.selectOne(queryWrapper);
if(kechengCollectionEntity==null){
kechengCollection.setInsertTime(new Date());
kechengCollection.setCreateTime(new Date());
kechengCollectionService.insert(kechengCollection);
return R.ok();
}else {
return R.error(511,"您已经收藏过了");
}
}


}




/**
* 音乐收藏
* 后端接口
* @email
*/
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
List<Map<String, Object>> result = commonService.barSum(params);

List<String> xAxis = new ArrayList<>();//报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴
List<String> legend = new ArrayList<>();//标题

if(StringUtil.isEmpty(two)){//不包含第二列
List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0);
legend.add("数值");
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String value = String.valueOf(map.get("value"));
xAxis.add(oneValue);
yAxis0.add(value);
}
}else{//包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if(StringUtil.isNotEmpty(two)){
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value"));
if(!legend.contains(twoValue)){
legend.add(twoValue);//添加完成后 就是最全的第二列的类型
}
if(dataMap.containsKey(oneValue)){
dataMap.get(oneValue).put(twoValue,value);
}else{
HashMap<String, String> oneData = new HashMap<>();
oneData.put(twoValue,value);
dataMap.put(oneValue,oneData);
}

}
}

for(int i =0; i<legend.size(); i++){
yAxis.add(new ArrayList<String>());
}

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
                            KechengLiuyanEntity kechengLiuyanEntity = new KechengLiuyanEntity();
// kechengLiuyanEntity.setKechengId(Integer.valueOf(data.get(0))); //课程 要改的
// kechengLiuyanEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// kechengLiuyanEntity.setKechengLiuyanText(data.get(0)); //留言内容 要改的
// kechengLiuyanEntity.setInsertTime(date);//时间
// kechengLiuyanEntity.setReplyText(data.get(0)); //回复内容 要改的
// kechengLiuyanEntity.setUpdateTime(sdf.parse(data.get(0))); //回复时间 要改的
// kechengLiuyanEntity.setCreateTime(date);//时间
kechengLiuyanList.add(kechengLiuyanEntity);


//把要查询是否重复的字段放入map中
}

//查询是否重复
kechengLiuyanService.insertBatch(kechengLiuyanList);
return R.ok();
}
}
}
}catch (Exception e){
e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}





/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = kechengLiuyanService.queryPage(params);

//字典表数据转换
List<KechengLiuyanView> list =(List<KechengLiuyanView>)page.getList();
for(KechengLiuyanView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段


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