Java 实战项目基于遗传算法学校排课系统的实现流程

 更新时间:2021年11月17日 08:50:44   作者:OldWinePot  
读万卷书不如行万里路,只学书上的理论是远远不够的,只有在实战中才能获得能力的提升,本篇文章手把手带你用java+Springboot+Maven+mybatis+Vue+Mysql实现一个基于遗传算法的学校排课系统,大家可以在过程中查缺补漏,提升水平

一、项目简述

本系统功能包括:
排课管理,课程管理,讲师管理,班级管理,学生管理,教学资料,学习文档,在线测试,教材列表,教学设计,帮助中心等等功能。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等。

管理员控制器:

/**
 * 管理员控制器
 */
@RestController
public class AdminController {
 
    @Resource(name = "adminService")
    private IAdminService adminService;
 
    /**
     * 管理员 查询管理员列表
     */
    @RequestMapping(value = "/admin/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public ListResult<Admin> qryPage(HttpRequest request) {
        Map<String, Object> param = new HashMap<>();
        int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
        int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
        if (request.containsKey("login_name")) {
            param.put("login_name", request.getString("login_name"));
        }
        if (request.containsKey("name")) {
            param.put("name", request.getString("name"));
        }
        return adminService.qryPage(param, pageNo, pageSize);
    }
 
    /**
     * 管理员 添加管理员
     */
    @RequestMapping(value = "/admin/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> insert(HttpRequest request) {
        Admin admin = new Admin();
        admin.setLoginName(request.getString("login_name"));
        admin.setName(request.getString("admin_name"));
        admin.setPwd(request.getString("login_name"));
        admin.setSex(request.getInteger("sex"));
        admin.setUpdateTime(new Date());
        return adminService.insert(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
    }
 
    /**
     * 管理员 更新管理员
     */
    @RequestMapping(value = "/admin/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> update(HttpRequest request) {
        Admin admin = new Admin();
        admin.setLoginName(request.getString("login_name"));
        admin.setName(request.getString("admin_name"));
        admin.setPwd(request.getString("login_name"));
        admin.setSex(request.getInteger("sex"));
        admin.setUpdateTime(new Date());
        return adminService.update(admin, ImageUtil.stringToBytes(request.getString("admin_image")));
    }
 
    /**
     * 管理员 删除管理员
     */
    @RequestMapping(value = "/admin/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Admin> del(HttpRequest request) {
        List<String> adminIdList = new ArrayList<>();
        JSONArray array = request.getJSONArray("admin_id_list");
        for (int i = 0; i < array.size(); i++) {
            adminIdList.add(array.getString(i));
        }
        return adminService.del(adminIdList);
    }
}

学生控制器:

/**
 * 学生控制器
 */
@RestController
public class StudentController {
 
    @Resource(name = "studentService")
    private IStudentService studentService;
 
    /**
     * 管理员 查询学生列表
     */
    @RequestMapping(value = "/student/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public ListResult<Student> qryPage(HttpRequest request) {
        Map<String, Object> param = new HashMap<>();
        int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
        int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
        if (request.containsKey("student_id")) {
            param.put("student_id", request.getString("student_id"));
        }
        if (request.containsKey("name")) {
            param.put("name", request.getString("name"));
        }
        return studentService.qryPage(param, pageNo, pageSize);
    }
 
    @RequestMapping(value = "/student/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Student> insert(HttpRequest request) {
        Student student = new Student();
        student.setStudentId(request.getString("student_id"));
        student.setName(request.getString("student_name"));
        student.setPwd(request.getString("student_id"));
        student.setSex(request.getInteger("sex"));
        student.setClassId(request.getString("class_id"));
        student.setUpdateTime(new Date());
        return studentService.insert(student, ImageUtil.stringToBytes(request.getString("student_image")));
    }
 
    @RequestMapping(value = "/student/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Student> update(HttpRequest request) {
        Student student = new Student();
        student.setStudentId(request.getString("student_id"));
        student.setName(request.getString("student_name"));
        student.setPwd(request.getString("student_id"));
        student.setSex(request.getInteger("sex"));
        student.setClassId(request.getString("class_id"));
        student.setUpdateTime(new Date());
        return studentService.update(student, ImageUtil.stringToBytes(request.getString("student_image")));
    }
 
    @RequestMapping(value = "/student/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Student> del(HttpRequest request) {
        List<String> studentIdList = new ArrayList<>();
        JSONArray array = request.getJSONArray("student_id_list");
        for (int i = 0; i < array.size(); i++) {
            studentIdList.add(array.getString(i));
        }
        return studentService.del(studentIdList);
    }
 
 
}

教师控制器:

/**
 * 教师控制器
 */
@RestController
public class TeacherController {
 
    @Resource(name = "teacherService")
    private ITeacherService teacherService;
 
    /**
     * 管理员 查询教师列表
     */
    @RequestMapping(value = "/teacher/qryPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public ListResult<Teacher> qryPage(HttpRequest request) {
        Map<String, Object> param = new HashMap<>();
        int pageNo = request.containsKey("page_no") ? request.getInteger("page_no") : 1;
        int pageSize = request.containsKey("page_size") ? request.getInteger("page_size") : 20;
        if (request.containsKey("teacher_id")) {
            param.put("teacher_id", request.getString("teacher_id"));
        }
        if (request.containsKey("name")) {
            param.put("name", request.getString("name"));
        }
        return teacherService.qryPage(param, pageNo, pageSize);
    }
 
    /**
     * 管理员 添加教师
     */
    @RequestMapping(value = "/teacher/add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Teacher> insert(HttpRequest request) {
        Teacher teacher = new Teacher();
        teacher.setTeacherId(request.getString("teacher_id"));
        teacher.setName(request.getString("teacher_name"));
        teacher.setPwd(request.getString("teacher_id"));
        teacher.setSex(request.getInteger("sex"));
        teacher.setUpdateTime(new Date());
        return teacherService.insert(teacher, ImageUtil.stringToBytes(request.getString("teacher_image")));
    }
 
    /**
     * 管理员 更新教师属性
     */
    @RequestMapping(value = "/teacher/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Teacher> update(HttpRequest request) {
        Teacher teacher = new Teacher();
        teacher.setTeacherId(request.getString("teacher_id"));
        teacher.setName(request.getString("teacher_name"));
        teacher.setPwd(request.getString("teacher_id"));
        teacher.setSex(request.getInteger("sex"));
        teacher.setUpdateTime(new Date());
        return teacherService.update(teacher, ImageUtil.stringToBytes(request.getString("teacher_image")));
    }
 
    /**
     * 管理员 删除教师
     */
    @RequestMapping(value = "/teacher/del", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public Result<Teacher> del(HttpRequest request) {
        List<String> teacherIdList = new ArrayList<>();
        JSONArray array = request.getJSONArray("teacher_id_list");
        for (int i = 0; i < array.size(); i++) {
            teacherIdList.add(array.getString(i));
        }
        return teacherService.del(teacherIdList);
    }
 
    /**
     * 管理员 查询所有任教老师
     */
    @RequestMapping(value = "/teacher/qryAllList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @RoleAnnotation(types = {RoleEnum.admin})
    public ListResult<Teacher> qryAllList() {
        return teacherService.qryAllList();
    }
}

到此这篇关于Java 实战项目基于遗传算法学校排课系统的实现流程的文章就介绍到这了,更多相关Java 排课系统内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • Spring与bean有关的生命周期示例详解

    Spring与bean有关的生命周期示例详解

    这篇文章主要给大家介绍了关于Spring与bean有关的生命周期的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者使用Spring具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
    2020-07-07
  • Java Web开发项目中中文乱码解决方法汇总

    Java Web开发项目中中文乱码解决方法汇总

    这篇文章主要为大家详细汇总了Java Web开发项目中中文乱码的解决方法,分析了5种Java Web中文乱码情况,感兴趣的小伙伴们可以参考一下
    2016-05-05
  • SpringAop源码及调用过程概述

    SpringAop源码及调用过程概述

    这篇文章主要介绍了SpringAop源码及调用过程概述,Spring AOP(面向切面编程)是Spring框架的一个重要特性,它提供了一种在程序运行期间动态地将额外的行为织入到代码中的方式,需要的朋友可以参考下
    2023-10-10
  • java提高篇(二三)-----HashMap详解

    java提高篇(二三)-----HashMap详解

    HashMap基于哈希表的 Map 接口的实现,本篇文章主要讲诉了java中HashMap,有兴趣的可以了解一下。
    2016-11-11
  • 集群环境中使用ehcache_动力节点Java学院整理

    集群环境中使用ehcache_动力节点Java学院整理

    这篇文章主要为大家详细介绍了集群环境中使用ehcache的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2017-08-08
  • Java面向对象基础之多态性,抽象类和接口

    Java面向对象基础之多态性,抽象类和接口

    这篇文章主要介绍了Java面向对象基础:多态性,抽象类和接口,文中代码可以帮助各位更好的理解学习,有需求的小伙伴可以参考下
    2020-05-05
  • Spring Security内置过滤器的维护方法

    Spring Security内置过滤器的维护方法

    这篇文章主要介绍了Spring Security的内置过滤器是如何维护的,本文给我们分析一下HttpSecurity维护过滤器的几个方法,需要的朋友可以参考下
    2022-02-02
  • Java扑克牌速算24的方法

    Java扑克牌速算24的方法

    这篇文章主要为大家详细介绍了Java扑克牌速算24的方法,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-03-03
  • QQ好友列表树形列表java代码实现代码

    QQ好友列表树形列表java代码实现代码

    这篇文章主要为大家详细介绍了QQ好友列表树形列表简单实现方式,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2016-08-08
  • Springboot之如何统计代码执行耗时时间

    Springboot之如何统计代码执行耗时时间

    这篇文章主要介绍了Springboot之如何统计代码执行耗时时间问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2023-03-03

最新评论