基于javaweb的课程信息管理系统(java+springboot+freemarker+mysql)

基于javaweb的课程信息管理系统(java+springboot+freemarker+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220519000943

20220519000944

20220519000945

20220519000946

20220519000948

20220519000949

20220519000950

基于javaweb+SpringBoot的课程信息管理系统(java+springboot+FreeMarker+maven+mysql)

一、项目运行

环境配置:

Jdk1.8 + Tomcat8.0 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

Springboot + SpringMVC + MyBatis + FreeMarker + JavaScript + JQuery + Ajax + maven等等。

用户管理控制层:

@Controller

@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 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(){

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{

Role role = new Role();

role.setRoleid(user1.getRoleid());

List list =roleService.QueryAll(role);

role =list.get(0);

request.getSession().setAttribute(“roleName”, role.getRolename());

Power power = powerService.selectByPrimaryKey(role.getPowerid());

if(!StringUtil.isNullOrEmpty(power.getPower())){

request.getSession().setAttribute(“power”, power.getPower());

String time = DateUtil.getStringToday();

request.getSession().setAttribute(“time”, time);

request.getSession().setAttribute(“user”, user1);

mav.setViewName(“redirect:/User/Main”);

return mav;

@RequestMapping(“/updateStudent”)

public String update(User user){

userService.updateByPrimaryKey(user);

return “redirect:/User/student”;

@RequestMapping(“/updateTeacher”)

public String updatet(User user){

userService.updateByPrimaryKey(user);

return “redirect:/User/teacher”;

@RequestMapping(“/updatePa”)

public String updatePa(String userID,String password){

User user = new User();

System.out.println(userID);

User user1 = userService.selectByPrimaryKey(userID);

user1.setPassword(password);

userService.updateByPrimaryKey(user1);

return “Main”;

@RequestMapping(“/delete”)

public String delete(String ID){

userService.deleteByPrimaryKey(ID);

return “redirect:/User/queryAll”;

@RequestMapping(“/teacher”)

public String QueryAllTeacher(HttpServletRequest request,User user){

List 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());

return “teacher”;

@ResponseBody

@RequestMapping(“/jsonteacher”)

public String QueryAllTeacherjson(HttpServletRequest request,User user){

List list = userService.QueryAllTeacher(user);

JSONObject json = new JSONObject();

return json.toJSONString(list);

@RequestMapping(“/student”)

public String QueryAllStudent(HttpServletRequest request,User user){

List list = userService.QueryAllStudent(user);

request.setAttribute(“list”, list);

if(null != user.getName()){

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);

return “redirect:/User/student”;

@ResponseBody

@RequestMapping(“/queryOne”)

public String queryOne(String ID){

User user = new User();

user.setId(ID);

List 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();

request.getSession().setAttribute(“info”, “quit”);

mav.setViewName(“index”);

return mav;

排课控制层:

@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 list = coursecommentService.queryAll(course);

course = list.get(0);

JSONObject json = new JSONObject();

return json.toJSONString(course);

@RequestMapping(“addComment”)

public String addComment(HttpServletRequest request, Coursecomment coursecomment){

User user = (User) request.getSession().getAttribute(“user”);

coursecomment.setCreatetime(DateUtil.getStringToday());

coursecomment.setUserid(user.getName());

coursecomment.setId(String.valueOf(Math.random()).substring(2,10));

coursecommentService.insert(coursecomment);

return “redirect:/Course/suggeetion”;

@ResponseBody

@RequestMapping(“jsoncourse”)

public String jsoncourse(HttpServletRequest request, Curelation course){

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 curelationList = curelationService.queryAll(course);

List 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 coursecomments = coursecommentService.queryAll(coursecomment);

request.setAttribute(“list”,coursecomments);

return “suggeetion”;

@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){

coursecommentService.deleteByPrimaryKey(ID);

return “redirect:/Course/suggeetion”;

@RequestMapping(“queryAll”)

public String queryAll(HttpServletRequest request, Course course){

List list = courseService.queryAll(course);

request.setAttribute(“list”,list);

return “course”;

@RequestMapping(“/receive”)

public String receive(HttpServletRequest request, HttpServletResponse response, MultipartFile file){

try {

//也可以用request获取上传文件

//MultipartFile fileFile = request.getFile(“file”); //这里是页面的name属性

//转换成输入流

InputStream is = file.getInputStream();

//得到excel

Workbook workbook = Workbook.getWorkbook(is);

//得到sheet

Sheet sheet = workbook.getSheet(0);

//得到列数

int colsNum = sheet.getColumns();

//得到行数

int rowsNum = sheet.getRows();

//单元格

Cell cell;

Cell cell1;

List list = new ArrayList<>();

Map<Integer, String> map = new HashMap<Integer, String>();

for (int i = 1; i < rowsNum; i++) {//我的excel第一行是标题,所以 i从1开始

cell = sheet.getCell(0,i);

cell1 = sheet.getCell(5,i);

Curelation curelation = new Curelation();

curelation.setId(cell.getContents());

curelation.setScore(cell1.getContents());

curelationService.updateByPrimaryKey(curelation);

} catch (IOException e) {

e.printStackTrace();

} catch (BiffException e) {

e.printStackTrace();

return “redirect:/Course/queryCourse”;

@RequestMapping(“/queryCourse”)

public String queryScore(HttpServletRequest request,Curelation curelation){

curelation.setType(“1”);

List list = curelationService.queryAll(curelation);

request.setAttribute(“list”,list );

return “ScoreList”;

@RequestMapping(“/teacher”)

public String teacher(HttpServletRequest request){

User user = (User) request.getSession().getAttribute(“user”);

Course course = new Course();

course.setCourseteacher(user.getName());

List courseList = courseService.queryAll(course);

request.setAttribute(“list”,courseList);

return “teacherDeal”;

@RequestMapping(“/student”)

public String student(HttpServletRequest request){

Course course = new Course();

course.setStatus(“1”);

List 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 {

ServletOutputStream out = response.getOutputStream();

String fileName1 = “学生信息”;

String fileName2 = new SimpleDateFormat(“yyyy-MM-dd hh:mm:ss”).format(new Date());

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());

curelation1.setUserid(user.getId());

List curelationList = curelationService.queryAll(curelation1);

if(curelationList.size()==0){

Curelation curelation = new Curelation();

curelation.setUserid(user.getId());

curelation.setCourseid(course.getId());

curelation.setId(String.valueOf(Math.random()).substring(2, 10));

curelation.setType(“2”);

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 curelationList = curelationService.queryAll(curelation);

if(curelationList.size() == 0){

curelation.setId(String.valueOf(Math.random()).substring(2, 10));

curelation.setType(“1”);

curelationService.insert(curelation);

}else{

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 list = courseService.queryAll(course);

course = list.get(0);

JSONObject json = new JSONObject();

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(“/Notice”)

public class NoticeController {

@Autowired

private NoticeService noticeService;

@RequestMapping(“/add”)

public String toAdd(){

return “NoticeAdd”;

@RequestMapping(“/modify”)

public String modify(HttpServletRequest request,Notice notice){

List noticeList = noticeService.queryAll(notice);

request.setAttribute(“list”,noticeList);

return “noticeModfiy”;

@RequestMapping(“/update”)

public String update(HttpServletRequest request,Notice notice){

User user = (User) request.getSession().getAttribute(“user”);

notice.setUserid(user.getId());

notice.setCreatdate(DateUtil.getStringToday());

noticeService.update(notice);

return “redirect:/Notice/modify”;

@RequestMapping(“/delete”)

public String delete(HttpServletRequest request,Notice notice){

List noticeList = noticeService.queryAll(notice);

request.setAttribute(“list”,noticeList);

return “noticeDelete”;

@RequestMapping(“/delete1”)

public String delete1(String ID){

noticeService.delete(ID);

return “redirect:/Notice/delete”;

@ResponseBody

@RequestMapping(“/queryOne”)

public String queryOne(String id){

System.out.println(“==================”+id);

Notice notice = new Notice();

notice.setId(id);

List noticeList = noticeService.queryAll(notice);

JSONObject json = new JSONObject();

return json.toJSONString(noticeList.get(0));

@RequestMapping(“/add1”)

public String add(HttpServletRequest request,String Content,String biaoti) throws Exception{

User user = (User) request.getSession().getAttribute(“user”);

Notice notice = new Notice();

notice.setContent(Content);

notice.setTitle(biaoti);

notice.setCreatdate(DateUtil.Date2String(new Date()));

notice.setId(String.valueOf(Math.random()).substring(2, 8));

notice.setUserid(user.getId());

noticeService.add(notice);

return “redirect:/User/Main”;

角色控制层:

@Controller

@RequestMapping(“/Role”)

public class RoleController {

@Autowired

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 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){

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 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);

power1.setId(String.valueOf(Math.random()).substring(2, 8));

powerService.insert(power1);

depotService.insert(role);

return “redirect:/Role/queryAll”;

@ResponseBody

@RequestMapping(“/queryOne”)

public String queryOne(String ID){

JSONObject json = new JSONObject();

Role depot = new Role();

Power power = new Power();

power.setId(ID);

System.out.println(ID);

depot.setRoleid(ID);

List 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();

List list = depotService.QueryAll(role);

String jsonq = json.toJSONString(list);

System.out.println(jsonq);

return jsonq;


  • 1
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
学生选课管理系统 --意义-- 学生选课系统是一个学校不可缺少的部分,它的内容对于学校的决策者和管 理者来说都至关重要,所以学生选课系统应该能够为用户提供充足的信息和快捷 的查询手段。但一直以来人们使用传统人工的方式管理文件档案,这种管理方式 存在着许多缺点,如:效率低、保密性差,另外时间一长,将产生大量的文件和数据, 这对于查找、更新和维护都带来了不少的困难。 随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深 刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。 作为计算机应用的一部分,使用计算机对选课信息进行管理,有着手工管理 所无法比拟的优点.例如:检索迅速、查找方便、可靠性高、 存储量大、保密性好、 寿命长、成本低等。这些优点能够极大地提高人事劳资管理的效率,也是企业的 科学化、正规化管理,与世界接轨的重要条件。 --课题的可行性分析-- (1) 技术可行性-----本系统仅需要一台装有 Windows/Linux 系统并装有 Mysql数据库和Tomcat服务器的计算机即可,对机器本身没有太高的要求,一般当前学校或个人电脑完全可满足要求。对于软件技术要求,现在的JAVA程序设计语言已非常成熟,本系统采用基于B/S 架构的JavaEE的WEB开发,页面采用CSS样式,Jsp,Javascript等页面技术。 (2) 经济可行性-----由于本系统是一个基于JavaEE的WEB应用,所以服务器端只需部署一台能运行JAVA程序的服务器软件(Tomcat),即可使用本系统,系统成本主要集中在系统软件的开发上,当系统投入运行后可以为学校节约大量的人力,物力。所带来的效益远远大于系统软件的开发成本。在经济上完全可行。 (3) 操作可行性-----界面设计时充分考虑管理人员的习惯,使得操作简单;数据录入迅速、规范、可靠;统计准确;适应力强;容易扩充。 --使用功能模块说明-- (1)登录模块 通过列表框可以分别选择学生、教师和管理员三种用户类型,根据不同的用户类型,登录后会进入不同的管理模块 (2)系统管理员模块 ● 选课时间设置 系统管理员通过此项功能设置选课时间段—预选时间段和补选时间段,只有在选课时间段里,学生才可以选择课程,不在此时间段,学生不能进行选课操作。 ● 选修课程管理 管理员可以进行添加新的选修课、删除选修课、修改选修课和查找选修课等操作 添加新的选修课 在选课之前,管理员可以添加新的选修课,让学生在选课期间进行选修 删除选修课 在选课之前,管理员可以取消某门选修课 修改选修课 在选课之前,管理员可以修改某门选修课的信息 查找选修课 可以根据教师的员工号精确查找该教师所代选修课,也可以根据教师名称和课程名模糊查询选修课,不输入查询条件可以查询所有选修课。针对查询出的某门选修课,可以查看代课老师的信息和选修该课程的所有学生信息。在查看学生信息页面可以修改学生的课程成绩 ● 密码管理 可以对学生、教师和管理员的密码进行修改,通过单选框确定要修改密码的用户类型 (3)教师模块 ● 查看所代课程 教师用户登陆系统后,可以查看所代课程的列表,可以查看某门课程的全体学生的信息并能录入学生的成绩,成绩可分批录入,录入后可显示提交按钮,进行学生成绩的提交,提交之前必须确认填写的学生成绩无误,否则提交之后教师就无法修改学生的成绩,必须通过管理员进行修改学生的成绩 ● 修改密码 教师可以修改自己的密码 (4)学生选课模块 ● 选择选修课程 学生登陆系统后,在所有选修课程中可以选择两门选修课。只有在选课时间段内才可以使用该功能。在预选阶段,该功能完成选修课程的预选,学生可以选择所有选修课程,预选结束之后,系统开始正选。对超过XX课程计划招生人数的课程,系统自动进行抽签,确定哪些学生选课成功,哪些学生选课没有成功。选课不成功的可以进行补选。在补选阶段,该功能完成选修课程的补选,补选采用竞争机制,系统会罗列出所有未满的课程,让学生进行补选。 ● 查看学分 本功能完成学生对以前选修课程的成绩和所获学分的查看 ● 修改密码 学生可以修改自己的密码 ● 查看已选课程 选课开始之后,学生可以通过查看已选课程,了解本学期所选的选修课的信息

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值