项目介绍
课程自动排课系统,该系统分两种角色:管理员与普通用户;
主要功能包括:
首页:查看分课、查看课表、查看空教室;
班级设置:添加班级、分配课程、编辑、删除课程;
教室设置:添加教室、编辑、删除;
课程设置:添加课程、编辑、删除;
教师设置:添加教师、编辑、删除;
排课管理:调整排课、删除排课;
用户管理:添加用户、编辑、删除;
环境需要
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
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
- 将项目中application.properties配置文件中的数据库配置改为自己的配置
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
- 运行项目,输入http://localhost:8080/login.html 登录
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
powerContent = powerContent + ",1400";
}
if(powerContent.indexOf("150") != -1){
powerContent = powerContent + ",1500";
}
power.setPower(powerContent);
power.setRoleid(role1.getPowerid());
powerService.update(power);
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";
return json.toJSONString(course);
}
@RequestMapping("add")
public String addCourse(Course course){
course.setId(String.valueOf(Math.random()).substring(2, 10));
System.out.println(course.toString());
courseService.insert(course);
return "redirect:/Course/queryAll";
}
}
用户管理控制层:
@Controller
@RequestMapping("/User")
public class UserController {
@Autowired
private UserService userService;
@Autowired
public String addCourse(Course course){
course.setId(String.valueOf(Math.random()).substring(2, 10));
System.out.println(course.toString());
courseService.insert(course);
return "redirect:/Course/queryAll";
}
}
用户管理控制层:
@Controller
@RequestMapping("/User")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private PowerService powerService;
User user = (User) request.getSession().getAttribute("user");
/*String type = "1";
if ("1".equals(user.getType())){
type="2";
}
course.setType(type);
course.setUserid(user.getId());*/
List<Curelation> curelationList = curelationService.queryAll(course);
List<Course> dataList = new ArrayList<>();
for (int i = 0; i < curelationList.size(); i++) {
Course curelation = courseService.selectByPrimaryKey(curelationList.get(i).getCourseid());
dataList.add(curelation);
}
JSONObject json = new JSONObject();
return json.toJSONString(dataList);
}
@RequestMapping("suggeetion")
public String suggeetion(HttpServletRequest request, Coursecomment coursecomment){
List<Coursecomment> coursecomments = coursecommentService.queryAll(coursecomment);
request.setAttribute("list",coursecomments);
return "suggeetion";
}
Curelation curelation1 = curelationList.get(0);
curelation1.setUserid(user.getId());
curelation1.setCourseid(course.getId());
System.out.println(curelation1.toString());
curelationService.updateByPrimaryKey(curelation1);
}
return "redirect:/Course/student";
}
@ResponseBody
@RequestMapping("/queryOne")
public String queryOne(String ID){
Course course = new Course();
course.setId(ID);
List<Course> list = courseService.queryAll(course);
course = list.get(0);
JSONObject json = new JSONObject();
return json.toJSONString(course);
@RequestMapping("/student")
public String student(HttpServletRequest request){
Course course = new Course();
course.setStatus("1");
List<Course> courseList = courseService.queryAll(course);
request.setAttribute("list",courseList);
return "studentChoose";
}
@RequestMapping("/upload")
public String upload(){
return "uploadScore";
}
@RequestMapping("/Export")
public void Export(HttpServletResponse response, User user){
response.setContentType("application/binary;charset=UTF-8");
try {
课程管理控制层:
@Controller
@RequestMapping("/Course")
public class CourseController {
@Autowired
private CourseService courseService;
@Autowired
private CurelationService curelationService;
@Autowired
private CoursecommentService coursecommentService;
@ResponseBody
@RequestMapping("/queryOneCom")
public String queryOneCom(String ID){
Coursecomment course = new Coursecomment();
course.setId(ID);
System.out.println("===================================="+ID);
List<Coursecomment> list = coursecommentService.queryAll(course);
course = list.get(0);
JSONObject json = new JSONObject();
return json.toJSONString(course);
}
@RequestMapping("addComment")
private RoleService depotService;
@Autowired
private PowerService powerService;
@RequestMapping("/update")
public String update(String id,String rolename,String powerContent){
Role role = new Role();
role.setRoleid(id);
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";
}
}
@RequestMapping("view")
public String view(HttpServletRequest request){
User user = (User) request.getSession().getAttribute("user");
String type = "1";
if ("1".equals(user.getType())){
type="2";
}
List<Map<String,String>> list=curelationService.courseview(type,user.getId());
request.setAttribute("list",list);
return "courseview";
}
@RequestMapping("deletecomment")
public String deletecomment(String ID){
request.setAttribute("name", user.getName());
}
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";
}
@RequestMapping("/addstudent")
public String addStudent(User user){
String passWord = "123456";
user.setPassword(passWord);
user.setType(Constans.STUDENT);
userService.insert(user);
@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());
depot.setRoleid(ID);
List<Role> list = depotService.QueryAll(depot);
Role role1 = list.get(0);
Power power1 = powerService.selectByPrimaryKey(role1.getPowerid());
String name = role1.getRolename();
role1.setPowerid(power1.getPower());
String data = json.toJSONString(role1);
return data;
}
@ResponseBody
@RequestMapping("/getAll")
public String getAll(Role role){
JSONObject json = new JSONObject();