├── README.md ├── student-client ├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── pnpm-lock.yaml ├── public │ ├── favicon.ico │ └── index.html └── src │ ├── App.vue │ ├── assets │ └── logo.png │ ├── components │ ├── infoCard.vue │ ├── logout.vue │ ├── r-aside.vue │ ├── r-header.vue │ └── updateInfo.vue │ ├── main.js │ ├── plugins │ ├── axios.js │ └── element.js │ ├── router │ └── index.js │ ├── store │ └── index.js │ └── views │ ├── Admin │ ├── courseManage │ │ ├── addCourse.vue │ │ ├── courseList.vue │ │ ├── editorCourse.vue │ │ ├── index.vue │ │ └── queryCourse.vue │ ├── gradeCourseManage │ │ ├── editorGradeCourse.vue │ │ ├── gradeCourseList.vue │ │ ├── index.vue │ │ └── queryGradeCourse.vue │ ├── home.vue │ ├── index.vue │ ├── selectCourseManage │ │ ├── CourseTacherList.vue │ │ ├── index.vue │ │ └── queryCourseTeacher.vue │ ├── studentManage │ │ ├── addStudent.vue │ │ ├── editorStudent.vue │ │ ├── index.vue │ │ ├── queryStudent.vue │ │ └── studentList.vue │ └── teacherManage │ │ ├── addTeacher.vue │ │ ├── editorTeacher.vue │ │ ├── index.vue │ │ ├── queryTeacher.vue │ │ └── teacherList.vue │ ├── Student │ ├── courseGrade │ │ ├── index.vue │ │ └── queryCourseGrade.vue │ ├── home.vue │ ├── index.vue │ └── selectCourse │ │ ├── index.vue │ │ ├── querySelectedCourse.vue │ │ ├── selectCourse.vue │ │ └── selectCourseList.vue │ ├── Teacher │ ├── home.vue │ ├── index.vue │ ├── myOfferCourse.vue │ ├── offerCourse.vue │ ├── offerCourseList.vue │ ├── setCourse.vue │ └── teacherGradeCourseManage │ │ ├── index.vue │ │ ├── teacherEditorGradeCourse.vue │ │ ├── teacherGradeCourseList.vue │ │ └── teacherQueryGradeCourse.vue │ └── login │ └── index.vue └── student-server ├── .gitignore ├── pom.xml └── src └── main ├── java └── com │ └── auggie │ └── student_server │ ├── StudentServerApplication.java │ ├── controller │ ├── CourseController.java │ ├── CourseTeacherController.java │ ├── InfoController.java │ ├── SCTcontroller.java │ ├── StudentController.java │ └── TeacherController.java │ ├── entity │ ├── Course.java │ ├── CourseTeacher.java │ ├── CourseTeacherInfo.java │ ├── SCTInfo.java │ ├── Student.java │ ├── StudentCourseTeacher.java │ └── Teacher.java │ ├── mapper │ ├── CourseMapper.java │ ├── CourseTeacherMapper.java │ ├── StudentCourseTeacherMapper.java │ ├── StudentMapper.java │ └── TeacherMapper.java │ └── service │ ├── CourseService.java │ ├── CourseTeacherService.java │ ├── SCTService.java │ ├── StudentService.java │ └── TeacherService.java └── resources ├── application.yml ├── mapper ├── CourseMapper.xml ├── CourseTeacherMapper.xml ├── StudentCourseTeacherMapper.xml ├── StudentMapper.xml └── TeacherMapper.xml └── studentms.sql /README.md: -------------------------------------------------------------------------------- 1 | # SpringBoot+Vue 的学生选课管理系统源码 2 | 3 | 项目源码来自网络,仅用于学习,并在代码中添加了部分笔记 4 | 5 | ## 项目结构 6 | 7 | ```bash 8 | student-client 客户端代码 9 | student-server 服务端代码 10 | ``` 11 | 12 | ## 技术栈 13 | 14 | 客户端 15 | - vue 2.6.11 16 | - vue-router 3.2.0 17 | - vuex 3.4.0 18 | - element-ui 2.4.5 19 | 20 | 服务端 21 | 22 | - Java 1.8 23 | - SpringBoot 2.6.3 24 | - MyBatis 2.2.2 25 | - mysql 8.0 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /student-client/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /student-client/README.md: -------------------------------------------------------------------------------- 1 | # student_client 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Customize configuration 19 | See [Configuration Reference](https://cli.vuejs.org/config/). 20 | -------------------------------------------------------------------------------- /student-client/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /student-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "student-client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vue-cli-service serve", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "core-js": "^3.6.5", 11 | "element-ui": "^2.4.5", 12 | "vue": "^2.6.11", 13 | "vue-router": "^3.2.0", 14 | "vuex": "^3.4.0" 15 | }, 16 | "devDependencies": { 17 | "@vue/cli-plugin-babel": "~4.5.0", 18 | "@vue/cli-plugin-router": "~4.5.0", 19 | "@vue/cli-plugin-vuex": "~4.5.0", 20 | "@vue/cli-service": "~4.5.0", 21 | "axios": "^0.18.0", 22 | "vue-cli-plugin-axios": "^0.0.4", 23 | "vue-cli-plugin-element": "^1.0.1", 24 | "vue-template-compiler": "^2.6.11" 25 | }, 26 | "browserslist": [ 27 | "> 1%", 28 | "last 2 versions", 29 | "not dead" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /student-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mouday/student-course-selection-system/dc1163f7d6739ef5b912975e43a932d36614c0b3/student-client/public/favicon.ico -------------------------------------------------------------------------------- /student-client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 学生选课管理系统 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /student-client/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mouday/student-course-selection-system/dc1163f7d6739ef5b912975e43a932d36614c0b3/student-client/src/assets/logo.png -------------------------------------------------------------------------------- /student-client/src/components/infoCard.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /student-client/src/components/logout.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /student-client/src/components/r-aside.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 31 | 32 | -------------------------------------------------------------------------------- /student-client/src/components/r-header.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 36 | 37 | -------------------------------------------------------------------------------- /student-client/src/components/updateInfo.vue: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /student-client/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import './plugins/axios' 3 | import App from './App.vue' 4 | import router from './router' 5 | import store from './store' 6 | import './plugins/element.js' 7 | 8 | Vue.config.productionTip = false 9 | 10 | new Vue({ 11 | router, 12 | store, 13 | render: h => h(App) 14 | }).$mount('#app') 15 | -------------------------------------------------------------------------------- /student-client/src/plugins/axios.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | import Vue from 'vue'; 4 | import axios from "axios"; 5 | 6 | // Full config: https://github.com/axios/axios#request-config 7 | // axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || ''; 8 | // axios.defaults.headers.common['Authorization'] = AUTH_TOKEN; 9 | // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; 10 | 11 | let config = { 12 | // baseURL: process.env.baseURL || process.env.apiUrl || "" 13 | // timeout: 60 * 1000, // Timeout 14 | // withCredentials: true, // Check cross-site Access-Control 15 | }; 16 | 17 | const _axios = axios.create(config); 18 | 19 | _axios.interceptors.request.use( 20 | function(config) { 21 | // Do something before request is sent 22 | return config; 23 | }, 24 | function(error) { 25 | // Do something with request error 26 | return Promise.reject(error); 27 | } 28 | ); 29 | 30 | // Add a response interceptor 31 | _axios.interceptors.response.use( 32 | function(response) { 33 | // Do something with response data 34 | return response; 35 | }, 36 | function(error) { 37 | // Do something with response error 38 | return Promise.reject(error); 39 | } 40 | ); 41 | 42 | Plugin.install = function(Vue, options) { 43 | Vue.axios = _axios; 44 | window.axios = _axios; 45 | Object.defineProperties(Vue.prototype, { 46 | axios: { 47 | get() { 48 | return _axios; 49 | } 50 | }, 51 | $axios: { 52 | get() { 53 | return _axios; 54 | } 55 | }, 56 | }); 57 | }; 58 | 59 | Vue.use(Plugin) 60 | 61 | export default Plugin; 62 | -------------------------------------------------------------------------------- /student-client/src/plugins/element.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Element from 'element-ui' 3 | import 'element-ui/lib/theme-chalk/index.css' 4 | 5 | Vue.use(Element) 6 | -------------------------------------------------------------------------------- /student-client/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import VueRouter from 'vue-router'; 3 | import login from '../views/login/index'; 4 | import admin from '../views/Admin/index'; 5 | import adminHome from '../views/Admin/home'; 6 | import studentManage from '../views/Admin/studentManage/index' 7 | import addStudent from "@/views/Admin/studentManage/addStudent"; 8 | import studentList from "@/views/Admin/studentManage/studentList"; 9 | import editorStudent from "@/views/Admin/studentManage/editorStudent"; 10 | import teacherManage from "@/views/Admin/teacherManage/index" 11 | import addTeacher from "@/views/Admin/teacherManage/addTeacher"; 12 | import editorTeacher from "@/views/Admin/teacherManage/editorTeacher"; 13 | import courseManage from "@/views/Admin/courseManage/index"; 14 | import addCourse from "@/views/Admin/courseManage/addCourse"; 15 | import teacher from "@/views/Teacher/index"; 16 | import queryStudent from "@/views/Admin/studentManage/queryStudent"; 17 | import queryTeacher from "@/views/Admin/teacherManage/queryTeacher"; 18 | import student from "@/views/Student/index"; 19 | import editorCourse from "@/views/Admin/courseManage/editorCourse"; 20 | import courseList from "@/views/Admin/courseManage/courseList"; 21 | import queryCourse from "@/views/Admin/courseManage/queryCourse"; 22 | import offerCourse from "@/views/Teacher/offerCourse"; 23 | import teacherHome from "@/views/Teacher/home"; 24 | import setCourse from "@/views/Teacher/setCourse"; 25 | import studentHome from "@/views/Student/home"; 26 | import myOfferCourse from "@/views/Teacher/myOfferCourse"; 27 | import CourseTeacherManage from "@/views/Admin/selectCourseManage/index"; 28 | import queryCourseTeacher from "@/views/Admin/selectCourseManage/queryCourseTeacher"; 29 | import studentSelectCourseManage from "@/views/Student/selectCourse/index"; 30 | import selectCourse from "@/views/Student/selectCourse/selectCourse"; 31 | import querySelectedCourse from "@/views/Student/selectCourse/querySelectedCourse"; 32 | import studentCourseGrade from "@/views/Student/courseGrade/index"; 33 | import queryCourseGrade from "@/views/Student/courseGrade/queryCourseGrade"; 34 | import queryGradeCourse from "@/views/Admin/gradeCourseManage/queryGradeCourse"; 35 | import editorGradeCourse from "@/views/Admin/gradeCourseManage/editorGradeCourse"; 36 | import teacherGradeCourseManage from "@/views/Teacher/teacherGradeCourseManage/index"; 37 | import teacherQueryGradeCourse from "@/views/Teacher/teacherGradeCourseManage/teacherQueryGradeCourse"; 38 | import teacherGradeCourseList from "@/views/Teacher/teacherGradeCourseManage/teacherGradeCourseList"; 39 | import teacherEditorGradeCourse from "@/views/Teacher/teacherGradeCourseManage/teacherEditorGradeCourse"; 40 | import updateInfo from "@/components/updateInfo"; 41 | 42 | Vue.use(VueRouter) 43 | 44 | const routes = [ 45 | { 46 | // 随便定义的首页 47 | path: '/', 48 | name: 'index', 49 | component: login, 50 | redirect: '/login' 51 | }, 52 | { 53 | // 登陆页 54 | path: '/login', 55 | name: 'login', 56 | component: login 57 | }, 58 | { 59 | // admin 的路由 60 | path: '/admin', 61 | name: 'admin', 62 | redirect: '/adminHome', 63 | component: admin, 64 | meta: {requireAuth: true}, 65 | children: [ 66 | { 67 | path: '/adminHome', 68 | name: 'Hi! admin', 69 | component: adminHome, 70 | meta: {requireAuth: true}, 71 | children: [ 72 | { 73 | path: '/adminHome', 74 | name: 'admin 主页', 75 | component: adminHome, 76 | meta: {requireAuth: true}, 77 | } 78 | ] 79 | }, 80 | { 81 | path: '/studentManage', 82 | name: '学生管理', 83 | component: studentManage, 84 | meta: {requireAuth: true}, 85 | children: [ 86 | { 87 | path: '/addStudent', 88 | name: '添加学生', 89 | component: addStudent, 90 | meta: {requireAuth: true} 91 | }, 92 | { 93 | path: '/studentList', 94 | name: '学生列表', 95 | component: studentList, 96 | meta: {requireAuth: true}, 97 | }, 98 | { 99 | path: '/editorStudent', 100 | name: '编辑学生', 101 | component: editorStudent, 102 | meta: {requireAuth: true} 103 | }, 104 | { 105 | path: '/queryStudent', 106 | name: '搜索', 107 | component: queryStudent, 108 | meta: {requireAuth: true}, 109 | children: [ 110 | { 111 | path: '/queryStudent/studentList', 112 | component: studentList, 113 | meta: {requireAuth: true} 114 | } 115 | ] 116 | } 117 | ] 118 | }, 119 | { 120 | path: '/teacherManage', 121 | name: '教师管理', 122 | component: teacherManage, 123 | meta: {requireAuth: true}, 124 | children: [ 125 | { 126 | path: '/addTeacher', 127 | name: '添加教师', 128 | component: addTeacher, 129 | meta: {requireAuth: true} 130 | }, 131 | { 132 | path: '/queryTeacher', 133 | name: '教师列表', 134 | component: queryTeacher, 135 | meta: {requireAuth: true}, 136 | children: [ 137 | ] 138 | }, 139 | { 140 | path: '/editorTeacher', 141 | name: '编辑教师', 142 | component: editorTeacher, 143 | meta: {requireAuth: true} 144 | }, 145 | ] 146 | }, 147 | { 148 | path: '/courseManage', 149 | name: '课程管理', 150 | component: courseManage, 151 | meta: {requireAuth: true}, 152 | children: [ 153 | { 154 | path: '/addCourse', 155 | name: '添加课程', 156 | component: addCourse, 157 | meta: {requireAuth: true} 158 | }, 159 | { 160 | path: '/queryCourse', 161 | name: '搜索课程', 162 | component: queryCourse, 163 | meta: {requireAuth: true}, 164 | children: [ 165 | { 166 | path: '/courseList', 167 | name: '课程列表', 168 | component: courseList, 169 | meta: {requireAuth: true} 170 | }, 171 | ] 172 | }, 173 | { 174 | path: '/editorCourse', 175 | name: '编辑课程', 176 | component: editorCourse, 177 | meta: {requireAuth: true} 178 | }, 179 | ] 180 | }, 181 | { 182 | path: '/CourseTeacher', 183 | name: '开课表管理', 184 | component: CourseTeacherManage, 185 | meta: {requireAuth: true}, 186 | children: [ 187 | { 188 | path: '/queryCourseTeacher', 189 | name: '开课管理', 190 | component: queryCourseTeacher, 191 | meta: {requireAuth: true}, 192 | } 193 | ] 194 | }, 195 | { 196 | name: 'admin 学生成绩管理', 197 | path: "/gradeCourseManage", 198 | component: studentManage, 199 | meta: {requireAuth: true}, 200 | children: [ 201 | { 202 | path: '/queryGradeCourse', 203 | name: '学生成绩查询', 204 | component: queryGradeCourse, 205 | meta: {requireAuth: true}, 206 | }, 207 | { 208 | path: '/editorGradeCourse', 209 | name: '编辑', 210 | component: editorGradeCourse, 211 | meta: {requireAuth: true} 212 | } 213 | ] 214 | } 215 | ] 216 | }, 217 | { 218 | path: '/teacher', 219 | name: 'teacher', 220 | component: teacher, 221 | redirect: '/teacherHome', 222 | meta: {requireAuth: true}, 223 | children: [ 224 | { 225 | path: '/teacherHome', 226 | name: 'Hi! teacher', 227 | meta: {requireAuth: true}, 228 | component: teacherHome, 229 | children: [ 230 | { 231 | path: '/teacherHome', 232 | name: '教师主页', 233 | meta: {requireAuth: true}, 234 | component: teacherHome 235 | }, 236 | ] 237 | }, 238 | { 239 | path: '/updateInfo', 240 | name: '教师编辑', 241 | component: updateInfo, 242 | meta: {requireAuth: true}, 243 | children: [ 244 | { 245 | path: '/updateInfoHome', 246 | name: '编辑教师信息', 247 | component: updateInfo, 248 | meta: {requireAuth: true} 249 | } 250 | ] 251 | }, 252 | { 253 | path: '/courseManage', 254 | name: '课程设置', 255 | meta: {requireAuth: true}, 256 | component: setCourse, 257 | children: [ 258 | { 259 | path: '/myOfferCourse', 260 | name: '我开设的课程', 261 | component: myOfferCourse, 262 | meta: {requireAuth: true} 263 | }, 264 | { 265 | path: '/offerCourse', 266 | name: '开设课程', 267 | component: offerCourse, 268 | meta: {requireAuth: true} 269 | }, 270 | ] 271 | }, 272 | { 273 | name: '教师成绩管理', 274 | path: '/teacherQueryGradeCourseManage', 275 | component: teacherGradeCourseManage, 276 | meta: {requireAuth: true}, 277 | children: [ 278 | { 279 | path: '/teacherQueryGradeCourseManage', 280 | name: '成绩管理', 281 | component: teacherQueryGradeCourse, 282 | meta: {requireAuth: true} 283 | }, 284 | { 285 | path: '/teacherEditorGradeCourse', 286 | name: '编辑成绩', 287 | component: teacherEditorGradeCourse, 288 | meta: {requireAuth: true} 289 | } 290 | ] 291 | } 292 | ] 293 | }, 294 | { 295 | path: '/student', 296 | name: 'student', 297 | component: student, 298 | redirect: '/studentHome', 299 | meta: {requireAuth: true}, 300 | children: [ 301 | { 302 | path: '/student', 303 | name: 'hi! student', 304 | component: studentHome, 305 | meta: {requireAuth: true}, 306 | children: [ 307 | { 308 | path: '/studentHome', 309 | name: '学生主页', 310 | component: studentHome, 311 | meta: {requireAuth: true}, 312 | }, 313 | ], 314 | }, 315 | { 316 | path: '/updateInfo', 317 | name: '学生编辑', 318 | component: updateInfo, 319 | meta: {requireAuth: true}, 320 | children: [ 321 | { 322 | path: '/updateInfoHome', 323 | name: '编辑学生信息', 324 | component: updateInfo, 325 | meta: {requireAuth: true} 326 | } 327 | ] 328 | }, 329 | { 330 | path: '/studentSelectCourseManage', 331 | name: '选课管理', 332 | component: studentSelectCourseManage, 333 | meta: {requireAuth: true}, 334 | children: [ 335 | { 336 | path: '/studentSelectCourse', 337 | name: '选课', 338 | component: selectCourse, 339 | meta: {requireAuth: true} 340 | }, 341 | { 342 | path: '/querySelectedCourse', 343 | name: '查询课表', 344 | component: querySelectedCourse, 345 | meta: {requireAuth: true} 346 | } 347 | ] 348 | }, 349 | { 350 | path: '/courseGrade', 351 | name: '学生成绩管理', 352 | component: studentCourseGrade, 353 | meta: {requireAuth: true}, 354 | children: [ 355 | { 356 | path: '/queryCourseGrade', 357 | name: '成绩查询', 358 | component: queryCourseGrade, 359 | meta: {requireAuth: true} 360 | }, 361 | ] 362 | } 363 | ] 364 | } 365 | ] 366 | 367 | const router = new VueRouter({ 368 | mode: 'history', 369 | base: process.env.BASE_URL, 370 | routes 371 | }) 372 | 373 | export default router 374 | 375 | /* 376 | session 设置: 377 | 1. token 378 | 2. name 379 | 3. type 380 | 4. tid 381 | 5. sid 382 | 5. 系统信息 info 383 | */ 384 | router.beforeEach((to, from, next) => { 385 | console.log(from.path + ' ====> ' + to.path) 386 | if (to.meta.requireAuth) { // 判断该路由是否需要登录权限 387 | if (sessionStorage.getItem("token") === 'true') { // 判断本地是否存在token 388 | next() 389 | } else { 390 | // 未登录,跳转到登陆页面 391 | next({ 392 | path: '/login', 393 | query: {redirect: to.fullPath} 394 | }) 395 | } 396 | } else { 397 | // 不需要登陆权限的页面,如果已经登陆,则跳转主页面 398 | if(sessionStorage.getItem("token") === 'true'){ 399 | console.log('检查拦截器配置,大概率出现漏网之鱼') 400 | const t = sessionStorage.getItem("type") 401 | next('/' + t); 402 | }else{ 403 | next(); 404 | } 405 | } 406 | }); -------------------------------------------------------------------------------- /student-client/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/courseManage/addCourse.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/courseManage/courseList.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/courseManage/editorCourse.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/courseManage/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/courseManage/queryCourse.vue: -------------------------------------------------------------------------------- 1 | 34 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/gradeCourseManage/editorGradeCourse.vue: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/gradeCourseManage/gradeCourseList.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/gradeCourseManage/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/gradeCourseManage/queryGradeCourse.vue: -------------------------------------------------------------------------------- 1 | 57 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/home.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 26 | 27 | 30 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/selectCourseManage/CourseTacherList.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/selectCourseManage/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/selectCourseManage/queryCourseTeacher.vue: -------------------------------------------------------------------------------- 1 | 37 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/studentManage/addStudent.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/studentManage/editorStudent.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/studentManage/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/studentManage/queryStudent.vue: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/studentManage/studentList.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/teacherManage/addTeacher.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/teacherManage/editorTeacher.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/teacherManage/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/teacherManage/queryTeacher.vue: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /student-client/src/views/Admin/teacherManage/teacherList.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | -------------------------------------------------------------------------------- /student-client/src/views/Student/courseGrade/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /student-client/src/views/Student/courseGrade/queryCourseGrade.vue: -------------------------------------------------------------------------------- 1 | 61 | 62 | 119 | 120 | -------------------------------------------------------------------------------- /student-client/src/views/Student/home.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /student-client/src/views/Student/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | -------------------------------------------------------------------------------- /student-client/src/views/Student/selectCourse/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/views/Student/selectCourse/querySelectedCourse.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | -------------------------------------------------------------------------------- /student-client/src/views/Student/selectCourse/selectCourse.vue: -------------------------------------------------------------------------------- 1 | 37 | -------------------------------------------------------------------------------- /student-client/src/views/Student/selectCourse/selectCourseList.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/home.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 28 | 29 | 32 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 25 | 26 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/myOfferCourse.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/offerCourse.vue: -------------------------------------------------------------------------------- 1 | 34 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/offerCourseList.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/setCourse.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/teacherGradeCourseManage/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/teacherGradeCourseManage/teacherEditorGradeCourse.vue: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/teacherGradeCourseManage/teacherGradeCourseList.vue: -------------------------------------------------------------------------------- 1 | 61 | 62 | -------------------------------------------------------------------------------- /student-client/src/views/Teacher/teacherGradeCourseManage/teacherQueryGradeCourse.vue: -------------------------------------------------------------------------------- 1 | 48 | -------------------------------------------------------------------------------- /student-client/src/views/login/index.vue: -------------------------------------------------------------------------------- 1 | 74 | 75 | 251 | 252 | 269 | -------------------------------------------------------------------------------- /student-server/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | target 3 | .idea -------------------------------------------------------------------------------- /student-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.6.3 9 | 10 | 11 | 12 | com.auggie 13 | student-server 14 | 0.0.1-SNAPSHOT 15 | student-server 16 | student-server 17 | 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.mybatis.spring.boot 25 | mybatis-spring-boot-starter 26 | 2.2.2 27 | 28 | 29 | 30 | mysql 31 | mysql-connector-java 32 | runtime 33 | 34 | 35 | org.projectlombok 36 | lombok 37 | true 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-maven-plugin 47 | 48 | 49 | 50 | org.projectlombok 51 | lombok 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/StudentServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class StudentServerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(StudentServerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/CourseController.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import com.auggie.student_server.service.CourseService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * @Auther: auggie 13 | * @Date: 2022/2/9 13:45 14 | * @Description: CourseController 15 | * @Version 1.0.0 16 | */ 17 | 18 | @RestController 19 | @CrossOrigin("*") 20 | @RequestMapping("/course") 21 | public class CourseController { 22 | @Autowired 23 | private CourseService courseService; 24 | 25 | @PostMapping("/findBySearch") 26 | public List findBySearch(@RequestBody Map map) { 27 | return courseService.findBySearch(map); 28 | } 29 | 30 | @GetMapping("/findById/{cid}") 31 | public List findById(@PathVariable Integer cid) { 32 | return courseService.findBySearch(cid); 33 | } 34 | 35 | @PostMapping("/save") 36 | public boolean save(@RequestBody Course course) { 37 | System.out.println(course); 38 | return courseService.insertCourse(course); 39 | } 40 | 41 | @GetMapping("/deleteById/{cid}") 42 | public boolean deleteById(@PathVariable Integer cid) { 43 | System.out.println("正在删除课程 cid: " + cid); 44 | return courseService.deleteById(cid); 45 | } 46 | 47 | @PostMapping("/updateCourse") 48 | public boolean updateCourse(@RequestBody Course course) { 49 | System.out.println("正在修改课程: " + course); 50 | return courseService.updateById(course); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/CourseTeacherController.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import com.auggie.student_server.entity.CourseTeacher; 5 | import com.auggie.student_server.entity.CourseTeacherInfo; 6 | import com.auggie.student_server.service.CourseTeacherService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @Auther: auggie 15 | * @Date: 2022/2/10 16:51 16 | * @Description: CourseTeacherController 17 | * @Version 1.0.0 18 | */ 19 | 20 | @RestController 21 | @CrossOrigin("*") 22 | @RequestMapping("/courseTeacher") 23 | public class CourseTeacherController { 24 | @Autowired 25 | private CourseTeacherService courseTeacherService; 26 | 27 | @GetMapping("/insert/{cid}/{tid}/{term}") 28 | public boolean insert(@PathVariable Integer cid, @PathVariable Integer tid, @PathVariable String term) { 29 | if (courseTeacherService.findBySearch(cid, tid, term).size() != 0) { 30 | return false; 31 | } 32 | return courseTeacherService.insertCourseTeacher(cid, tid, term); 33 | } 34 | 35 | @GetMapping("/findMyCourse/{tid}/{term}") 36 | public List findMyCourse(@PathVariable Integer tid, @PathVariable String term) { 37 | System.out.println("查询教师课程:" + tid + " " + term); 38 | return courseTeacherService.findMyCourse(tid, term); 39 | } 40 | 41 | @PostMapping("/findCourseTeacherInfo") 42 | public List findCourseTeacherInfo(@RequestBody Map map) { 43 | return courseTeacherService.findCourseTeacherInfo(map); 44 | } 45 | 46 | @PostMapping("/deleteById") 47 | public boolean deleteById(@RequestBody CourseTeacher courseTeacher) { 48 | return courseTeacherService.deleteById(courseTeacher); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/InfoController.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import org.springframework.web.bind.annotation.CrossOrigin; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | * @Auther: auggie 9 | * @Date: 2022/2/10 14:50 10 | * @Description: InfoController 11 | * @Version 1.0.0 12 | */ 13 | 14 | @RestController 15 | @RequestMapping("/info") 16 | @CrossOrigin("*") 17 | public class InfoController { 18 | private final String CURRENT_TERM = "22-春季学期"; 19 | private final boolean FORBID_COURSE_SELECTION = false; 20 | 21 | @RequestMapping("/getCurrentTerm") 22 | public String getCurrentTerm() { 23 | return CURRENT_TERM; 24 | } 25 | 26 | @RequestMapping("/getForbidCourseSelection") 27 | public boolean getForbidCourseSelection() { 28 | return FORBID_COURSE_SELECTION; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/SCTcontroller.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import com.auggie.student_server.entity.CourseTeacherInfo; 4 | import com.auggie.student_server.entity.SCTInfo; 5 | import com.auggie.student_server.entity.StudentCourseTeacher; 6 | import com.auggie.student_server.service.SCTService; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @Auther: auggie 16 | * @Date: 2022/2/10 20:15 17 | * @Description: SCTcontroller 18 | * @Version 1.0.0 19 | */ 20 | 21 | @RestController 22 | @CrossOrigin("*") 23 | @RequestMapping("/SCT") 24 | public class SCTcontroller { 25 | @Autowired 26 | private SCTService sctService; 27 | 28 | @PostMapping("/save") 29 | public String save(@RequestBody StudentCourseTeacher studentCourseTeacher) { 30 | if (sctService.isSCTExist(studentCourseTeacher)) { 31 | return "禁止重复选课"; 32 | } 33 | System.out.println("正在保存 sct 记录:" + studentCourseTeacher); 34 | return sctService.save(studentCourseTeacher) ? "选课成功" : "选课失败,联系管理员"; 35 | } 36 | 37 | @GetMapping("/findBySid/{sid}/{term}") 38 | public List findBySid(@PathVariable Integer sid, @PathVariable String term) { 39 | return sctService.findBySid(sid, term); 40 | } 41 | 42 | @GetMapping("/findAllTerm") 43 | public List findAllTerm() { 44 | return sctService.findAllTerm(); 45 | } 46 | 47 | @PostMapping("/deleteBySCT") 48 | public boolean deleteBySCT(@RequestBody StudentCourseTeacher studentCourseTeacher) { 49 | System.out.println("正在删除 sct 记录:" + studentCourseTeacher); 50 | return sctService.deleteBySCT(studentCourseTeacher); 51 | } 52 | 53 | @PostMapping("/findBySearch") 54 | public List findBySearch(@RequestBody Map map) { 55 | return sctService.findBySearch(map); 56 | } 57 | 58 | @GetMapping("/findById/{sid}/{cid}/{tid}/{term}") 59 | public SCTInfo findById(@PathVariable Integer sid, 60 | @PathVariable Integer cid, 61 | @PathVariable Integer tid, 62 | @PathVariable String term) { 63 | return sctService.findByIdWithTerm(sid, cid, tid, term); 64 | } 65 | 66 | @GetMapping("/updateById/{sid}/{cid}/{tid}/{term}/{grade}") 67 | public boolean updateById(@PathVariable Integer sid, 68 | @PathVariable Integer cid, 69 | @PathVariable Integer tid, 70 | @PathVariable String term, 71 | @PathVariable Integer grade) { 72 | return sctService.updateById(sid, cid, tid, term, grade); 73 | } 74 | 75 | @GetMapping("/deleteById/{sid}/{cid}/{tid}/{term}") 76 | public boolean deleteById(@PathVariable Integer sid, 77 | @PathVariable Integer cid, 78 | @PathVariable Integer tid, 79 | @PathVariable String term) { 80 | return sctService.deleteById(sid, cid, tid, term); 81 | } 82 | 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import com.auggie.student_server.service.StudentService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * @Auther: auggie 14 | * @Date: 2022/2/8 17:37 15 | * @Description: StudentController 16 | * @Version 1.0.0 17 | */ 18 | 19 | @RestController 20 | @CrossOrigin("*") 21 | @RequestMapping("/student") 22 | public class StudentController { 23 | @Autowired 24 | private StudentService studentService; 25 | 26 | @PostMapping("/addStudent") 27 | public boolean addStudent(@RequestBody Student student) { 28 | System.out.println("正在保存学生对象" + student); 29 | return studentService.save(student); 30 | } 31 | 32 | @PostMapping("/login") 33 | public boolean login(@RequestBody Student student) { 34 | System.out.println("正在验证学生登陆 " + student); 35 | Student s = studentService.findById(student.getSid()); 36 | if (s == null || !s.getPassword().equals(student.getPassword())) { 37 | return false; 38 | } 39 | else { 40 | return true; 41 | } 42 | } 43 | 44 | @PostMapping("/findBySearch") 45 | public List findBySearch(@RequestBody Student student) { 46 | Integer fuzzy = (student.getPassword() == null) ? 0 : 1; 47 | return studentService.findBySearch(student.getSid(), student.getSname(), fuzzy); 48 | } 49 | 50 | @GetMapping("/findById/{sid}") 51 | public Student findById(@PathVariable("sid") Integer sid) { 52 | System.out.println("正在查询学生信息 By id " + sid); 53 | return studentService.findById(sid); 54 | } 55 | 56 | @GetMapping("/findByPage/{page}/{size}") 57 | public List findByPage(@PathVariable("page") int page, @PathVariable("size") int size) { 58 | System.out.println("查询学生列表分页 " + page + " " + size); 59 | return studentService.findByPage(page, size); 60 | } 61 | 62 | @GetMapping("/getLength") 63 | public Integer getLength() { 64 | return studentService.getLength(); 65 | } 66 | 67 | @GetMapping("/deleteById/{sid}") 68 | public boolean deleteById(@PathVariable("sid") int sid) { 69 | System.out.println("正在删除学生 sid:" + sid); 70 | return studentService.deleteById(sid); 71 | } 72 | 73 | @PostMapping("/updateStudent") 74 | public boolean updateStudent(@RequestBody Student student) { 75 | System.out.println("更新 " + student); 76 | return studentService.updateById(student); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/controller/TeacherController.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.controller; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import com.auggie.student_server.entity.Teacher; 5 | import com.auggie.student_server.service.TeacherService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * @Auther: auggie 14 | * @Date: 2022/2/9 11:02 15 | * @Description: TeacherController 16 | * @Version 1.0.0 17 | */ 18 | 19 | @RestController 20 | @CrossOrigin("*") 21 | @RequestMapping("/teacher") 22 | public class TeacherController { 23 | @Autowired 24 | private TeacherService teacherService; 25 | 26 | @PostMapping("/addTeacher") 27 | public boolean addTeacher(@RequestBody Teacher teacher) { 28 | return teacherService.save(teacher); 29 | } 30 | 31 | @PostMapping("/login") 32 | public boolean login(@RequestBody Teacher teacher) { 33 | System.out.println("正在验证教师登陆 " + teacher); 34 | Teacher t = teacherService.findById(teacher.getTid()); 35 | System.out.println("数据库教师信息" + t); 36 | if (t == null || !t.getPassword().equals(teacher.getPassword())) { 37 | return false; 38 | } 39 | else { 40 | return true; 41 | } 42 | } 43 | 44 | @GetMapping("/findById/{tid}") 45 | public Teacher findById(@PathVariable("tid") Integer tid) { 46 | System.out.println("正在查询学生信息 By id " + tid); 47 | return teacherService.findById(tid); 48 | } 49 | 50 | @PostMapping("/findBySearch") 51 | public List findBySearch(@RequestBody Map map) { 52 | return teacherService.findBySearch(map); 53 | } 54 | 55 | @GetMapping("/deleteById/{tid}") 56 | public boolean deleteById(@PathVariable("tid") int tid) { 57 | System.out.println("正在删除学生 tid:" + tid); 58 | return teacherService.deleteById(tid); 59 | } 60 | 61 | @PostMapping("/updateTeacher") 62 | public boolean updateTeacher(@RequestBody Teacher teacher) { 63 | System.out.println("更新 " + teacher); 64 | return teacherService.updateById(teacher); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/Course.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/9 13:29 11 | * @Description: Course 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @Alias("Course") 19 | public class Course { 20 | private Integer cid; 21 | private String cname; 22 | private Integer ccredit; 23 | } 24 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/CourseTeacher.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/10 16:55 11 | * @Description: CourseTeacher 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("CourseTeacher") 19 | public class CourseTeacher { 20 | private Integer ctid; 21 | private Integer cid; 22 | private Integer tid; 23 | private String term; 24 | } 25 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/CourseTeacherInfo.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/10 18:45 11 | * @Description: CourseTeacherInfo 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("CourseTeacherInfo") 19 | public class CourseTeacherInfo { 20 | private Integer cid; 21 | private Integer tid; 22 | private String cname; 23 | private String tname; 24 | private Integer ccredit; 25 | private Float grade; 26 | } 27 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/SCTInfo.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/11 11:14 11 | * @Description: SCTInfo 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("SCTInfo") 19 | public class SCTInfo { 20 | private Integer sid; 21 | private Integer tid; 22 | private Integer cid; 23 | private String sname; 24 | private String tname; 25 | private String cname; 26 | private Float grade; 27 | private String term; 28 | } 29 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/8 16:11 11 | * @Description: Student 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("Student") 19 | public class Student { 20 | private Integer sid; 21 | private String sname; 22 | private String password; 23 | } 24 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/StudentCourseTeacher.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/10 19:57 11 | * @Description: StudentCourseTeacher 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("StudentCourseTeacher") 19 | public class StudentCourseTeacher { 20 | private Integer sctid; 21 | private Integer sid; 22 | private Integer cid; 23 | private Integer tid; 24 | private Float grade; 25 | private String term; 26 | } 27 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/entity/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.apache.ibatis.type.Alias; 7 | 8 | /** 9 | * @Auther: auggie 10 | * @Date: 2022/2/9 10:50 11 | * @Description: Teacher 12 | * @Version 1.0.0 13 | */ 14 | 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Alias("Teacher") 19 | public class Teacher { 20 | private Integer tid; 21 | private String tname; 22 | private String password; 23 | } 24 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/mapper/CourseMapper.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.mapper; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: auggie 12 | * @Date: 2022/2/9 13:30 13 | * @Description: CourseMapper 14 | * @Version 1.0.0 15 | */ 16 | 17 | @Repository 18 | @Mapper 19 | public interface CourseMapper { 20 | // select 21 | public List findBySearch(@Param("cid") Integer cid, 22 | @Param("cname") String cname, @Param("fuzzy") Integer fuzzy, 23 | @Param("lowBound") Integer lowBound, @Param("highBound") Integer highBound); 24 | 25 | // insert 26 | public boolean insertCourse(@Param("course") Course course); 27 | 28 | // update 29 | public boolean updateById(@Param("course") Course course); 30 | 31 | // delete 32 | public boolean deleteById(@Param("cid") Integer cid); 33 | } 34 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/mapper/CourseTeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.mapper; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import com.auggie.student_server.entity.CourseTeacher; 5 | import com.auggie.student_server.entity.CourseTeacherInfo; 6 | import lombok.Data; 7 | import org.apache.ibatis.annotations.Delete; 8 | import org.apache.ibatis.annotations.Insert; 9 | import org.apache.ibatis.annotations.Mapper; 10 | import org.apache.ibatis.annotations.Param; 11 | import org.springframework.stereotype.Repository; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @Auther: auggie 17 | * @Date: 2022/2/10 16:43 18 | * @Description: CourseTeacherMapper 19 | * @Version 1.0.0 20 | */ 21 | @Repository 22 | @Mapper 23 | public interface CourseTeacherMapper { 24 | 25 | @Insert("INSERT INTO studentms.ct (cid, tid, term) VALUES (#{cid}, #{tid}, #{term})") 26 | public boolean insertCourseTeacher(@Param("cid") Integer cid, 27 | @Param("tid") Integer tid, 28 | @Param("term") String term); 29 | 30 | public List findBySearch(@Param("cid") Integer cid, 31 | @Param("tid") Integer tid, 32 | @Param("term") String term); 33 | 34 | public List findMyCourse(@Param("tid") Integer tid, 35 | @Param("term") String term); 36 | 37 | public List findCourseTeacherInfo(@Param("tid") Integer tid, 38 | @Param("tname") String tname, 39 | @Param("tFuzzy") Integer tFuzzy, 40 | @Param("cid") Integer cid, 41 | @Param("cname") String cname, 42 | @Param("cFuzzy") Integer cFuzzy); 43 | 44 | @Delete("DELETE FROM studentms.ct WHERE cid = #{c.cid} AND tid = #{c.tid}") 45 | public boolean deleteById(@Param("c") CourseTeacher courseTeacher); 46 | } 47 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/mapper/StudentCourseTeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.mapper; 2 | 3 | import com.auggie.student_server.entity.CourseTeacher; 4 | import com.auggie.student_server.entity.CourseTeacherInfo; 5 | import com.auggie.student_server.entity.SCTInfo; 6 | import com.auggie.student_server.entity.StudentCourseTeacher; 7 | import org.apache.ibatis.annotations.*; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @Auther: auggie 14 | * @Date: 2022/2/10 19:58 15 | * @Description: StudentCourseTeacherMapper 16 | * @Version 1.0.0 17 | */ 18 | 19 | @Repository 20 | @Mapper 21 | public interface StudentCourseTeacherMapper { 22 | 23 | public List findByStudentId(@Param("sid") Integer sid, 24 | @Param("term") String term); 25 | 26 | public List findBySearch(@Param("sid") Integer sid, 27 | @Param("sname") String sname, 28 | @Param("sFuzzy") Integer sFuzzy, 29 | @Param("cid") Integer cid, 30 | @Param("cname") String cname, 31 | @Param("cFuzzy") Integer cFuzzy, 32 | @Param("tid") Integer tid, 33 | @Param("tname") String tname, 34 | @Param("tFuzzy") Integer tFuzzy, 35 | @Param("lowBound") Integer lowBound, 36 | @Param("highBound") Integer highBound, 37 | @Param("term") String term); 38 | 39 | @Select("SELECT DISTINCT sct.term FROM studentms.sct sct") 40 | public List findAllTerm(); 41 | 42 | @Select("SELECT * FROM studentms.sct WHERE sid = #{sct.sid} AND cid = #{sct.cid} AND tid = #{sct.tid} AND term = #{sct.term}") 43 | public List findBySCT(@Param("sct") StudentCourseTeacher studentCourseTeacher); 44 | 45 | @Insert("INSERT INTO studentms.sct (sid, cid, tid, term) VALUES (#{s.sid}, #{s.cid}, #{s.tid}, #{s.term})") 46 | public boolean insert(@Param("s")StudentCourseTeacher studentCourseTeacher); 47 | 48 | @Update("UPDATE studentms.sct SET sct.grade = #{grade} WHERE sct.sid = #{sid} AND sct.tid = #{tid} AND sct.cid = #{cid} AND sct.term = #{term}") 49 | public boolean updateById(@Param("sid") Integer sid, 50 | @Param("cid") Integer cid, 51 | @Param("tid") Integer tid, 52 | @Param("term") String term, 53 | @Param("grade") Integer grade); 54 | 55 | @Delete("DELETE FROM studentms.sct WHERE sid = #{sct.sid} AND tid = #{sct.tid} AND cid = #{sct.cid}") 56 | public boolean deleteBySCT(@Param("sct") StudentCourseTeacher sct); 57 | } 58 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.mapper; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Auther: auggie 12 | * @Date: 2022/2/8 16:12 13 | * @Description: StudentMapper 14 | * @Version 1.0.0 15 | */ 16 | 17 | @Mapper 18 | @Repository 19 | public interface StudentMapper { 20 | 21 | // select 22 | public List findAll(); 23 | 24 | public Student findById(@Param("sid") Integer sid); 25 | 26 | public List findBySearch(@Param("student") Student student, @Param("fuzzy") Integer fuzzy); 27 | 28 | // update 29 | public boolean updateById(@Param("student") Student student); 30 | 31 | // insert 32 | public boolean save(@Param("student") Student student); 33 | 34 | // delete 35 | public boolean deleteById(@Param("sid") Integer sid); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/mapper/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.mapper; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import com.auggie.student_server.entity.Teacher; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @Auther: auggie 13 | * @Date: 2022/2/9 10:51 14 | * @Description: TeacherMapper 15 | * @Version 1.0.0 16 | */ 17 | 18 | @Repository 19 | @Mapper 20 | public interface TeacherMapper { 21 | // select 22 | public List findAll(); 23 | 24 | public Teacher findById(@Param("tid") Integer tid); 25 | 26 | public List findBySearch(@Param("tid") Integer tid, @Param("tname") String tname, @Param("fuzzy") Integer fuzzy); 27 | 28 | // update 29 | public boolean updateById(@Param("teacher") Teacher teacher); 30 | 31 | // insert 32 | public boolean save(@Param("teacher") Teacher teacher); 33 | 34 | // delete 35 | public boolean deleteById(@Param("tid") Integer tid); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/service/CourseService.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.service; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import com.auggie.student_server.mapper.CourseMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @Auther: auggie 15 | * @Date: 2022/2/9 13:46 16 | * @Description: CourseService 17 | * @Version 1.0.0 18 | */ 19 | 20 | @Service 21 | public class CourseService { 22 | @Autowired 23 | private CourseMapper courseMapper; 24 | 25 | public List findBySearch(Map map) { 26 | Integer cid = null; 27 | Integer lowBound = null; 28 | Integer highBound = null; 29 | Integer fuzzy = 0; 30 | String cname = null; 31 | 32 | if (map.containsKey("cid")) { 33 | try { 34 | cid = Integer.parseInt(map.get("cid")); 35 | } 36 | catch (Exception e) { 37 | } 38 | } 39 | if (map.containsKey("lowBound")) { 40 | try { 41 | lowBound = Integer.parseInt(map.get("lowBound")); 42 | } 43 | catch (Exception e) { 44 | } 45 | } 46 | if (map.containsKey("highBound")) { 47 | try { 48 | highBound = Integer.valueOf(map.get("highBound")); 49 | } 50 | catch (Exception e) { 51 | } 52 | } 53 | if (map.containsKey("cname")) { 54 | cname = map.get("cname"); 55 | } 56 | if (map.containsKey("fuzzy")) { 57 | fuzzy = (map.get("fuzzy").equals("true")) ? 1 : 0; 58 | } 59 | System.out.println("查询课程 map:" + map); 60 | System.out.println(cid + " " + cname + " " + fuzzy + " " + lowBound + " " + highBound); 61 | return courseMapper.findBySearch(cid, cname, fuzzy, lowBound, highBound); 62 | } 63 | 64 | public List findBySearch(Integer cid) { 65 | return courseMapper.findBySearch(cid, null, 0, null, null); 66 | } 67 | 68 | public List findById(Integer cid) { 69 | HashMap map = new HashMap<>(); 70 | if (cid != null) 71 | map.put("cid", String.valueOf(cid)); 72 | return findBySearch(map); 73 | } 74 | 75 | public boolean updateById(Course course) { 76 | return courseMapper.updateById(course); 77 | } 78 | 79 | public boolean insertCourse(Course course) { 80 | return courseMapper.insertCourse(course); 81 | } 82 | 83 | public boolean deleteById(Integer cid) { 84 | return courseMapper.deleteById(cid); 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/service/CourseTeacherService.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.service; 2 | 3 | import com.auggie.student_server.entity.Course; 4 | import com.auggie.student_server.entity.CourseTeacher; 5 | import com.auggie.student_server.entity.CourseTeacherInfo; 6 | import com.auggie.student_server.mapper.CourseTeacherMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @Auther: auggie 15 | * @Date: 2022/2/10 16:50 16 | * @Description: CourseTeacherService 17 | * @Version 1.0.0 18 | */ 19 | 20 | @Service 21 | public class CourseTeacherService { 22 | @Autowired 23 | private CourseTeacherMapper courseTeacherMapper; 24 | 25 | public boolean insertCourseTeacher(Integer cid, Integer tid, String term) { 26 | return courseTeacherMapper.insertCourseTeacher(cid, tid, term); 27 | } 28 | 29 | public List findMyCourse(Integer tid, String term) { 30 | return courseTeacherMapper.findMyCourse(tid, term); 31 | } 32 | 33 | public List findCourseTeacherInfo(Map map) { 34 | Integer tid = null, cid = null; 35 | Integer tFuzzy = null, cFuzzy = null; 36 | String tname = null, cname = null; 37 | if (map.containsKey("tid")) { 38 | try { 39 | tid = Integer.parseInt(map.get("tid")); 40 | } 41 | catch (Exception e) { 42 | } 43 | } 44 | if (map.containsKey("cid")) { 45 | try { 46 | cid = Integer.parseInt(map.get("cid")); 47 | } 48 | catch (Exception e) { 49 | } 50 | } 51 | if (map.containsKey("tname")) { 52 | tname = map.get("tname"); 53 | } 54 | if (map.containsKey("cname")) { 55 | cname = map.get("cname"); 56 | } 57 | if (map.containsKey("tFuzzy")) { 58 | tFuzzy = (map.get("tFuzzy").equals("true")) ? 1 : 0; 59 | } 60 | if (map.containsKey("cFuzzy")) { 61 | cFuzzy = (map.get("cFuzzy").equals("true")) ? 1 : 0; 62 | } 63 | System.out.println("ct 模糊查询" + map); 64 | System.out.println(courseTeacherMapper.findCourseTeacherInfo(tid, tname, tFuzzy, cid, cname, cFuzzy)); 65 | return courseTeacherMapper.findCourseTeacherInfo(tid, tname, tFuzzy, cid, cname, cFuzzy); 66 | } 67 | 68 | public List findBySearch(Integer cid, Integer tid, String term) { 69 | return courseTeacherMapper.findBySearch(cid, tid, term); 70 | } 71 | 72 | public List findBySearch(Map map) { 73 | Integer cid = null; 74 | Integer tid = null; 75 | String term = null; 76 | 77 | if (map.containsKey("term")) { 78 | term = map.get("term"); 79 | } 80 | 81 | if (map.containsKey("tid")) { 82 | try { 83 | tid = Integer.parseInt(map.get("tid")); 84 | } 85 | catch (Exception e) { 86 | } 87 | } 88 | 89 | if (map.containsKey("cid")) { 90 | try { 91 | cid = Integer.parseInt(map.get("cid")); 92 | } 93 | catch (Exception e) { 94 | } 95 | } 96 | System.out.println("开课表查询:" + map); 97 | return courseTeacherMapper.findBySearch(cid, tid, term); 98 | } 99 | 100 | public boolean deleteById(CourseTeacher courseTeacher) { 101 | return courseTeacherMapper.deleteById(courseTeacher); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/service/SCTService.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.service; 2 | 3 | import com.auggie.student_server.entity.CourseTeacherInfo; 4 | import com.auggie.student_server.entity.SCTInfo; 5 | import com.auggie.student_server.entity.StudentCourseTeacher; 6 | import com.auggie.student_server.mapper.StudentCourseTeacherMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.HashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @Auther: auggie 16 | * @Date: 2022/2/10 20:10 17 | * @Description: SCTService 18 | * @Version 1.0.0 19 | */ 20 | 21 | @Service 22 | public class SCTService { 23 | @Autowired 24 | private StudentCourseTeacherMapper studentCourseTeacherMapper; 25 | 26 | public List findBySid(Integer sid, String term) { 27 | return studentCourseTeacherMapper.findByStudentId(sid, term); 28 | } 29 | 30 | public List findAllTerm() { 31 | return studentCourseTeacherMapper.findAllTerm(); 32 | } 33 | 34 | public boolean isSCTExist(StudentCourseTeacher studentCourseTeacher) { 35 | return studentCourseTeacherMapper.findBySCT(studentCourseTeacher).size() != 0; 36 | } 37 | 38 | public boolean save(StudentCourseTeacher studentCourseTeacher) { 39 | return studentCourseTeacherMapper.insert(studentCourseTeacher); 40 | } 41 | 42 | public boolean deleteBySCT(StudentCourseTeacher studentCourseTeacher) { 43 | return studentCourseTeacherMapper.deleteBySCT(studentCourseTeacher); 44 | } 45 | 46 | public boolean deleteById(Integer sid, Integer cid, Integer tid, String term) { 47 | StudentCourseTeacher studentCourseTeacher = new StudentCourseTeacher(); 48 | studentCourseTeacher.setSid(sid); 49 | studentCourseTeacher.setCid(cid); 50 | studentCourseTeacher.setTid(tid); 51 | studentCourseTeacher.setTerm(term); 52 | return studentCourseTeacherMapper.deleteBySCT(studentCourseTeacher); 53 | } 54 | 55 | public SCTInfo findByIdWithTerm(Integer sid, Integer cid, Integer tid, String term) { 56 | return studentCourseTeacherMapper.findBySearch( 57 | sid, null, 0, 58 | cid, null, 0, 59 | tid, null, 0, 60 | null, null, term).get(0); 61 | } 62 | 63 | public boolean updateById(Integer sid, Integer cid, Integer tid, String term, Integer grade) { 64 | return studentCourseTeacherMapper.updateById(sid, cid, tid, term, grade); 65 | } 66 | 67 | public List findBySearch(Map map) { 68 | Integer sid = null, cid = null, tid = null; 69 | String sname = null, cname = null, tname = null, term = null; 70 | Integer sFuzzy = null, cFuzzy = null, tFuzzy = null; 71 | Integer lowBound = null, highBound = null; 72 | 73 | if (map.containsKey("cid")) { 74 | try { 75 | cid = Integer.parseInt(map.get("cid")); 76 | } 77 | catch (Exception e) { 78 | } 79 | } 80 | if (map.containsKey("sid")) { 81 | try { 82 | sid = Integer.parseInt(map.get("sid")); 83 | } 84 | catch (Exception e) { 85 | } 86 | } 87 | if (map.containsKey("tid")) { 88 | try { 89 | tid = Integer.parseInt(map.get("tid")); 90 | } 91 | catch (Exception e) { 92 | } 93 | } 94 | if (map.containsKey("sname")) { 95 | sname = map.get("sname"); 96 | } 97 | if (map.containsKey("tname")) { 98 | tname = map.get("tname"); 99 | } 100 | if (map.containsKey("cname")) { 101 | cname = map.get("cname"); 102 | } 103 | if (map.containsKey("term")) { 104 | term = map.get("term"); 105 | } 106 | if (map.containsKey("sFuzzy")) { 107 | sFuzzy = map.get("sFuzzy").equals("true") ? 1 : 0; 108 | } 109 | if (map.containsKey("tFuzzy")) { 110 | tFuzzy = map.get("tFuzzy").equals("true") ? 1 : 0; 111 | } 112 | if (map.containsKey("cFuzzy")) { 113 | cFuzzy = map.get("cFuzzy").equals("true") ? 1 : 0; 114 | } 115 | if (map.containsKey("lowBound")) { 116 | try { 117 | lowBound = Integer.parseInt(map.get("lowBound")); 118 | } 119 | catch (Exception e) { 120 | } 121 | } 122 | if (map.containsKey("highBound")) { 123 | try { 124 | highBound = Integer.valueOf(map.get("highBound")); 125 | } 126 | catch (Exception e) { 127 | } 128 | } 129 | 130 | System.out.println("SCT 查询:" + map); 131 | return studentCourseTeacherMapper.findBySearch( 132 | sid, sname, sFuzzy, 133 | cid, cname, cFuzzy, 134 | tid, tname, tFuzzy, 135 | lowBound, highBound, term); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.service; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import com.auggie.student_server.mapper.StudentMapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * @Auther: auggie 14 | * @Date: 2022/2/9 08:27 15 | * @Description: StudentService 16 | * @Version 1.0.0 17 | */ 18 | 19 | @Service 20 | public class StudentService { 21 | @Autowired 22 | private StudentMapper studentMapper; 23 | 24 | public List findByPage(Integer num, Integer size) { 25 | // num:第几页,size:一页多大 26 | // num:从零开始 27 | List studentList = studentMapper.findAll(); 28 | ArrayList list = new ArrayList(); 29 | 30 | int start = size * num; 31 | int end = size * (num + 1); 32 | int sz = studentList.size(); 33 | 34 | for (int i = start; i < end && i < sz; i++) { 35 | list.add(studentList.get(i)); 36 | } 37 | 38 | return list; 39 | } 40 | 41 | public List findBySearch(Integer sid, String sname, Integer fuzzy) { 42 | Student student = new Student(); 43 | student.setSid(sid); 44 | student.setSname(sname); 45 | fuzzy = (fuzzy == null) ? 0 : fuzzy; 46 | 47 | System.out.println(); 48 | 49 | return studentMapper.findBySearch(student, fuzzy); 50 | } 51 | 52 | public Integer getLength() { 53 | return studentMapper.findAll().size(); 54 | } 55 | 56 | public Student findById(Integer sid) { 57 | return studentMapper.findById(sid); 58 | } 59 | 60 | public boolean updateById(Student student) { 61 | return studentMapper.updateById(student); 62 | } 63 | 64 | public boolean save(Student student) { 65 | return studentMapper.save(student); 66 | } 67 | 68 | public boolean deleteById(Integer sid) { 69 | return studentMapper.deleteById(sid); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /student-server/src/main/java/com/auggie/student_server/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package com.auggie.student_server.service; 2 | 3 | import com.auggie.student_server.entity.Student; 4 | import com.auggie.student_server.entity.Teacher; 5 | import com.auggie.student_server.mapper.StudentMapper; 6 | import com.auggie.student_server.mapper.TeacherMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @Auther: auggie 16 | * @Date: 2022/2/9 10:55 17 | * @Description: TeacherService 18 | * @Version 1.0.0 19 | */ 20 | 21 | @Service 22 | public class TeacherService { 23 | @Autowired 24 | private TeacherMapper teacherMapper; 25 | 26 | public List findBySearch(Map map) { 27 | Integer tid = null; 28 | String tname = null; 29 | Integer fuzzy = null; 30 | if (map.containsKey("tid")) { 31 | try { 32 | tid = Integer.parseInt(map.get("tid")); 33 | } 34 | catch (Exception e) { 35 | } 36 | } 37 | if (map.containsKey("tname")) { 38 | tname = map.get("tname"); 39 | } 40 | if (map.containsKey("fuzzy")) { 41 | fuzzy = map.get("fuzzy").equals("true") ? 1 : 0; 42 | } 43 | System.out.println(map); 44 | System.out.println("查询类型:" + tid + ", " + tname + ", " + fuzzy); 45 | return teacherMapper.findBySearch(tid, tname, fuzzy); 46 | } 47 | 48 | public List findByPage(Integer num, Integer size) { 49 | // num:第几页,size:一页多大 50 | // num:从零开始 51 | List teacherList = teacherMapper.findAll(); 52 | ArrayList list = new ArrayList(); 53 | 54 | int start = size * num; 55 | int end = size * (num + 1); 56 | int sz = teacherList.size(); 57 | 58 | for (int i = start; i < end && i < sz; i++) { 59 | list.add(teacherList.get(i)); 60 | } 61 | 62 | return list; 63 | } 64 | 65 | public Integer getLength() { 66 | return teacherMapper.findAll().size(); 67 | } 68 | 69 | public Teacher findById(Integer tid) { 70 | return teacherMapper.findById(tid); 71 | } 72 | 73 | public boolean updateById(Teacher teacher) { 74 | return teacherMapper.updateById(teacher); 75 | } 76 | 77 | public boolean save(Teacher teacher) { 78 | return teacherMapper.save(teacher); 79 | } 80 | 81 | public boolean deleteById(Integer tid) { 82 | return teacherMapper.deleteById(tid); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /student-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.cj.jdbc.Driver 4 | url: jdbc:mysql://localhost:3306/studentms?setUnicode=true&characterEncoding=utf8&useAffectedRows=true 5 | username: root 6 | password: 123456 7 | 8 | mybatis: 9 | type-aliases-package: com.auggie.student_server.entity 10 | mapper-locations: classpath:mapper/*.xml 11 | 12 | server: 13 | port: 10086 -------------------------------------------------------------------------------- /student-server/src/main/resources/mapper/CourseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 28 | 29 | 30 | UPDATE studentms.c SET 31 | cname = #{course.cname}, 32 | ccredit = #{course.ccredit} 33 | WHERE cid = #{course.cid}; 34 | 35 | 36 | 37 | INSERT INTO studentms.c (cname, ccredit) VALUES (#{course.cname}, #{course.ccredit}) 38 | 39 | 40 | 41 | DELETE FROM studentms.c WHERE cid = #{cid} 42 | 43 | -------------------------------------------------------------------------------- /student-server/src/main/resources/mapper/CourseTeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 20 | 21 | 26 | 27 | 56 | -------------------------------------------------------------------------------- /student-server/src/main/resources/mapper/StudentCourseTeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 | 63 | -------------------------------------------------------------------------------- /student-server/src/main/resources/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 13 | 14 | 30 | 31 | 32 | UPDATE studentms.s SET 33 | sname = #{student.sname}, 34 | password = #{student.password} 35 | WHERE sid = #{student.sid}; 36 | 37 | 38 | 39 | INSERT INTO studentms.s (sname, password) VALUES (#{student.sname}, #{student.password}) 40 | 41 | 42 | 43 | DELETE FROM studentms.s WHERE sid = #{sid} 44 | 45 | -------------------------------------------------------------------------------- /student-server/src/main/resources/mapper/TeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 26 | 27 | 30 | 31 | 32 | UPDATE studentms.t SET 33 | tname = #{teacher.tname}, 34 | password = #{teacher.password} 35 | WHERE tid = #{teacher.tid}; 36 | 37 | 38 | 39 | INSERT INTO studentms.t (tname, password) VALUES (#{teacher.tname}, #{teacher.password}) 40 | 41 | 42 | 43 | DELETE FROM studentms.t WHERE tid = #{tid} 44 | 45 | -------------------------------------------------------------------------------- /student-server/src/main/resources/studentms.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Ultimate v11.33 (64 bit) 3 | MySQL - 5.7.18-log : Database - studentms 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`studentms` /*!40100 DEFAULT CHARACTER SET utf8 */; 16 | 17 | USE `studentms`; 18 | 19 | /*Table structure for table `c` */ 20 | 21 | DROP TABLE IF EXISTS `c`; 22 | 23 | CREATE TABLE `c` ( 24 | `cid` int(11) NOT NULL AUTO_INCREMENT, 25 | `cname` varchar(30) NOT NULL, 26 | `ccredit` tinyint(4) DEFAULT NULL, 27 | PRIMARY KEY (`cid`) 28 | ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4; 29 | 30 | /*Data for the table `c` */ 31 | 32 | insert into `c`(`cid`,`cname`,`ccredit`) values (7,'数据结构',6),(8,'组合数学',3),(9,'计算机网络',5),(10,'计算机组成原理',5),(11,'RJC教你做选课系统',10),(12,'test说',22); 33 | 34 | /*Table structure for table `ct` */ 35 | 36 | DROP TABLE IF EXISTS `ct`; 37 | 38 | CREATE TABLE `ct` ( 39 | `ctid` int(11) NOT NULL AUTO_INCREMENT, 40 | `cid` int(11) DEFAULT NULL, 41 | `tid` int(11) DEFAULT NULL, 42 | `term` varchar(30) NOT NULL, 43 | PRIMARY KEY (`ctid`), 44 | KEY `cid` (`cid`), 45 | KEY `tid` (`tid`), 46 | CONSTRAINT `ct_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `c` (`cid`), 47 | CONSTRAINT `ct_ibfk_2` FOREIGN KEY (`tid`) REFERENCES `t` (`tid`) 48 | ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4; 49 | 50 | /*Data for the table `ct` */ 51 | 52 | insert into `ct`(`ctid`,`cid`,`tid`,`term`) values (5,8,4,'22-春季学期'),(6,7,4,'22-春季学期'),(7,10,13,'22-春季学期'),(8,9,13,'22-春季学期'),(9,11,4,'22-春季学期'),(10,9,4,'22-春季学期'); 53 | 54 | /*Table structure for table `s` */ 55 | 56 | DROP TABLE IF EXISTS `s`; 57 | 58 | CREATE TABLE `s` ( 59 | `sid` int(11) NOT NULL AUTO_INCREMENT, 60 | `sname` varchar(30) NOT NULL, 61 | `password` varchar(30) NOT NULL, 62 | PRIMARY KEY (`sid`) 63 | ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4; 64 | 65 | /*Data for the table `s` */ 66 | 67 | insert into `s`(`sid`,`sname`,`password`) values (1,'阮健乘','1234'),(2,'张四','123'),(3,'李四','1234'),(4,'彭昊辉','123456'),(6,'林春霞','123'),(7,'董一超','12345'),(8,'董超','123'),(9,'张千','10086'),(10,'李万','10085'),(14,'薇尔莉特','123'),(21,'庄亮','123'),(22,'钟平','1234'),(23,'李煜豪','123'); 68 | 69 | /*Table structure for table `sct` */ 70 | 71 | DROP TABLE IF EXISTS `sct`; 72 | 73 | CREATE TABLE `sct` ( 74 | `sctid` int(11) NOT NULL AUTO_INCREMENT, 75 | `sid` int(11) DEFAULT NULL, 76 | `cid` int(11) DEFAULT NULL, 77 | `tid` int(11) DEFAULT NULL, 78 | `grade` float DEFAULT NULL, 79 | `term` varchar(30) DEFAULT NULL, 80 | PRIMARY KEY (`sctid`), 81 | KEY `sid` (`sid`), 82 | KEY `tid` (`tid`), 83 | KEY `cid` (`cid`), 84 | CONSTRAINT `sct_ibfk_1` FOREIGN KEY (`sid`) REFERENCES `s` (`sid`), 85 | CONSTRAINT `sct_ibfk_2` FOREIGN KEY (`tid`) REFERENCES `ct` (`tid`), 86 | CONSTRAINT `sct_ibfk_3` FOREIGN KEY (`cid`) REFERENCES `ct` (`cid`) 87 | ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4; 88 | 89 | /*Data for the table `sct` */ 90 | 91 | insert into `sct`(`sctid`,`sid`,`cid`,`tid`,`grade`,`term`) values (10,2,8,4,2,'22-春季学期'),(11,2,10,13,NULL,'22-春季学期'),(12,2,7,4,5,'22-春季学期'),(13,4,8,4,10,'22-春季学期'),(14,4,7,4,NULL,'22-春季学期'),(15,4,10,13,NULL,'22-春季学期'),(16,1,8,4,NULL,'22-春季学期'),(17,1,10,13,NULL,'22-春季学期'); 92 | 93 | /*Table structure for table `t` */ 94 | 95 | DROP TABLE IF EXISTS `t`; 96 | 97 | CREATE TABLE `t` ( 98 | `tid` int(11) NOT NULL AUTO_INCREMENT, 99 | `tname` varchar(30) NOT NULL, 100 | `password` varchar(30) NOT NULL, 101 | PRIMARY KEY (`tid`) 102 | ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4; 103 | 104 | /*Data for the table `t` */ 105 | 106 | insert into `t`(`tid`,`tname`,`password`) values (4,'李玉民','1234'),(6,'admin','123'),(13,'张三','123'),(14,'王五2','12334'); 107 | 108 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 109 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 110 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 111 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 112 | --------------------------------------------------------------------------------