项目介绍
课程自动排课系统,该系统分两种角色:管理员与普通用户;
主要功能包括:
首页:查看分课、查看课表、查看空教室;
班级设置:添加班级、分配课程、编辑、删除课程;
教室设置:添加教室、编辑、删除;
课程设置:添加课程、编辑、删除;
教师设置:添加教师、编辑、删除;
排课管理:调整排课、删除排课;
用户管理:添加用户、编辑、删除;
环境需要
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 8.0版本;
7.Redis数据库,redis配置已设置好,勿修改;
技术栈
后端:Springboot+redis
前端:html+layui+thymeleaf
使用说明
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
courseService.updateByPrimaryKey(course);
return "redirect:/Course/queryAll";
}
@Transactional
@RequestMapping("update1")
public String update1(HttpServletRequest request,Course course){
course.setStatus("1");
courseService.updateByPrimaryKey(course);
User user = (User) request.getSession().getAttribute("user");
Curelation curelation1 = new Curelation();
curelation1.setCourseid(course.getId());
curelation1.setUserid(user.getId());
List<Curelation> curelationList = curelationService.queryAll(curelation1);
return "redirect:/Role/queryAll";
}
@RequestMapping("/delete")
public String delete(String ID){
depotService.deleteByPrimaryKey(ID);
return "redirect:/Role/queryAll";
}
@RequestMapping("/queryAll")
public String queryAll(HttpServletRequest request,Role role){
List<Role> list = depotService.QueryAll(role);
request.setAttribute("list", list);
if(null != role.getRolename()){
request.setAttribute("rolename", role.getRolename());
}
return "Role";
}
@RequestMapping("/add")
public String add(String roleid,String rolename,String powerContent){
Power power1 = new Power();
Role role = new Role();
String powerid = String.valueOf(Math.random()).substring(2, 8);
role.setRoleid(String.valueOf(Math.random()).substring(2, 6));
role.setPowerid(powerid);
role.setRolename(rolename);
power1.setPower(powerContent);
power1.setRoleid(powerid);
role.setRolename(rolename);
depotService.update(role);
List<Role> list = depotService.QueryAll(role);
Role role1 = list.get(0);
Power power = new Power();
if(powerContent.indexOf("110") != -1){
powerContent = powerContent + ",1100";
}
if(powerContent.indexOf("120") != -1){
powerContent = powerContent + ",1200";
}
if(powerContent.indexOf("130") != -1){
powerContent = powerContent + ",1300";
}
if(powerContent.indexOf("140") != -1){
powerContent = powerContent + ",1400";
}
if(powerContent.indexOf("150") != -1){
@RequestMapping("/addstudent")
public String addStudent(User user){
String passWord = "123456";
user.setPassword(passWord);
user.setType(Constans.STUDENT);
userService.insert(user);
return "redirect:/User/student";
}
@ResponseBody
@RequestMapping("/queryOne")
public String queryOne(String ID){
User user = new User();
user.setId(ID);
List<User> list = userService.QueryAll(user);
user = list.get(0);
JSONObject json = new JSONObject();
String data = json.toJSONString(user);
return data;
}
@RequestMapping("/quit")
public ModelAndView quit(HttpServletRequest request) throws Exception{
ModelAndView mav = new ModelAndView();
HttpSession session1 = request.getSession();
session1.invalidate();
@RequestMapping("/User")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private PowerService powerService;
@Autowired
private RoleService roleService;
@Autowired
private NoticeService noticeService;
@RequestMapping("/Main")
public String res(HttpServletRequest request){
String time = DateUtil.getStringToday();
request.getSession().setAttribute("time", time);
Notice notice = new Notice();
List<Notice> list = noticeService.queryAll(notice);
notice = list.get(0);
User user = userService.selectByPrimaryKey(notice.getUserid());
notice.setUserid(user.getName());
request.getSession().setAttribute("notice", notice);
return "Main";
request.getSession().setAttribute("notice", notice);
return "Main";
}
@RequestMapping("/changePa")
public String res1(){
return "changePass";
}
@RequestMapping("/Login")
public ModelAndView login(HttpServletRequest request,String id,String password) throws Exception{
ModelAndView mav = new ModelAndView();
User user1 = userService.selectByPrimaryKey(id);
if(user1 == null || !password.equals(user1.getPassword())){
mav.setViewName("index");
request.getSession().setAttribute("info", "error");
return mav;
}else{
curelationService.insert(curelation);
}
return "redirect:/Course/teacher";
}
@RequestMapping("update2")
public String update2(HttpServletRequest request,Course course){
User user = (User) request.getSession().getAttribute("user");
Curelation curelation = new Curelation();
curelation.setUserid(user.getId());
curelation.setCourseid(course.getId());
List<Curelation> curelationList = curelationService.queryAll(curelation);
if(curelationList.size() == 0){
curelation.setId(String.valueOf(Math.random()).substring(2, 10));
@RequestMapping("/User")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private PowerService powerService;
@Autowired
private RoleService roleService;
@Autowired
private NoticeService noticeService;
@RequestMapping("/Main")
public String res(HttpServletRequest request){
String time = DateUtil.getStringToday();
request.getSession().setAttribute("time", time);
Notice notice = new Notice();
List<Notice> list = noticeService.queryAll(notice);
notice = list.get(0);
User user = userService.selectByPrimaryKey(notice.getUserid());
notice.setUserid(user.getName());
request.getSession().setAttribute("notice", notice);
return "Main";
}
@RequestMapping("/changePa")
public String res1(){
String fileName = fileName1+fileName2;
response.setHeader("Content-disposition", "attachment; filename=" +new String(fileName.getBytes("gbk"),"iso8859-1") + ".xls");
String[] titles = { "成绩编号","学生编号", "学生姓名", "课程编号", "课程名称", "成绩" };
courseService.export(titles, out,user);
} catch (Exception e) {
e.printStackTrace();
}
}
@RequestMapping("delete")
public String delete(String ID){
courseService.deleteByPrimaryKey(ID);
return "redirect:/Course/queryAll";
}
@RequestMapping("update")
public String update(Course course){
courseService.updateByPrimaryKey(course);
return "redirect:/Course/queryAll";
}
@Transactional
@RequestMapping("update1")
public String update1(HttpServletRequest request,Course course){
course.setStatus("1");
courseService.updateByPrimaryKey(course);
User user = (User) request.getSession().getAttribute("user");
Curelation curelation1 = new Curelation();
curelation1.setCourseid(course.getId());
public String delete(String ID){
userService.deleteByPrimaryKey(ID);
return "redirect:/User/queryAll";
}
@RequestMapping("/teacher")
public String QueryAllTeacher(HttpServletRequest request,User user){
List<User> list = userService.QueryAllTeacher(user);
request.setAttribute("list", list);
if(null != user.getName()){
request.setAttribute("name", user.getName());
}
if(null != user.getMobile()){
request.setAttribute("mobile", user.getMobile());
}
if(null != user.getMobile()){
request.setAttribute("mobile", user.getMobile());
}
return "student";
}
@RequestMapping("/addteacher")
public String addUser(User user){
String passWord = "123456";
user.setPassword(passWord);
user.setType(Constans.TEACHER);
userService.insert(user);
return "redirect:/User/teacher";
}