基于javaweb+mysql的ssm在线学习平台(java+ssm+jsp+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM在线学习平台(java+ssm+jsp+mysql)
项目配置:
1.使用MySQL图形化工具新建数据库,运行sql文件。完成数据库建立。
2.使用MyEclipse或Eclipse导入项目,配置jar包。保证项目是web工程,并且添加需要的依赖。
3.将项目部署到tomcat服务器上,在浏览器里面访问项目。
技术框架: SSM(SpringMVC + Spring + Mybatis)
开发一个在线学习平台,一共3个身份:管理员,老师和学生!
①管理员功能:登录后可以添加学生信息,管理所有学生信息,添加单个老师信息,也可以批量导入很多老师信息,管理所有老师信息,添加和管理学院信息,发布课程信息,管理所有课程,查看回复话题讨论信息,发布网站公告,管理网站公告信息!
②教师功能:上传课程视频信息,查询管理所有教学视频,上课课程文档课件信息,查询管理所有课件文档,新增讨论话题信息,查询编辑管理所有话题信息,按照课程发布作业信息,可以向某次作业中加入题目信息,也可以删除题目信息,每个题目带有分数值,老师可以修改个人信息。
③学生功能:查询所有课程信息,在线课程视频信息查询,可以在线观看某个视频教学,查询和下载所有的课件文件,查看所有话题讨论信息,可以回复话题,也可以查看话题的回复信息,可以查询网站公告信息,查询老师布置的作业,进入作业题目列表做题,提交可以查看完成作业的分数,可以修改个人信息。
开发软件: MyEclipse + JDK8.0以上 + Tomcat8.0 + MySQL5.7以上
管理员:
admin 123456
教师:
tech0001 123456
tech0002 123456
tech0003 123456
tech0004 123456
tech0005 123456
tech0006 123456
tech0007 123456
tech0008 123456
tech0009 123456
tech0010 123456
tech0011 123456
tech0012 123456
tech0013 123456
tech0014 123456
tech0015 123456
tech0016 123456
tech0017 123456
tech0018 123456
tech0019 123456
tech0020 123456
学生:
201440410235 123456
201540260117 123456
201540410101 123456
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
public void clear() {
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table admin
*
* @mbg.generated do_not_delete_during_merge Sun Apr 01 18:01:55 CST 2018
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table admin
*
* @mbg.generated Sun Apr 01 18:01:55 CST 2018
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
public class DiscussExample {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table discuss
* @mbg.generated Thu Mar 29 20:41:35 CST 2018
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
String fileDir = "C://upload/learn/" + fileName;
multipartFile.transferTo(new File(fileDir));
CourseFile collegeFile = new CourseFile();
collegeFile.setTeacherId(teacher.getId());
collegeFile.setCourseId(id);
collegeFile.setPath(fileName);
collegeFile.setRecordTime(new Date());
indexService.saveCollegeFile(collegeFile);
return new ModelAndView("redirect:/createCollegeVideo.html");
}
@RequestMapping("/deleteCollegeFile/{id}")
public ModelAndView deleteCollegeFile(@PathVariable("id") Integer id) {
indexService.deleteCollegeFile(id);
return new ModelAndView("redirect:/searchCollegeFile.html");
}
@RequestMapping("/searchCollegeFile")
public ModelAndView searchCollegeFile(HttpSession session) {
Teacher teacher = (Teacher) session.getAttribute("user");
ModelAndView mav = new ModelAndView();
mav.addObject("files", indexService.searchCollegeFile(teacher.getId()));
mav.setViewName("searchCollegeFile");
return mav;
}
@RequestMapping("/createDiscuss")
public ModelAndView createDiscuss() {
ModelAndView mav = new ModelAndView();
mav.addObject("courses", indexService.searchCourse());
mav.setViewName("createDiscuss");
return mav;
}
@RequestMapping("/saveDiscuss")
public ModelAndView saveDiscuss(Discuss discuss, HttpSession session) {
Teacher teacher = (Teacher) session.getAttribute("user");
discuss.setRecordTime(new Date());
discuss.setTeacherId(teacher.getId());
indexService.saveDiscuss(discuss);
return new ModelAndView("redirect:/createDiscuss.html");
}
@RequestMapping("/searchDiscuss")
public ModelAndView searchDiscuss() {
ModelAndView mav = new ModelAndView();
mav.addObject("discusses", indexService.searchDiscuss());
mav.setViewName("searchDiscuss");
*
* @return the value of teacher.college_id
*
* @mbg.generated Wed Mar 28 22:55:02 CST 2018
*/
public Integer getCollegeId() {
return collegeId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column teacher.college_id
*
* @param collegeId the value for teacher.college_id
*
* @mbg.generated Wed Mar 28 22:55:02 CST 2018
*/
public void setCollegeId(Integer collegeId) {
this.collegeId = collegeId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column teacher.telphone
*
* @return the value of teacher.telphone
*
* @mbg.generated Wed Mar 28 22:55:02 CST 2018
*/
public String getTelphone() {
return telphone;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column teacher.telphone
*
* @param telphone the value for teacher.telphone
*
* @mbg.generated Wed Mar 28 22:55:02 CST 2018
*/
public void setTelphone(String telphone) {
this.telphone = telphone;
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
* This class corresponds to the database table college
*
* @mbg.generated do_not_delete_during_merge Wed Mar 28 16:22:06 CST 2018
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
}
@Service("index")
for (TaskQuestion question : questions) {
if (question.getId() == model.getId()) {
if (question.getAnswer().equals(model.getAnswer())) {
score = score + question.getScore();
}
}
}
}
Student student = (Student) session.getAttribute("user");
StudentTask studentTask = new StudentTask();
studentTask.setRecordTime(new Date());
studentTask.setScore(score);
studentTask.setStudentId(student.getId());
studentTask.setTaskId(taskId);
indexService.saveStudentTask(studentTask);
return new ModelAndView("redirect:/searchStudentTaskInfo.html");
}
@RequestMapping("/searchStudentTaskInfo")
public ModelAndView searchStudentTaskInfo(HttpSession session) {
Student student = (Student) session.getAttribute("user");
ModelAndView mav = new ModelAndView();
mav.addObject("tasks", indexService.searchStudentTaskByStuId(student.getId()));
mav.setViewName("searchStudentTaskInfo");
return mav;
}
@RequestMapping("logout")
public ModelAndView logout(HttpSession session) {
session.setAttribute("user", null);
return new ModelAndView("redirect:/logon.html");
}
@RequestMapping("/teacherDataImport")
public ModelAndView teacherDataImport(@RequestParam("file") MultipartFile file) {
Teacher teacher = new Teacher();
int totalRows;
int totalCells;
List<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
// IO流读取文件
InputStream input = null;
HSSFWorkbook wb = null;
ArrayList<String> rowList = null;
try {
input = file.getInputStream();
// 创建文档
@Controller
public class IndexController {
@Resource
private IndexService indexService;
@RequestMapping("/index")
public ModelAndView index() {
ModelAndView mav = new ModelAndView();
mav.setViewName("index");
return mav;
}
@RequestMapping("/logon")
public ModelAndView logon() {
ModelAndView mav = new ModelAndView();
mav.addObject("info", "请登录");
mav.setViewName("logon");
return mav;
}
@RequestMapping("/register")
public ModelAndView register() {
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table student
*
* @mbg.generated Wed Mar 28 21:14:50 CST 2018
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table student
*
* @mbg.generated Wed Mar 28 21:14:50 CST 2018
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table student
*
* @mbg.generated Wed Mar 28 21:14:50 CST 2018
*/
public StudentExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table student
*
* @mbg.generated Wed Mar 28 21:14:50 CST 2018
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table student
*
* @mbg.generated Wed Mar 28 21:14:50 CST 2018
*/
addCriterion("college_id >", value, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdGreaterThanOrEqualTo(Integer value) {
addCriterion("college_id >=", value, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdLessThan(Integer value) {
addCriterion("college_id <", value, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdLessThanOrEqualTo(Integer value) {
addCriterion("college_id <=", value, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdIn(List<Integer> values) {
addCriterion("college_id in", values, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdNotIn(List<Integer> values) {
addCriterion("college_id not in", values, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdBetween(Integer value1, Integer value2) {
addCriterion("college_id between", value1, value2, "collegeId");
return (Criteria) this;
}
public Criteria andCollegeIdNotBetween(Integer value1, Integer value2) {
addCriterion("college_id not between", value1, value2, "collegeId");
return (Criteria) this;
}
public Criteria andTelphoneIsNull() {
addCriterion("telphone is null");
return (Criteria) this;
}
public Criteria andTelphoneIsNotNull() {
addCriterion("telphone is not null");
return (Criteria) this;
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table notice
*
* @mbg.generated Thu Mar 29 14:57:15 CST 2018
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table notice
*
* @mbg.generated Thu Mar 29 14:57:15 CST 2018
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table notice
*
* @mbg.generated Thu Mar 29 14:57:15 CST 2018
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table notice
*
* @mbg.generated Thu Mar 29 14:57:15 CST 2018
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
@Service("index")
public class IndexService {
@Resource
private CollegeMapper collegeMapper;
@Resource
private StudentMapper studentMapper;
@Resource
private TeacherMapper teacherMapper;
@Resource
private CourseMapper courseMapper;
@Resource
private NoticeMapper noticeMapper;
addCriterion("record_time >=", value, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeLessThan(Date value) {
addCriterion("record_time <", value, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeLessThanOrEqualTo(Date value) {
addCriterion("record_time <=", value, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeIn(List<Date> values) {
addCriterion("record_time in", values, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeNotIn(List<Date> values) {
addCriterion("record_time not in", values, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeBetween(Date value1, Date value2) {
addCriterion("record_time between", value1, value2, "recordTime");
return (Criteria) this;
}
public Criteria andRecordTimeNotBetween(Date value1, Date value2) {
addCriterion("record_time not between", value1, value2, "recordTime");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table student_task
*
* @mbg.generated do_not_delete_during_merge Sat Mar 31 20:18:35 CST 2018
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
<li role="presentation"><a href="javascript:void();" id="wk-menu-panel-item-createCollegeFile" class="wk-main-menu-item">上传课程文件</a></li>
<li role="presentation"><a href="javascript:void();" id="wk-menu-panel-item-searchCollegeVideo" class="wk-main-menu-item">课程视频查询</a></li>
<li role="presentation"><a href="javascript:void();" id="wk-menu-panel-item-searchCollegeFile" class="wk-main-menu-item">课程文件查询</a></li>
<li role="presentation"><a href="javascript:void();" id="wk-menu-panel-item-searchTask" class="wk-main-menu-item">作业信息查询</a></li>
<li role="presentation"><a href="<%=basePath%>logout.html" class="wk-main-menu-item">注销登录</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-lg-2" id="wk-menu-panel" style="width: 15%;">
<div class="row">
<div class="col-lg-12">
<div class="panel-group wk-accordion-panel-group" id="accordion">
<div class="panel panel-info wk-accordion-header">
<div class="panel-heading">
<a data-toggle="collapse" href="#BMenu" data-parent="#accordion">课程文件管理</a>
</div>
<div id="BMenu" class="panel-collapse collapse">
<div class="list-group wk-accordion-list-group">
<button type="button" class="list-group-item" id="wk-menu-panel-item-createCollegeVideo"> > 上传课程视频</button>
<button type="button" class="list-group-item" id="wk-menu-panel-item-searchCollegeVideo"> > 查询课程视频</button>
<button type="button" class="list-group-item" id="wk-menu-panel-item-createCollegeFile"> > 上传课程文档</button>
<button type="button" class="list-group-item" id="wk-menu-panel-item-searchCollegeFile"> > 查询课程文档</button>
</div>
</div>
</div>
<div class="panel panel-info wk-accordion-header">
<div class="panel-heading">
<a data-toggle="collapse" href="#CMenu" data-parent="#accordion">讨论管理</a>
</div>
<div id="CMenu" class="panel-collapse collapse">
<div class="list-group wk-accordion-list-group">
<button type="button" class="list-group-item" id="wk-menu-panel-item-createDiscuss"> > 新增讨论</button>
<button type="button" class="list-group-item" id="wk-menu-panel-item-searchDiscuss"> > 讨论信息查询</button>
</div>
</div>