源码获取:俺的博客首页 "资源" 里下载!
项目介绍
该系统主要分为前台和后台两大功能模块,共包含三个角色:管理员、教师、学生。
具体的系统功能如下:
1.前台功能
前台为学生与教师登录,主要功能包含如下:
前台首页、教师介绍、提问老师、课程信息、选课、课程大纲、课程教学、教学参考、课程公告、试卷列表、在线考试、错题记录等功能。
2.后台功能
后台为管理员、学生与教师登录,主要功能包含如下:
后台系统登陆、选课信息管理、课程作业管理、作业提交管理、作业批改管理、学生提问管理、教师回答管理、考试管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、MyBatis
UI界面:JSP、jQuery、vue、echarts
数据库:MySQL
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置;
3. 将项目中config.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入
前台访问地址:http://localhost:8080/jspm5842r/front/
教师:教师工号1 密码:123456
学生:学生账号1 密码:123456
后台访问地址:http://localhost:8080/jspm5842r/jsp/login.jsp
管理员:admin 密码:admin
教师:教师工号1 密码:123456
学生:学生账号1 密码:123456
学生管理控制层:
@Controller
@RequestMapping("/easStudent")
public class EasStudentController {
@Autowired
private EasStudentService easStudentService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/student/index";
}
@RequestMapping("/list")
@ResponseBody
public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasStudent easStudent) throws Exception{
Map<String, Object> map = new HashMap<>();
// System.out.println("我是:" + easStudent.getClass_id());
Page<EasStudent> pager = PageHelper.startPage(page,limit);
// List<EasStudent> list = easStudentService.getList(easStudent);
List<EasStudent> list = easStudentService.findList(easStudent);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasStudent e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// System.out.println(e.getClass_id());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
}
教师管理控制层:
@Controller
@RequestMapping("/easTeacher")
public class EasTeacherController {
@Autowired
private EasTeacherService easTeacherService;
@RequestMapping("/index")
public String index() throws Exception{
return "system/teacher/index";
}
@RequestMapping("/list")
@ResponseBody
public Map<String, Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasTeacher easTeacher) throws Exception{
Map<String, Object> map = new HashMap<>();
// 分页不能用待修改。。。
Page<EasTeacher> pager = PageHelper.startPage(page,limit);
// List<EasTeacher> list = easTeacherService.getList(easTeacher);
List<EasTeacher> list = easTeacherService.findTeacherList(easTeacher);
// System.out.println("获取信息总条数为:" + list.size());
// for (EasTeacher e:list
// ) {
// System.out.println(e.getUser().getUsername());
// System.out.println(e.getName());
// }
map.put("count",pager.getTotal());
map.put("data",list);
map.put("code",0);
map.put("msg","");
return map;
}
@RequestMapping("/search")
@ResponseBody
public List<EasTeacher> search() throws Exception{
return easTeacherService.getAll();
}
}
角色管理控制层:
@Controller
@RequestMapping("/easRole")
public class EasRoleController {
@Autowired
private EasRoleMapper easRoleMapper;
@RequestMapping("/search")
@ResponseBody
public List<EasRole> search() throws Exception{
return easRoleMapper.getAll();
}
@RequestMapping("/index")
@RequiresPermissions("role:query")
public String index() throws Exception{
return "system/role/index";
}
@RequestMapping("/rolePers")
@ResponseBody
public List<Long> rolePers(Integer id) throws Exception {
return easRoleMapper.getPerIdsByRoleId(id);
}
@RequestMapping("/assignPers")
@ResponseBody
public Map<String,Object> assignPers(Integer roleId, String persIds) throws Exception{
Map<String,Object> map = new HashMap<>();
easRoleMapper.deleteRolePermissions(roleId);
easRoleMapper.addRolePermissions(roleId,persIds.split(","));
return map;
}
@RequestMapping("/list")
@ResponseBody
public Map<String,Object> list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
EasRole easRole) throws Exception {
Map<String,Object> map = new HashMap<>();
int count = easRoleMapper.getCount();
PageUtil pageUtil = new PageUtil(page,limit);
map.put("code",0);
map.put("msg",null);
map.put("data",easRoleMapper.getList(easRole,pageUtil));
map.put("count",count);
return map;
}
@RequestMapping("/roleForm")
public String roleForm() throws Exception {
return "system/role/roleForm";
}
@RequestMapping(value = "/addRole",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addRole(EasRole easRole) throws Exception{
Map<String,Object> map = new HashMap<>();
// System.out.println("角色名称:"+easRole.getName());
// System.out.println("角色是否可用:"+easRole.getAvailable());
List<EasRole> list = easRoleMapper.findRoleName(easRole.getName());
if (list.size() != 0){
map.put("msg","角色已存在");
map.put("result",false);
}else if(easRole.getName().length() <= 0){
map.put("msg","角色名称不能为空");
map.put("result",false);
}else{
//课程为null也可以添加 待完善
easRoleMapper.addRole(easRole);
map.put("msg","添加成功");
map.put("result",true);
}
return map;
}
@RequestMapping("/batchDeleteRole")
@ResponseBody
@RequiresPermissions("role:delete")
public Map<String, Object> batchDeleteRole(Integer[] ids) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
easRoleMapper.batchDeleteRole(ids);
map.put("msg","删除成功");
map.put("result",true);
return map;
}
@RequestMapping(value = "/getRoleView")
@ResponseBody
public EasRole getRoleView(Integer id) throws Exception {
return easRoleMapper.getRoleView(id);
}
@RequestMapping(value = "/editRole",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> editRole(EasRole easRole) throws Exception{
Map<String, Object> map = new HashMap<>();
easRoleMapper.updateBaseCourse(easRole);
map.put("result",true);
return map;
}
}
源码获取:俺的博客首页 "资源" 里下载!