当前位置: 首页 > article >正文

springboot+vue学生选课管理系统

项目介绍 这是一个采用前后端分离开发的项目,前端采用 Vue 开发、后端采用 SpringBoot + Mybatis 开发。

项目部署

  1. 将 studentms.sql 导入mysql数据库

  2. 运行前端webstorm导入student_client运行

  3. 运行后端idea导入student_server

项目展示

学生端首页展示

选课:

选好课后可以在查询课表看到:

教师端菜单

前端部分

1、项目运行

由于涉及大量的 ES6/7 等新属性,node 需要 6.0 以上版本

2、技术栈

Vuex

Router

Axios

Element ui

sessionStorage

3、项目介绍

采用 vue 2.0 开发,通过调用后端提供的数据接口实现数据的动态渲染。项目默认端口号 8080

使用监视器,得益于 Mybatis 强大的动态 SQL 功能,实现高性能动态搜索功能

使用 router 配置路由,实现不同用户类型导航栏的动态渲染

使用 axios 异步加载后端数据

使用 element ui 实现表单的前端校验功能

使用 sessionStorage 实现登录拦截

分别实现了基于前端和后端的数据分页功能

4、系统功能

1、admin

实现对教师,学生,课程的 CRUD

实现对教师业务以及学生业务的全方位控制

2、teacher

实现查询我开设的课程,以及选择我课程的学生信息

对学生成绩的登陆

3、student

实现选课退课的功能

实现成绩查询的功能

后端部分

1、项目运行

JDK 版本需要 1.8或者以上

2、技术栈

Spring boot 2.6.3

Mybatis

Maven

3、项目介绍

采用 Restful 风格开发,采用 CrossOrigin 解决跨域问题。采用注解以及 xml 文件配置 SQL 语句,实现动态 SQL 的功能,为前端提供完备的数据接口。

由于 vue 项目占用了 8080 Tomcat 默认端口,所以指定项目启动在 10086 端口, 可以使用 YAML 文件配置,使用 Maven 项目进行打包。

4、系统功能

实现前端 Ajax 请求的全部数据接口,Get 请求通过 RESTful 风格开发。

数据库设计

部分代码

@RestController
@CrossOrigin("*")
@RequestMapping("/course")
public class CourseController {
    @Autowired
    private CourseService courseService;

    @PostMapping("/findBySearch")
    public List<Course> findBySearch(@RequestBody Map<String, String> map) {
        return courseService.findBySearch(map);
    }

    @GetMapping("/findById/{cid}")
    public List<Course> findById(@PathVariable Integer cid) {
        return courseService.findBySearch(cid);
    }

    @PostMapping("/save")
    public boolean save(@RequestBody Course course) {
        System.out.println(course);
        return courseService.insertCourse(course);
    }

    @GetMapping("/deleteById/{cid}")
    public boolean deleteById(@PathVariable Integer cid) {
        System.out.println("正在删除课程 cid: " + cid);
        return courseService.deleteById(cid);
    }

    @PostMapping("/updateCourse")
    public boolean updateCourse(@RequestBody Course course) {
        System.out.println("正在修改课程: " + course);
        return courseService.updateById(course);
    }

}

后台用的mybatis,没用MP,后端端口是10086,前端的axios发请求是写死的后端地址,这一点有优化空间。

<template>
  <div>
    <el-form style="width: 60%" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="课程名" prop="cname">
        <el-input v-model="ruleForm.cname"></el-input>
      </el-form-item>
      <el-form-item label="学分" prop="ccredit">
        <el-input v-model.number="ruleForm.ccredit"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
        <el-button @click="test">test</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      ruleForm: {
        cname: null,
        ccredit: null
      },
      rules: {
        cname: [
          { required: true, message: '请输入名称', trigger: 'blur' },
        ],
        ccredit: [
          { required: true, message: '请输入学分', trigger: 'change' },
          { type: 'number', message: '请输入数字', trigger: 'blur' },
        ],
      }
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // 通过前端校验
          const that = this
          // console.log(this.ruleForm)
 
          axios.post("http://localhost:10086/course/save", this.ruleForm).then(function (resp) {
            console.log(resp)
            if (resp.data === true) {
              that.$message({
                showClose: true,
                message: '插入成功',
                type: 'success'
              });
            }
            else {
              that.$message.error('插入失败,请检查数据库t');
            }
            that.$router.push("/queryCourse")
          })
        } else {
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    test() {
      console.log(this.ruleForm)
    }
  }
}
</script>

前端就是比较标准的vue页面。

总的来说,是一套比较不错的系统,非常具有学习价值!


http://www.kler.cn/news/9954.html

相关文章:

  • 循环依赖详解及解决方案
  • 闭包和继承
  • 程序员为了女朋you进了华为,同学去了阿里,2年后对比收入懵了
  • GDPU C语言 天码行空7
  • 代码随想录算法训练营第五十五天 | 392. 判断子序列、115. 不同的子序列
  • 【grafana】使用多级变量解决Granfana模板变量中的大小限制
  • RHCE——shell脚本练习
  • DC 使用记录
  • 一次性搞懂dBSPL、dBm、dBu、dBV、dBFS的区别!
  • 谈ChatGPT基本信息
  • Mac平台上有哪些好用的常用软件?
  • 软件重构方法
  • Nacos 性能报告
  • 2023-04-14 lua + C动态库交叉debug
  • 逆向入门--何为OEP
  • 故障注入的方法与工具
  • 【GITLab】docker部署GitLab
  • 如何在ubuntu上搭建minio
  • 灌区量测水系统
  • C++ Primer第五版_第十一章习题答案(31~38)
  • 程序员必用的6个代码对比神器附下载地址
  • Linux嵌入式学习之Ubuntu入门(二)磁盘文件介绍及分区、格式化等
  • NumPy 初学者指南中文第三版:1~5
  • 【三十天精通Vue 3】 第三天 Vue 3的组件详解
  • 一位腾讯在职7年测试工程师的心声...
  • 为什么会有JMM?从0到1一次性说清楚
  • Adaptive AUTOSAR——State Management(VRTE 3.0 R21-11)
  • 笔记 | python蓝桥算法复习(预习)基础知识
  • 快排非递归 归并排序
  • spring(七):事务操作