作者主页:编程指南针
简介:Java领域优质创作者、 Java项目、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-GX-026
运行环境
jdk8+tomcat8.5+mysql+IntelliJ IDEA(或eclipse)+maven
项目技术(必填)
spring+spring mvc+mybatis+layui+jsp+echarts
本系统是一个基于ssm+layui的学籍管理系统;
本系统比较简单,适用于新手,上手简单易操作,主要是帮助理解java web (ssm框架)项目的整体运行流程,附带着也熟悉一下这种项目的搭建;
本系统具有三种用户: 1.管理员:专业管理,班级管理,学生管理,老师管理,课程管理,开课管理以及用户管理 2.教师:成绩管理,学生查询 3.学生:选课管理,查看成绩
下面展示一下系统功能截图:
老师身份登陆
学生身份登陆
以上是基于SSM实现的学籍管理系统的部分功能展示,本系统功能完整,界面美观,适合做毕业设计使用。
部分实现代码:
package com.niudada.service;
import com.github.pagehelper.PageHelper;
import com.niudada.dao.CourseDao;
import com.niudada.entity.Course;
import com.niudada.utils.BeanMapUtils;
import com.niudada.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;
import java.util.Map;@Service
public class CourseService { @Autowired
private CourseDao courseDao; //添加
public int create(Course pi) {
return courseDao.create(pi);
} //删除
public int delete(Integer id) {
return courseDao.delete(MapParameter.getInstance().addId(id).getMap());
} //批量删除
public int delete(String ids) {
int count = 0; //count表示删除的记录条数
for (String str : ids.split(",")) {
count = courseDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return count;
} //修改
public int update(Course course) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(course)).addId(course.getId()).getMap();
return courseDao.update(map);
} //查询
public List<Course> query(Course course) {
if(course != null && course.getPage() != null) {
PageHelper.startPage(course.getPage(),course.getLimit());
}
return courseDao.query(BeanMapUtils.beanToMap(course));
} //根据id查询
public Course detail(Integer id) {
return courseDao.detail(MapParameter.getInstance().addId(id).getMap());
} //查询总记录条数
public int count(Course course) {
return courseDao.count(BeanMapUtils.beanToMap(course));
}}
package com.niudada.service;
import com.github.pagehelper.PageHelper;
import com.niudada.dao.JobDao;
import com.niudada.entity.Job;
import com.niudada.utils.BeanMapUtils;
import com.niudada.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;
import java.util.Map;@Service
public class JobService { @Autowired
private JobDao jobDao; //添加
public int create(Job pi) {
return jobDao.create(pi);
} //删除
public int delete(Integer id) {
return jobDao.delete(MapParameter.getInstance().addId(id).getMap());
} //批量删除
public int delete(String ids) {
int count = 0; //count表示删除的记录条数
for (String str : ids.split(",")) {
count = jobDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return count;
} //修改
public int update(Job job) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(job)).addId(job.getId()).getMap();
return jobDao.update(map);
} //查询
public List<Job> query(Job job) {
if(job != null && job.getPage() != null) {
PageHelper.startPage(job.getPage(),job.getLimit());
}
return jobDao.query(BeanMapUtils.beanToMap(job));
} //根据id查询
public Job detail(Integer id) {
return jobDao.detail(MapParameter.getInstance().addId(id).getMap());
} //查询总记录条数
public int count(Job job) {
return jobDao.count(BeanMapUtils.beanToMap(job));
}}
package com.niudada.service;
import com.github.pagehelper.PageHelper;
import com.niudada.dao.ScoreDao;
import com.niudada.entity.Score;
import com.niudada.utils.BeanMapUtils;
import com.niudada.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.HashMap;
import java.util.List;
import java.util.Map;@Service
public class ScoreService { @Autowired
private ScoreDao scoreDao; //添加
public int create(String sectionIds,String courseIds,Integer studentId) {
//清除已有选课数据
Map<String, Object> map = MapParameter.getInstance().add("stuId", studentId).getMap();
scoreDao.delete(map);
//批量保存
int flag = 0;
String[] sectionIdArr = sectionIds.split(",");
String[] courseIdArr = courseIds.split(",");
for(int i = 0; i < sectionIdArr.length; i++) {
Score score = new Score();
score.setCourseId(Integer.parseInt(courseIdArr[i]));
score.setSectionId(Integer.parseInt(sectionIdArr[i]));
score.setStuId(studentId);
flag = scoreDao.create(score);
}
return flag;
} //批量删除
public int delete(String ids) {
int count = 0; //count表示删除的记录条数
for (String str : ids.split(",")) {
count = scoreDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return count;
} //修改
public int update(Score score) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(score)).addId(score.getId()).getMap();
return scoreDao.update(map);
} //查询
public List<Score> query(Score score) {
if(score != null && score.getPage() != null) {
PageHelper.startPage(score.getPage(),score.getLimit());
}
return scoreDao.query(BeanMapUtils.beanToMap(score));
} //根据id查询
public Score detail(Integer id) {
return scoreDao.detail(MapParameter.getInstance().addId(id).getMap());
}
//查询总记录条数
public int count(Score score) {
return scoreDao.count(BeanMapUtils.beanToMap(score));
} //老师评分,修改成绩
public int update(Integer courseId,Integer sectionId,String stuIds,String scores) { String[] stuIdArray = stuIds.split(",");
String[] scoresArray = scores.split(",");
int flag = 0;
for(int i = 0; i < stuIdArray.length; i++) {
Map<String, Object> map = MapParameter.getInstance()
.add("courseId", courseId)
.add("sectionId", sectionId)
.add("stuId", Integer.parseInt(stuIdArray[i]))
.add("updateScore", Double.parseDouble(scoresArray[i]))
.getMap();
flag = scoreDao.update(map);
}
return flag;
} //查询各科平均成绩
public List<HashMap>queryAvgScoreBySection(){
List<HashMap> mapList = scoreDao.queryAvgScoreBySection(null);
return mapList;
}
}
package com.niudada.service;
import com.github.pagehelper.PageHelper;
import com.niudada.dao.SectionDao;
import com.niudada.entity.Section;
import com.niudada.utils.BeanMapUtils;
import com.niudada.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;
import java.util.Map;@Service
public class SectionService { @Autowired
private SectionDao sectionDao; //添加
public int create(Section pi) {
return sectionDao.create(pi);
} //删除
public int delete(Integer id) {
return sectionDao.delete(MapParameter.getInstance().addId(id).getMap());
} //批量删除
public int delete(String ids) {
int count = 0;
for (String str : ids.split(",")) {
count = sectionDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return count;
} //修改
public int update(Section section) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(section)).addId(section.getId()).getMap();
return sectionDao.update(map);
} //查询
public List<Section> query(Section section) {
if(section != null && section.getPage() != null) {
PageHelper.startPage(section.getPage(),section.getLimit());
}
return sectionDao.query(BeanMapUtils.beanToMap(section));
} //根据id查询
public Section detail(Integer id) {
return sectionDao.detail(MapParameter.getInstance().addId(id).getMap());
} //查询总记录条数
public int count(Section section) {
return sectionDao.count(BeanMapUtils.beanToMap(section));
} //按照学生查询班级开课
public List<Section> queryByStudent(Integer studentId) {
return sectionDao.queryByStudent(MapParameter.getInstance().add("studentId",studentId).getMap());
}
}
package com.niudada.service;
import com.github.pagehelper.PageHelper;
import com.niudada.dao.TeacherDao;
import com.niudada.entity.Teacher;
import com.niudada.utils.BeanMapUtils;
import com.niudada.utils.MD5Utils;
import com.niudada.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;
import java.util.Map;@Service
public class TeacherService { @Autowired
private TeacherDao teacherDao; //添加
public int create(Teacher pi) {
//设置密码加密
pi.setTeacherPwd(MD5Utils.getMD5(pi.getTeacherPwd()));
return teacherDao.create(pi);
} //删除
public int delete(Integer id) {
return teacherDao.delete(MapParameter.getInstance().addId(id).getMap());
} //批量删除
public int delete(String ids) {
int count = 0;
for (String str : ids.split(",")) {
count = teacherDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return count;
} //修改
public int update(Teacher teacher) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(teacher)).addId(teacher.getId()).getMap();
return teacherDao.update(map);
} //查询
public List<Teacher> query(Teacher teacher) {
if(teacher != null && teacher.getPage() != null){
PageHelper.startPage(teacher.getPage(),teacher.getLimit());
}
return teacherDao.query(BeanMapUtils.beanToMap(teacher));
} //根据id查询
public Teacher detail(Integer id) {
return teacherDao.detail(MapParameter.getInstance().addId(id).getMap());
} //查询总记录数
public int count(Teacher teacher) {
return teacherDao.count(BeanMapUtils.beanToMap(teacher));
} //登录
public Teacher login(String userName, String password){
Map<String, Object> map = MapParameter.getInstance()
.add("teacherName", userName)
.add("teacherPwd", password)
.getMap();
return teacherDao.detail(map);
} }