├── .gitignore ├── .idea ├── codeStyles │ └── codeStyleConfig.xml ├── compiler.xml ├── encodings.xml ├── junitgenerator-prj-settings.xml ├── misc.xml ├── uiDesigner.xml └── workspace.xml ├── LICENSE ├── README.md ├── SSMStuSys.iml ├── pom.xml ├── src └── main │ ├── java │ └── com │ │ └── shpun │ │ ├── controller │ │ ├── CourseController.java │ │ ├── LoginController.java │ │ ├── ManagerController.java │ │ ├── ScoreController.java │ │ └── StudentController.java │ │ ├── dao │ │ ├── CourseDao.java │ │ ├── ScoreDao.java │ │ ├── StudentDao.java │ │ └── TeacherDao.java │ │ ├── pojo │ │ ├── Course.java │ │ ├── Login.java │ │ ├── RequestCourse.java │ │ ├── RequestScore.java │ │ ├── Score.java │ │ ├── Student.java │ │ └── Teacher.java │ │ └── service │ │ ├── CourseService.java │ │ ├── ScoreService.java │ │ ├── StudentService.java │ │ ├── TeacherService.java │ │ └── impl │ │ ├── CourseServiceImpl.java │ │ ├── ScoreServiceImpl.java │ │ ├── StudentServiceImpl.java │ │ └── TeacherServiceImpl.java │ ├── resources │ ├── image │ │ ├── 修改.PNG │ │ ├── 学生管理.PNG │ │ ├── 成绩管理.PNG │ │ ├── 查询.PNG │ │ ├── 添加.PNG │ │ ├── 登录失败.PNG │ │ └── 课程管理.PNG │ ├── jdbcMysql.properties │ ├── log4j.properties │ ├── mapper │ │ ├── CourseMapper.xml │ │ ├── ScoreMapper.xml │ │ ├── StudentMapper.xml │ │ └── TeacherMapper.xml │ ├── mybatis-config.xml │ ├── spring │ │ ├── spring-dao.xml │ │ ├── spring-mvc.xml │ │ └── spring-service.xml │ └── studentsystem.sql │ └── webapp │ ├── WEB-INF │ ├── css │ │ └── bootstrap.min.css │ ├── js │ │ ├── bootstrap.min.js │ │ ├── course.js │ │ ├── jquery-3.3.1.min.js │ │ ├── popper.min.js │ │ ├── score.js │ │ └── student.js │ ├── jsp │ │ ├── course.jsp │ │ ├── courseResult.jsp │ │ ├── score.jsp │ │ ├── scoreResult.jsp │ │ ├── student.jsp │ │ └── studentResult.jsp │ └── web.xml │ └── index.jsp ├── target ├── SSMStuSys │ ├── META-INF │ │ └── MANIFEST.MF │ ├── WEB-INF │ │ ├── classes │ │ │ ├── META-INF │ │ │ │ └── spring.components │ │ │ ├── jdbcMysql.properties │ │ │ ├── log4j.properties │ │ │ ├── mapper │ │ │ │ ├── CourseMapper.xml │ │ │ │ ├── ScoreMapper.xml │ │ │ │ ├── StudentMapper.xml │ │ │ │ └── TeacherMapper.xml │ │ │ ├── mybatis-config.xml │ │ │ └── spring │ │ │ │ ├── spring-dao.xml │ │ │ │ ├── spring-mvc.xml │ │ │ │ └── spring-service.xml │ │ ├── css │ │ │ └── bootstrap.min.css │ │ ├── js │ │ │ ├── bootstrap.min.js │ │ │ ├── course.js │ │ │ ├── jquery-3.3.1.min.js │ │ │ ├── popper.min.js │ │ │ ├── score.js │ │ │ └── student.js │ │ ├── jsp │ │ │ ├── course.jsp │ │ │ ├── courseResult.jsp │ │ │ ├── score.jsp │ │ │ ├── scoreResult.jsp │ │ │ ├── student.jsp │ │ │ └── studentResult.jsp │ │ └── web.xml │ └── index.jsp └── classes │ ├── META-INF │ └── spring.components │ ├── jdbcMysql.properties │ ├── log4j.properties │ ├── mapper │ ├── CourseMapper.xml │ ├── ScoreMapper.xml │ ├── StudentMapper.xml │ └── TeacherMapper.xml │ ├── mybatis-config.xml │ └── spring │ ├── spring-dao.xml │ ├── spring-mvc.xml │ └── spring-service.xml └── test └── com └── shpun └── service ├── TestCourseService.java ├── TestScoreService.java ├── TestStudentService.java └── TestTeacherService.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/junitgenerator-prj-settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ssmStudent 2 | ### 基于SSM框架的学籍管理系统 3 | 前端采用bootstrap完成管理页面布局
4 | 后端采用Spring+SpringMVC+Mybatis+Mysql
5 | 分页使用PageHelper的分页插件
6 | 7 | 登录使用Ajax进行json交互,登录失败返回“登录失败”信息的json,登录成功返回“下一个路径”的json,用于页面跳转
8 | 实现学生管理,对学生单表的增删改查;
9 | 实现课程管理,教师表与课程表的两表的增删改查;
10 | 实现成绩管理,学生表,成绩表及课程表的三表的增删改查。
11 | 12 | ## 效果 13 | 登录页面 登录失败显示
14 | 15 | 16 | 学生管理页面
17 | 18 | 19 | 添加弹出模态框
20 | 21 | 22 | 修改弹出模态框,并且数据自动填入
23 | 24 | 25 | 查询返回查询页面
26 | 27 | 28 | 课程管理
29 | 30 | 31 | 成绩管理
32 | 33 | -------------------------------------------------------------------------------- /SSMStuSys.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | SSMStuSys 8 | SSMStuSys 9 | 1.0-SNAPSHOT 10 | war 11 | 12 | SSMStuSys Maven Webapp 13 | 14 | http://www.example.com 15 | 16 | 17 | UTF-8 18 | 1.7 19 | 1.7 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | junit 32 | junit 33 | 4.12 34 | test 35 | 36 | 37 | 38 | 39 | javax 40 | javaee-api 41 | 8.0 42 | 43 | 44 | javax.servlet 45 | javax.servlet-api 46 | 4.0.1 47 | provided 48 | 49 | 50 | javax.servlet 51 | jstl 52 | 1.1.2 53 | 54 | 55 | taglibs 56 | standard 57 | 1.1.2 58 | 59 | 60 | 61 | 62 | aopalliance 63 | aopalliance 64 | 1.0 65 | 66 | 67 | commons-logging 68 | commons-logging 69 | 1.2 70 | 71 | 72 | org.springframework 73 | spring-aop 74 | 5.0.8.RELEASE 75 | 76 | 77 | org.springframework 78 | spring-aspects 79 | 5.0.8.RELEASE 80 | 81 | 82 | org.springframework 83 | spring-beans 84 | 5.0.8.RELEASE 85 | 86 | 87 | org.springframework 88 | spring-context 89 | 5.0.8.RELEASE 90 | 91 | 92 | org.springframework 93 | spring-context-support 94 | 5.0.8.RELEASE 95 | 96 | 97 | org.springframework 98 | spring-context-indexer 99 | 5.0.8.RELEASE 100 | optional 101 | 102 | 103 | org.springframework 104 | spring-core 105 | 5.0.8.RELEASE 106 | 107 | 108 | org.springframework 109 | spring-expression 110 | 5.0.8.RELEASE 111 | 112 | 113 | org.springframework 114 | spring-instrument 115 | 5.0.8.RELEASE 116 | 117 | 118 | org.springframework 119 | spring-jcl 120 | 5.0.8.RELEASE 121 | 122 | 123 | org.springframework 124 | spring-jdbc 125 | 5.0.8.RELEASE 126 | 127 | 128 | org.springframework 129 | spring-jms 130 | 5.0.8.RELEASE 131 | 132 | 133 | org.springframework 134 | spring-messaging 135 | 5.0.8.RELEASE 136 | 137 | 138 | org.springframework 139 | spring-orm 140 | 5.0.8.RELEASE 141 | 142 | 143 | org.springframework 144 | spring-oxm 145 | 5.0.8.RELEASE 146 | 147 | 148 | org.springframework 149 | spring-test 150 | 5.0.8.RELEASE 151 | test 152 | 153 | 154 | org.springframework 155 | spring-tx 156 | 5.0.8.RELEASE 157 | 158 | 159 | org.springframework 160 | spring-web 161 | 5.0.8.RELEASE 162 | 163 | 164 | org.springframework 165 | spring-webflux 166 | 5.0.8.RELEASE 167 | 168 | 169 | org.springframework 170 | spring-webmvc 171 | 5.0.8.RELEASE 172 | 173 | 174 | org.springframework 175 | spring-websocket 176 | 5.0.8.RELEASE 177 | 178 | 179 | 180 | 181 | org.aspectj 182 | aspectjweaver 183 | 1.9.1 184 | 185 | 186 | 187 | 188 | com.fasterxml.jackson.core 189 | jackson-databind 190 | 2.9.6 191 | 192 | 193 | com.fasterxml.jackson.core 194 | jackson-core 195 | 2.9.6 196 | 197 | 198 | com.fasterxml.jackson.core 199 | jackson-annotations 200 | 2.9.6 201 | 202 | 203 | 204 | 205 | org.mybatis 206 | mybatis 207 | 3.4.6 208 | 209 | 210 | org.mybatis 211 | mybatis-spring 212 | 1.3.2 213 | 214 | 215 | 216 | log4j 217 | log4j 218 | 1.2.17 219 | 220 | 221 | 222 | 223 | com.github.pagehelper 224 | pagehelper 225 | 5.1.4 226 | 227 | 228 | 229 | 230 | mysql 231 | mysql-connector-java 232 | 5.1.39 233 | 234 | 235 | 236 | 237 | com.mchange 238 | c3p0 239 | 0.9.5.2 240 | 241 | 242 | 243 | 244 | 245 | SSMStuSys 246 | 247 | 248 | 249 | maven-clean-plugin 250 | 3.0.0 251 | 252 | 253 | 254 | maven-resources-plugin 255 | 3.0.2 256 | 257 | 258 | maven-compiler-plugin 259 | 3.7.0 260 | 261 | 262 | maven-surefire-plugin 263 | 2.20.1 264 | 265 | 266 | maven-war-plugin 267 | 3.2.0 268 | 269 | 270 | maven-install-plugin 271 | 2.5.2 272 | 273 | 274 | maven-deploy-plugin 275 | 2.8.2 276 | 277 | 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/controller/CourseController.java: -------------------------------------------------------------------------------- 1 | package com.shpun.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.shpun.pojo.Course; 6 | import com.shpun.pojo.RequestCourse; 7 | import com.shpun.pojo.Student; 8 | import com.shpun.pojo.Teacher; 9 | import com.shpun.service.CourseService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.servlet.ModelAndView; 16 | 17 | import java.util.List; 18 | 19 | @Controller 20 | @RequestMapping("/course") 21 | public class CourseController { 22 | 23 | public static final int PAGE_SIZE = 5; 24 | 25 | @Autowired 26 | private CourseService courseService; 27 | 28 | @RequestMapping(value = "/insert",method = RequestMethod.POST) 29 | public String insertStudent(RequestCourse requestCourse){ 30 | 31 | Course course = new Course(); 32 | course.setCourseName(requestCourse.getCourseName()); 33 | 34 | Teacher teacher = new Teacher(); 35 | teacher.setTeacherId(requestCourse.getTeacherId()); 36 | course.setTeacher(teacher); 37 | 38 | course.setCourseCredit(requestCourse.getCourseCredit()); 39 | 40 | courseService.insertCourse(course); 41 | 42 | return "redirect:/manager/course"; 43 | } 44 | 45 | @RequestMapping(value = "/delete",method = RequestMethod.GET) 46 | public String deleteStudent(int courseId){ 47 | 48 | courseService.deleteCourse(courseId); 49 | 50 | return "redirect:/manager/course"; 51 | } 52 | 53 | @RequestMapping(value = "/update",method = RequestMethod.POST) 54 | public String updateStudent(RequestCourse requestCourse){ 55 | 56 | Course course = new Course(); 57 | course.setCourseId(requestCourse.getCourseId()); 58 | course.setCourseName(requestCourse.getCourseName()); 59 | 60 | Teacher teacher = new Teacher(); 61 | teacher.setTeacherId(requestCourse.getTeacherId()); 62 | course.setTeacher(teacher); 63 | 64 | course.setCourseCredit(requestCourse.getCourseCredit()); 65 | 66 | courseService.updateCourse(course); 67 | 68 | return "redirect:/manager/course"; 69 | } 70 | 71 | 72 | @RequestMapping(value = "/search",method = RequestMethod.GET) 73 | public ModelAndView searchStudent(@RequestParam(value = "pnC",defaultValue = "1")Integer pnC,String searchCourse){ 74 | 75 | PageHelper.startPage(pnC,PAGE_SIZE); 76 | 77 | List courseList = courseService.searchFromCourse(searchCourse); 78 | 79 | PageInfo coursePageInfo = new PageInfo<>(courseList); 80 | ModelAndView mv = new ModelAndView(); 81 | mv.setViewName("courseResult"); 82 | mv.addObject("coursePageInfo",coursePageInfo); 83 | 84 | return mv; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.shpun.controller; 2 | 3 | import com.shpun.pojo.Login; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.RequestBody; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import org.springframework.web.servlet.view.json.MappingJackson2JsonView; 11 | 12 | @Controller 13 | @RequestMapping("/login") 14 | public class LoginController { 15 | 16 | /** 17 | * 返回json 18 | * @param login 19 | * @return 20 | */ 21 | @RequestMapping(value = "/toLogin",method = RequestMethod.POST) 22 | public ModelAndView toLogin(@RequestBody Login login){ 23 | 24 | System.out.println("login : "+login.getUsername() + " " + login.getPassword()); 25 | 26 | ModelAndView mv = new ModelAndView(); 27 | 28 | if("admin".equals(login.getUsername()) && "admin".equals(login.getPassword())){ 29 | String url = "/manager/student"; 30 | mv.addObject("url",url); 31 | }else{ 32 | String failure = "登录失败"; 33 | mv.addObject("login",failure); 34 | } 35 | 36 | mv.setView(new MappingJackson2JsonView()); 37 | return mv; 38 | 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/controller/ManagerController.java: -------------------------------------------------------------------------------- 1 | package com.shpun.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.shpun.pojo.Course; 6 | import com.shpun.pojo.Score; 7 | import com.shpun.pojo.Student; 8 | import com.shpun.service.CourseService; 9 | import com.shpun.service.ScoreService; 10 | import com.shpun.service.StudentService; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.servlet.ModelAndView; 16 | 17 | import java.util.List; 18 | 19 | @Controller 20 | @RequestMapping("/manager") 21 | public class ManagerController { 22 | 23 | public static final int PAGE_SIZE = 5; 24 | 25 | @Autowired 26 | private StudentService studentService; 27 | 28 | @Autowired 29 | private CourseService courseService; 30 | 31 | @Autowired 32 | private ScoreService scoreService; 33 | 34 | /** 35 | * 返回student.jsp 36 | * @param pnS 37 | * @return 38 | */ 39 | @RequestMapping("/student") 40 | public ModelAndView getStudent(@RequestParam(value = "pnS",defaultValue = "1")Integer pnS){ 41 | 42 | PageHelper.startPage(pnS,PAGE_SIZE); 43 | 44 | List studentList = studentService.selectAllStudents(); 45 | 46 | PageInfo studentPageInfo = new PageInfo<>(studentList); 47 | 48 | ModelAndView mv = new ModelAndView(); 49 | mv.setViewName("student"); 50 | mv.addObject("studentPageInfo",studentPageInfo); 51 | 52 | return mv; 53 | 54 | } 55 | 56 | /** 57 | * 返回course.jsp 58 | * @param pnC 59 | * @return 60 | */ 61 | @RequestMapping("/course") 62 | public ModelAndView getCourse(@RequestParam(value = "pnC",defaultValue = "1")Integer pnC){ 63 | 64 | PageHelper.startPage(pnC,PAGE_SIZE); 65 | 66 | List courseList = courseService.selectAllCourses(); 67 | 68 | PageInfo coursePageInfo = new PageInfo<>(courseList); 69 | ModelAndView mv = new ModelAndView(); 70 | mv.setViewName("course"); 71 | mv.addObject("coursePageInfo",coursePageInfo); 72 | 73 | return mv; 74 | 75 | } 76 | 77 | /** 78 | * 返回score.jsp 79 | * @param pnSC 80 | * @return 81 | */ 82 | @RequestMapping("/score") 83 | public ModelAndView getScore(@RequestParam(value = "pnSC",defaultValue = "1")Integer pnSC){ 84 | 85 | PageHelper.startPage(pnSC,PAGE_SIZE); 86 | 87 | List scoreList = scoreService.selectAllScores(); 88 | 89 | PageInfo scorePageInfo = new PageInfo<>(scoreList); 90 | ModelAndView mv = new ModelAndView(); 91 | mv.setViewName("score"); 92 | mv.addObject("scorePageInfo",scorePageInfo); 93 | 94 | return mv; 95 | 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/controller/ScoreController.java: -------------------------------------------------------------------------------- 1 | package com.shpun.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.shpun.pojo.*; 6 | import com.shpun.service.ScoreService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.servlet.ModelAndView; 13 | 14 | import java.util.List; 15 | 16 | @Controller 17 | @RequestMapping("/score") 18 | public class ScoreController { 19 | 20 | public static final int PAGE_SIZE = 5; 21 | 22 | @Autowired 23 | private ScoreService scoreService; 24 | 25 | @RequestMapping(value = "/insert",method = RequestMethod.POST) 26 | public String insertStudent(RequestScore requestScore){ 27 | 28 | Score score = new Score(); 29 | 30 | Course course = new Course(); 31 | course.setCourseId(requestScore.getCourseId()); 32 | Student student = new Student(); 33 | student.setStudentId(requestScore.getStudentId()); 34 | 35 | score.setCourse(course); 36 | score.setStudent(student); 37 | score.setStuCouScore(requestScore.getCourseScore()); 38 | 39 | scoreService.insertScore(score); 40 | 41 | return "redirect:/manager/score"; 42 | } 43 | 44 | @RequestMapping(value = "/delete",method = RequestMethod.GET) 45 | public String deleteStudent(@RequestParam("studentId") int studentId,@RequestParam("courseId") int courseId){ 46 | 47 | Score score = new Score(); 48 | 49 | Student student = new Student(); 50 | student.setStudentId(studentId); 51 | Course course = new Course(); 52 | course.setCourseId(courseId); 53 | 54 | score.setCourse(course); 55 | score.setStudent(student); 56 | 57 | scoreService.deleteScore(score); 58 | 59 | return "redirect:/manager/score"; 60 | } 61 | 62 | @RequestMapping(value = "/update",method = RequestMethod.POST) 63 | public String updateStudent(RequestScore requestScore){ 64 | 65 | Score score = new Score(); 66 | 67 | Course course = new Course(); 68 | course.setCourseId(requestScore.getCourseId()); 69 | Student student = new Student(); 70 | student.setStudentId(requestScore.getStudentId()); 71 | 72 | score.setCourse(course); 73 | score.setStudent(student); 74 | score.setStuCouScore(requestScore.getCourseScore()); 75 | 76 | scoreService.updateScore(score); 77 | 78 | return "redirect:/manager/score"; 79 | } 80 | 81 | 82 | @RequestMapping(value = "/search",method = RequestMethod.GET) 83 | public ModelAndView searchStudent(@RequestParam(value = "pnSC",defaultValue = "1")Integer pnSC,String searchStuCou){ 84 | 85 | PageHelper.startPage(pnSC,PAGE_SIZE); 86 | 87 | List scoreList = scoreService.searchFromScore(searchStuCou); 88 | 89 | PageInfo scorePageInfo = new PageInfo<>(scoreList); 90 | ModelAndView mv = new ModelAndView(); 91 | mv.setViewName("scoreResult"); 92 | mv.addObject("scorePageInfo",scorePageInfo); 93 | 94 | return mv; 95 | 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.shpun.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.shpun.pojo.Student; 6 | import com.shpun.service.StudentService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.servlet.ModelAndView; 14 | 15 | import java.util.List; 16 | 17 | @Controller 18 | @RequestMapping("/student") 19 | public class StudentController { 20 | 21 | public static final int PAGE_SIZE = 5; 22 | 23 | @Autowired 24 | private StudentService studentService; 25 | 26 | @RequestMapping(value = "/insert",method = RequestMethod.POST) 27 | public String insertStudent(Student student){ 28 | 29 | studentService.insertStudent(student); 30 | 31 | return "redirect:/manager/student"; 32 | } 33 | 34 | @RequestMapping(value = "/delete",method = RequestMethod.GET) 35 | public String deleteStudent(int studentId){ 36 | 37 | studentService.deleteStudent(studentId); 38 | 39 | return "redirect:/manager/student"; 40 | } 41 | 42 | @RequestMapping(value = "/update",method = RequestMethod.POST) 43 | public String updateStudent(Student student){ 44 | 45 | studentService.updateStudent(student); 46 | 47 | return "redirect:/manager/student"; 48 | } 49 | 50 | @RequestMapping(value = "/search",method = RequestMethod.GET) 51 | public ModelAndView searchStudent(@RequestParam(value = "pnS",defaultValue = "1")Integer pnS,String searchStudent){ 52 | 53 | PageHelper.startPage(pnS,PAGE_SIZE); 54 | 55 | List studentList = studentService.searchFromStudent(searchStudent); 56 | 57 | PageInfo studentPageInfo = new PageInfo<>(studentList); 58 | 59 | ModelAndView mv = new ModelAndView(); 60 | mv.setViewName("studentResult"); 61 | mv.addObject("studentPageInfo",studentPageInfo); 62 | 63 | return mv; 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/dao/CourseDao.java: -------------------------------------------------------------------------------- 1 | package com.shpun.dao; 2 | 3 | import com.shpun.pojo.Course; 4 | import com.shpun.pojo.Student; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface CourseDao { 11 | 12 | int insertCourse(Course course); 13 | 14 | int deleteCourse(int courseId); 15 | 16 | int updateCourse(Course course); 17 | 18 | List searchFromCourse(String s); 19 | 20 | Course selectCourseById(int courseId); 21 | 22 | List selectAllCourses(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/dao/ScoreDao.java: -------------------------------------------------------------------------------- 1 | package com.shpun.dao; 2 | 3 | import com.shpun.pojo.Course; 4 | import com.shpun.pojo.Score; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface ScoreDao { 11 | 12 | int insertScore(Score score); 13 | 14 | int deleteScore(Score score); 15 | 16 | int updateScore(Score score); 17 | 18 | List searchFromScore(String s); 19 | 20 | Score selectScoreById(Score score); 21 | 22 | List selectAllScores(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/dao/StudentDao.java: -------------------------------------------------------------------------------- 1 | package com.shpun.dao; 2 | 3 | import com.shpun.pojo.Student; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | @Repository 9 | public interface StudentDao { 10 | 11 | int insertStudent(Student student); 12 | 13 | int deleteStudent(int studentId); 14 | 15 | int updateStudent(Student student); 16 | 17 | List searchFromStudent(String s); 18 | 19 | Student selectStudentById(int studentId); 20 | 21 | List selectAllStudents(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/dao/TeacherDao.java: -------------------------------------------------------------------------------- 1 | package com.shpun.dao; 2 | 3 | import com.shpun.pojo.Student; 4 | import com.shpun.pojo.Teacher; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface TeacherDao { 11 | 12 | int insertTeacher(Teacher teacher); 13 | 14 | int deleteTeacher(int teacherId); 15 | 16 | int updateTeacher(Teacher teacher); 17 | 18 | List searchFromTeacher(String s); 19 | 20 | Teacher selectTeacherById(int teacherId); 21 | 22 | List selectAllTeachers(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/Course.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class Course { 4 | 5 | private int courseId; 6 | private String courseName; 7 | private Teacher teacher; 8 | private int courseCredit; 9 | 10 | public int getCourseId() { 11 | return courseId; 12 | } 13 | 14 | public void setCourseId(int courseId) { 15 | this.courseId = courseId; 16 | } 17 | 18 | public String getCourseName() { 19 | return courseName; 20 | } 21 | 22 | public void setCourseName(String courseName) { 23 | this.courseName = courseName; 24 | } 25 | 26 | public Teacher getTeacher() { 27 | return teacher; 28 | } 29 | 30 | public void setTeacher(Teacher teacher) { 31 | this.teacher = teacher; 32 | } 33 | 34 | public int getCourseCredit() { 35 | return courseCredit; 36 | } 37 | 38 | public void setCourseCredit(int courseCredit) { 39 | this.courseCredit = courseCredit; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "course : id:"+this.getCourseId()+" name:"+this.getCourseName()+" teacherId:"+this.getTeacher().getTeacherId()+" credit:"+this.getCourseCredit() 45 | + "\n teacher : "+this.getTeacher(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/Login.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class Login { 4 | 5 | private String username; 6 | private String password; 7 | 8 | public String getUsername() { 9 | return username; 10 | } 11 | 12 | public void setUsername(String username) { 13 | this.username = username; 14 | } 15 | 16 | public String getPassword() { 17 | return password; 18 | } 19 | 20 | public void setPassword(String password) { 21 | this.password = password; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/RequestCourse.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class RequestCourse { 4 | 5 | private int teacherId; 6 | private String teacherName; 7 | private int courseId; 8 | private String courseName; 9 | private int courseCredit; 10 | 11 | public int getTeacherId() { 12 | return teacherId; 13 | } 14 | 15 | public void setTeacherId(int teacherId) { 16 | this.teacherId = teacherId; 17 | } 18 | 19 | public String getTeacherName() { 20 | return teacherName; 21 | } 22 | 23 | public void setTeacherName(String teacherName) { 24 | this.teacherName = teacherName; 25 | } 26 | 27 | public int getCourseId() { 28 | return courseId; 29 | } 30 | 31 | public void setCourseId(int courseId) { 32 | this.courseId = courseId; 33 | } 34 | 35 | public String getCourseName() { 36 | return courseName; 37 | } 38 | 39 | public void setCourseName(String courseName) { 40 | this.courseName = courseName; 41 | } 42 | 43 | public int getCourseCredit() { 44 | return courseCredit; 45 | } 46 | 47 | public void setCourseCredit(int courseCredit) { 48 | this.courseCredit = courseCredit; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/RequestScore.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class RequestScore { 4 | 5 | private int studentId; 6 | private String studentName; 7 | private int courseId; 8 | private String courseName; 9 | private int courseScore; 10 | 11 | public int getStudentId() { 12 | return studentId; 13 | } 14 | 15 | public void setStudentId(int studentId) { 16 | this.studentId = studentId; 17 | } 18 | 19 | public String getStudentName() { 20 | return studentName; 21 | } 22 | 23 | public void setStudentName(String studentName) { 24 | this.studentName = studentName; 25 | } 26 | 27 | public int getCourseId() { 28 | return courseId; 29 | } 30 | 31 | public void setCourseId(int courseId) { 32 | this.courseId = courseId; 33 | } 34 | 35 | public String getCourseName() { 36 | return courseName; 37 | } 38 | 39 | public void setCourseName(String courseName) { 40 | this.courseName = courseName; 41 | } 42 | 43 | public int getCourseScore() { 44 | return courseScore; 45 | } 46 | 47 | public void setCourseScore(int courseScore) { 48 | this.courseScore = courseScore; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/Score.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class Score { 4 | 5 | private Student student; 6 | private Course course; 7 | private int stuCouScore; 8 | 9 | public Student getStudent() { 10 | return student; 11 | } 12 | 13 | public void setStudent(Student student) { 14 | this.student = student; 15 | } 16 | 17 | public Course getCourse() { 18 | return course; 19 | } 20 | 21 | public void setCourse(Course course) { 22 | this.course = course; 23 | } 24 | 25 | public int getStuCouScore() { 26 | return stuCouScore; 27 | } 28 | 29 | public void setStuCouScore(int stuCouScore) { 30 | this.stuCouScore = stuCouScore; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "student : "+this.getStudent()+"\n"+"course : "+this.getCourse()+" score : studentId: "+this.getStudent().getStudentId()+" courseId: "+this.getCourse().getCourseId()+" score: "+this.getStuCouScore(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/Student.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class Student { 4 | 5 | private int studentId; 6 | private String studentName; 7 | private String studentGender; 8 | private String studentClass; 9 | private String studentMajor; 10 | private String studentDepartment; 11 | private String studentRewOrPun; 12 | 13 | public int getStudentId() { 14 | return studentId; 15 | } 16 | 17 | public void setStudentId(int studentId) { 18 | this.studentId = studentId; 19 | } 20 | 21 | public String getStudentName() { 22 | return studentName; 23 | } 24 | 25 | public void setStudentName(String studentName) { 26 | this.studentName = studentName; 27 | } 28 | 29 | public String getStudentGender() { 30 | return studentGender; 31 | } 32 | 33 | public void setStudentGender(String studentGender) { 34 | this.studentGender = studentGender; 35 | } 36 | 37 | public String getStudentClass() { 38 | return studentClass; 39 | } 40 | 41 | public void setStudentClass(String studentClass) { 42 | this.studentClass = studentClass; 43 | } 44 | 45 | public String getStudentMajor() { 46 | return studentMajor; 47 | } 48 | 49 | public void setStudentMajor(String studentMajor) { 50 | this.studentMajor = studentMajor; 51 | } 52 | 53 | public String getStudentDepartment() { 54 | return studentDepartment; 55 | } 56 | 57 | public void setStudentDepartment(String studentDepartment) { 58 | this.studentDepartment = studentDepartment; 59 | } 60 | 61 | public String getStudentRewOrPun() { 62 | return studentRewOrPun; 63 | } 64 | 65 | public void setStudentRewOrPun(String studentRewOrPun) { 66 | this.studentRewOrPun = studentRewOrPun; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "student : id:"+this.getStudentId()+" name:"+this.getStudentName()+" gender:"+this.getStudentGender()+" class:"+this.getStudentClass()+" major:"+this.getStudentMajor()+" department:"+this.getStudentDepartment()+" rewOrPun:"+this.getStudentRewOrPun(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/pojo/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.shpun.pojo; 2 | 3 | public class Teacher { 4 | 5 | private int teacherId; 6 | private String teacherName; 7 | private String teacherJobTitle; 8 | 9 | public int getTeacherId() { 10 | return teacherId; 11 | } 12 | 13 | public void setTeacherId(int teacherId) { 14 | this.teacherId = teacherId; 15 | } 16 | 17 | public String getTeacherName() { 18 | return teacherName; 19 | } 20 | 21 | public void setTeacherName(String teacherName) { 22 | this.teacherName = teacherName; 23 | } 24 | 25 | public String getTeacherJobTitle() { 26 | return teacherJobTitle; 27 | } 28 | 29 | public void setTeacherJobTitle(String teacherJobTitle) { 30 | this.teacherJobTitle = teacherJobTitle; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "teacher : id:"+this.getTeacherId()+" name:"+this.getTeacherName()+" jobTitle:"+this.getTeacherJobTitle(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/CourseService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Course; 4 | 5 | import java.util.List; 6 | 7 | public interface CourseService { 8 | 9 | int insertCourse(Course course); 10 | 11 | int deleteCourse(int courseId); 12 | 13 | int updateCourse(Course course); 14 | 15 | List searchFromCourse(String s); 16 | 17 | Course selectCourseById(int courseId); 18 | 19 | List selectAllCourses(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/ScoreService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Score; 4 | 5 | import java.util.List; 6 | 7 | public interface ScoreService { 8 | 9 | int insertScore(Score score); 10 | 11 | int deleteScore(Score score); 12 | 13 | int updateScore(Score score); 14 | 15 | List searchFromScore(String s); 16 | 17 | Score selectScoreById(Score score); 18 | 19 | List selectAllScores(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Student; 4 | 5 | import java.util.List; 6 | 7 | public interface StudentService { 8 | 9 | int insertStudent(Student student); 10 | 11 | int deleteStudent(int studentId); 12 | 13 | int updateStudent(Student student); 14 | 15 | List searchFromStudent(String s); 16 | 17 | Student selectStudentById(int studentId); 18 | 19 | List selectAllStudents(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Student; 4 | import com.shpun.pojo.Teacher; 5 | 6 | import java.util.List; 7 | 8 | public interface TeacherService { 9 | 10 | int insertTeacher(Teacher teacher); 11 | 12 | int deleteTeacher(int teacherId); 13 | 14 | int updateTeacher(Teacher teacher); 15 | 16 | List searchFromTeacher(String s); 17 | 18 | Teacher selectTeacherById(int teacherId); 19 | 20 | List selectAllTeachers(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/impl/CourseServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service.impl; 2 | 3 | import com.shpun.dao.CourseDao; 4 | import com.shpun.pojo.Course; 5 | import com.shpun.service.CourseService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | import org.springframework.transaction.annotation.Isolation; 9 | import org.springframework.transaction.annotation.Propagation; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.List; 13 | 14 | @Repository 15 | public class CourseServiceImpl implements CourseService { 16 | 17 | @Autowired 18 | private CourseDao courseDao; 19 | 20 | @Override 21 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 22 | public int insertCourse(Course course) { 23 | return courseDao.insertCourse(course); 24 | } 25 | 26 | @Override 27 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 28 | public int deleteCourse(int courseId) { 29 | return courseDao.deleteCourse(courseId); 30 | } 31 | 32 | @Override 33 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 34 | public int updateCourse(Course course) { 35 | return courseDao.updateCourse(course); 36 | } 37 | 38 | @Override 39 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 40 | public List searchFromCourse(String s) { 41 | return courseDao.searchFromCourse(s); 42 | } 43 | 44 | @Override 45 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 46 | public Course selectCourseById(int courseId) { 47 | return courseDao.selectCourseById(courseId); 48 | } 49 | 50 | @Override 51 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 52 | public List selectAllCourses() { 53 | return courseDao.selectAllCourses(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/impl/ScoreServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service.impl; 2 | 3 | import com.shpun.dao.ScoreDao; 4 | import com.shpun.pojo.Score; 5 | import com.shpun.service.ScoreService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Isolation; 9 | import org.springframework.transaction.annotation.Propagation; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.List; 13 | 14 | @Service 15 | public class ScoreServiceImpl implements ScoreService { 16 | 17 | @Autowired 18 | private ScoreDao scoreDao; 19 | 20 | @Override 21 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 22 | public int insertScore(Score score) { 23 | return scoreDao.insertScore(score); 24 | } 25 | 26 | @Override 27 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 28 | public int deleteScore(Score score) { 29 | return scoreDao.deleteScore(score); 30 | } 31 | 32 | @Override 33 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 34 | public int updateScore(Score score) { 35 | return scoreDao.updateScore(score); 36 | } 37 | 38 | @Override 39 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 40 | public List searchFromScore(String s) { 41 | return scoreDao.searchFromScore(s); 42 | } 43 | 44 | @Override 45 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 46 | public Score selectScoreById(Score score) { 47 | return scoreDao.selectScoreById(score); 48 | } 49 | 50 | @Override 51 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 52 | public List selectAllScores() { 53 | return scoreDao.selectAllScores(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service.impl; 2 | 3 | import com.shpun.dao.StudentDao; 4 | import com.shpun.pojo.Student; 5 | import com.shpun.service.StudentService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.ApplicationContext; 8 | import org.springframework.context.support.ClassPathXmlApplicationContext; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Isolation; 11 | import org.springframework.transaction.annotation.Propagation; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.util.List; 15 | 16 | @Service 17 | public class StudentServiceImpl implements StudentService { 18 | 19 | @Autowired 20 | private StudentDao studentDao; 21 | 22 | @Override 23 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 24 | public int insertStudent(Student student) { 25 | return studentDao.insertStudent(student); 26 | } 27 | 28 | @Override 29 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 30 | public int deleteStudent(int studentId) { 31 | return studentDao.deleteStudent(studentId); 32 | } 33 | 34 | @Override 35 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 36 | public int updateStudent(Student student) { 37 | return studentDao.updateStudent(student); 38 | } 39 | 40 | @Override 41 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 42 | public List searchFromStudent(String s) { 43 | return studentDao.searchFromStudent(s); 44 | } 45 | 46 | @Override 47 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 48 | public Student selectStudentById(int studentId) { 49 | return studentDao.selectStudentById(studentId); 50 | } 51 | 52 | @Override 53 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 54 | public List selectAllStudents() { 55 | return studentDao.selectAllStudents(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/shpun/service/impl/TeacherServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service.impl; 2 | 3 | import com.shpun.dao.TeacherDao; 4 | import com.shpun.pojo.Student; 5 | import com.shpun.pojo.Teacher; 6 | import com.shpun.service.TeacherService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Isolation; 10 | import org.springframework.transaction.annotation.Propagation; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class TeacherServiceImpl implements TeacherService { 17 | 18 | @Autowired 19 | private TeacherDao teacherDao; 20 | 21 | @Override 22 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 23 | public int insertTeacher(Teacher teacher) { 24 | return teacherDao.insertTeacher(teacher); 25 | } 26 | 27 | @Override 28 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 29 | public int deleteTeacher(int teacherId) { 30 | return teacherDao.deleteTeacher(teacherId); 31 | } 32 | 33 | @Override 34 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 35 | public int updateTeacher(Teacher teacher) { 36 | return teacherDao.updateTeacher(teacher); 37 | } 38 | 39 | @Override 40 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 41 | public List searchFromTeacher(String s) { 42 | return teacherDao.searchFromTeacher(s); 43 | } 44 | 45 | @Override 46 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 47 | public Teacher selectTeacherById(int teacherId) { 48 | return teacherDao.selectTeacherById(teacherId); 49 | } 50 | 51 | @Override 52 | @Transactional(propagation = Propagation.REQUIRES_NEW,isolation = Isolation.READ_COMMITTED) 53 | public List selectAllTeachers() { 54 | return teacherDao.selectAllTeachers(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/image/修改.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/修改.PNG -------------------------------------------------------------------------------- /src/main/resources/image/学生管理.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/学生管理.PNG -------------------------------------------------------------------------------- /src/main/resources/image/成绩管理.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/成绩管理.PNG -------------------------------------------------------------------------------- /src/main/resources/image/查询.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/查询.PNG -------------------------------------------------------------------------------- /src/main/resources/image/添加.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/添加.PNG -------------------------------------------------------------------------------- /src/main/resources/image/登录失败.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/登录失败.PNG -------------------------------------------------------------------------------- /src/main/resources/image/课程管理.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shpunishment/ssmStudent/b643892fb8728f077a17680de41945b1af7b3960/src/main/resources/image/课程管理.PNG -------------------------------------------------------------------------------- /src/main/resources/jdbcMysql.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/studentsystem?useUnicode=true&characterEncoding=UTF-8 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG,stdout 2 | log4j.logger.org.mybatis=DEBUG 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%5p %d %c: %m%n -------------------------------------------------------------------------------- /src/main/resources/mapper/CourseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into courses (courseName,teacherId,courseCredit) value (#{courseName},#{teacher.teacherId},#{courseCredit}) 9 | 10 | 11 | 12 | delete from courses where courseId=#{courseId} 13 | 14 | 15 | 16 | update courses set courseName=#{courseName},teacherId=#{teacher.teacherId},courseCredit=#{courseCredit} where courseId=#{courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 52 | 53 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ScoreMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into scores (studentId,courseId,stuCouScore) value (#{student.studentId},#{course.courseId},#{stuCouScore}) 9 | 10 | 11 | 12 | delete from scores where studentId=#{student.studentId} and courseId=#{course.courseId} 13 | 14 | 15 | 16 | update scores set stuCouScore=#{stuCouScore} where studentId=#{student.studentId} and courseId=#{course.courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into students (studentName,studentGender,studentClass,studentMajor,studentDepartment,studentRewOrPun) value (#{studentName},#{studentGender},#{studentClass},#{studentMajor},#{studentDepartment},#{studentRewOrPun}) 9 | 10 | 11 | 12 | delete from students where studentId=#{studentId} 13 | 14 | 15 | 16 | update students set studentName=#{studentName},studentGender=#{studentGender},studentClass=#{studentClass},studentMajor=#{studentMajor},studentDepartment=#{studentDepartment},studentRewOrPun=#{studentRewOrPun} where studentId=#{studentId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into teachers (teacherName,teacherJobTitle) value (#{teacherName},#{teacherJobTitle}) 9 | 10 | 11 | 12 | delete from teachers where teacherId=#{teacherId} 13 | 14 | 15 | 16 | update teachers set teacherName=#{teacherName},teacherJobTitle=#{teacherJobTitle} where teacherId=#{teacherId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | helperDialect=mysql 54 | reasonable=true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/studentsystem.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : test 5 | Source Server Version : 50620 6 | Source Host : localhost:3306 7 | Source Database : studentsystem 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50620 11 | File Encoding : 65001 12 | 13 | Date: 2018-09-04 19:41:43 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for courses 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `courses`; 22 | CREATE TABLE `courses` ( 23 | `courseId` int(5) NOT NULL AUTO_INCREMENT, 24 | `courseName` varchar(15) DEFAULT NULL, 25 | `teacherId` int(5) DEFAULT NULL, 26 | `courseCredit` int(2) DEFAULT NULL, 27 | PRIMARY KEY (`courseId`), 28 | KEY `teacher_id` (`teacherId`), 29 | CONSTRAINT `teacher_id` FOREIGN KEY (`teacherId`) REFERENCES `teachers` (`teacherId`) ON DELETE SET NULL ON UPDATE CASCADE 30 | ) ENGINE=InnoDB AUTO_INCREMENT=10015 DEFAULT CHARSET=utf8; 31 | 32 | -- ---------------------------- 33 | -- Records of courses 34 | -- ---------------------------- 35 | INSERT INTO `courses` VALUES ('10001', 'Java', '10001', '5'); 36 | INSERT INTO `courses` VALUES ('10002', 'C语言', '10006', '4'); 37 | INSERT INTO `courses` VALUES ('10003', '模拟电路', '10002', '4'); 38 | INSERT INTO `courses` VALUES ('10004', 'C++语言', '10005', '3'); 39 | INSERT INTO `courses` VALUES ('10005', '高等数学', '10006', '3'); 40 | INSERT INTO `courses` VALUES ('10006', '线性代数', '10003', '4'); 41 | INSERT INTO `courses` VALUES ('10007', '英语', '10004', '3'); 42 | INSERT INTO `courses` VALUES ('10008', '数学', '10003', '3'); 43 | INSERT INTO `courses` VALUES ('10009', 'Java', '10003', '5'); 44 | INSERT INTO `courses` VALUES ('10014', 'C++', '10002', '4'); 45 | 46 | -- ---------------------------- 47 | -- Table structure for scores 48 | -- ---------------------------- 49 | DROP TABLE IF EXISTS `scores`; 50 | CREATE TABLE `scores` ( 51 | `studentId` int(5) DEFAULT NULL, 52 | `courseId` int(5) DEFAULT NULL, 53 | `stuCouScore` int(3) DEFAULT '0', 54 | KEY `student_id` (`studentId`), 55 | KEY `course_id` (`courseId`), 56 | CONSTRAINT `course_id` FOREIGN KEY (`courseId`) REFERENCES `courses` (`courseId`) ON DELETE SET NULL ON UPDATE CASCADE, 57 | CONSTRAINT `student_id` FOREIGN KEY (`studentId`) REFERENCES `students` (`studentId`) ON DELETE SET NULL ON UPDATE CASCADE 58 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 59 | 60 | -- ---------------------------- 61 | -- Records of scores 62 | -- ---------------------------- 63 | INSERT INTO `scores` VALUES ('10101', '10001', '94'); 64 | INSERT INTO `scores` VALUES ('10102', '10002', '60'); 65 | INSERT INTO `scores` VALUES ('10101', '10002', '90'); 66 | INSERT INTO `scores` VALUES ('10101', '10003', '92'); 67 | INSERT INTO `scores` VALUES ('10101', '10004', '90'); 68 | INSERT INTO `scores` VALUES ('10101', '10005', '89'); 69 | INSERT INTO `scores` VALUES ('10101', '10006', '88'); 70 | INSERT INTO `scores` VALUES ('10102', '10001', '59'); 71 | INSERT INTO `scores` VALUES ('10102', '10003', '60'); 72 | INSERT INTO `scores` VALUES ('10102', '10004', '61'); 73 | INSERT INTO `scores` VALUES ('10102', '10005', '63'); 74 | INSERT INTO `scores` VALUES ('10102', '10006', '61'); 75 | INSERT INTO `scores` VALUES ('10102', '10007', '62'); 76 | INSERT INTO `scores` VALUES ('10105', '10004', '77'); 77 | INSERT INTO `scores` VALUES ('10104', '10003', '90'); 78 | 79 | -- ---------------------------- 80 | -- Table structure for students 81 | -- ---------------------------- 82 | DROP TABLE IF EXISTS `students`; 83 | CREATE TABLE `students` ( 84 | `studentId` int(5) NOT NULL AUTO_INCREMENT, 85 | `studentName` varchar(6) DEFAULT NULL, 86 | `studentGender` varchar(1) DEFAULT NULL, 87 | `studentClass` varchar(15) DEFAULT NULL, 88 | `studentMajor` varchar(15) DEFAULT NULL, 89 | `studentDepartment` varchar(15) DEFAULT NULL, 90 | `studentRewOrPun` varchar(150) DEFAULT NULL, 91 | PRIMARY KEY (`studentId`), 92 | KEY `class` (`studentClass`) 93 | ) ENGINE=InnoDB AUTO_INCREMENT=10124 DEFAULT CHARSET=utf8; 94 | 95 | -- ---------------------------- 96 | -- Records of students 97 | -- ---------------------------- 98 | INSERT INTO `students` VALUES ('10101', '张三', '男', '计科1班', '计算机科学与技术', '计算机科学系', '国家奖学金'); 99 | INSERT INTO `students` VALUES ('10102', '张四', '女', '计科1班', '计算机科学与技术', '计算机科学系', null); 100 | INSERT INTO `students` VALUES ('10103', '张五', '男', '计科1班', '计算机科学与技术', '计算机科学系', '旷课处分'); 101 | INSERT INTO `students` VALUES ('10104', '张六', '女', '计科1班', '计算机科学与技术', '计算机科学系', null); 102 | INSERT INTO `students` VALUES ('10105', '张七', '男', '计科1班', '计算机科学与技术', '计算机科学系', ''); 103 | INSERT INTO `students` VALUES ('10106', '张八', '女', '计科1班', '计算机科学与技术', '计算机科学系', null); 104 | INSERT INTO `students` VALUES ('10107', '李页码', '男', '计科2班', '计算机科学与技术', '计算机科学系', ''); 105 | INSERT INTO `students` VALUES ('10108', '李二', '男', '计科2班', '计算机科学与技术', '计算机科学系', null); 106 | INSERT INTO `students` VALUES ('10109', '李三', '女', '计科2班', '计算机科学与技术', '计算机科学系', '迟到处分'); 107 | INSERT INTO `students` VALUES ('10110', '林已', '男', '电气1班', '电气工程及其自动化', '计算机科学系', null); 108 | INSERT INTO `students` VALUES ('10111', '林而', '女', '电气1班', '电气工程及其自动化', '计算机科学系', null); 109 | INSERT INTO `students` VALUES ('10112', '林三', '男', '电气1班', '电气工程及其自动化', '计算机科学系', null); 110 | INSERT INTO `students` VALUES ('10113', '林死', '男', '电气1班', '电气工程及其自动化', '计算机科学系', '晚归处分'); 111 | INSERT INTO `students` VALUES ('10114', '林林', '女', '电气2班', '电气工程及其自动化', '计算机科学系', null); 112 | INSERT INTO `students` VALUES ('10116', '林改', '女', '电气2班', '电气工程及其自动化', '计算机科学系', null); 113 | INSERT INTO `students` VALUES ('10118', '曾加', '男', '电气2班', '电气工程及其自动化', '计算机科学系', '迟到处分'); 114 | INSERT INTO `students` VALUES ('10119', '曾二', '男', '电气2班', '电气工程及其自动化', '计算机科学系', null); 115 | INSERT INTO `students` VALUES ('10120', '曾四', '男', '电气2班', '电气工程及其自动化', '计算机科学系', null); 116 | INSERT INTO `students` VALUES ('10122', '更改', '女', '化工1班', '化工教育', '化工系', '系二等奖学金'); 117 | INSERT INTO `students` VALUES ('10123', '页码', '男', '化工1班', '化工教育', '化工系', '系一等奖学金'); 118 | 119 | -- ---------------------------- 120 | -- Table structure for teachers 121 | -- ---------------------------- 122 | DROP TABLE IF EXISTS `teachers`; 123 | CREATE TABLE `teachers` ( 124 | `teacherId` int(5) NOT NULL AUTO_INCREMENT, 125 | `teacherName` varchar(10) DEFAULT NULL, 126 | `teacherJobTitle` varchar(10) DEFAULT NULL, 127 | PRIMARY KEY (`teacherId`) 128 | ) ENGINE=InnoDB AUTO_INCREMENT=10008 DEFAULT CHARSET=utf8; 129 | 130 | -- ---------------------------- 131 | -- Records of teachers 132 | -- ---------------------------- 133 | INSERT INTO `teachers` VALUES ('10001', '王若', '讲师'); 134 | INSERT INTO `teachers` VALUES ('10002', '王已', '副教授'); 135 | INSERT INTO `teachers` VALUES ('10003', '王而', '副教授'); 136 | INSERT INTO `teachers` VALUES ('10004', '王散', '副教授'); 137 | INSERT INTO `teachers` VALUES ('10005', '曾一', '讲师'); 138 | INSERT INTO `teachers` VALUES ('10006', '曾二', '讲师'); 139 | INSERT INTO `teachers` VALUES ('10007', '更改', '副教授'); 140 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/js/course.js: -------------------------------------------------------------------------------- 1 | function showTeaCouInModal(obj){ 2 | 3 | /*获取 老师课程表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var courseCredit = prevAll.eq(0).text(); 8 | var courseName = prevAll.eq(1).text(); 9 | var courseId = prevAll.eq(2).text(); 10 | var teacherName = prevAll.eq(3).text(); 11 | var teacherId = prevAll.eq(4).text(); 12 | 13 | $("#editCourseCredit2").val(courseCredit); 14 | $("#editCourseName2").val(courseName); 15 | $("#editCourseId2").val(courseId); 16 | $("#editTeacherName2").val(teacherName); 17 | $("#editTeacherId2").val(teacherId); 18 | 19 | 20 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/js/score.js: -------------------------------------------------------------------------------- 1 | function showStuCouScoInModal(obj){ 2 | 3 | /*获取 学生课程成绩表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var score = prevAll.eq(0).text(); 8 | var courseName = prevAll.eq(1).text(); 9 | var courseId = prevAll.eq(2).text(); 10 | var studentName = prevAll.eq(3).text(); 11 | var studentId = prevAll.eq(4).text(); 12 | 13 | $("#editCourseScore3").val(score); 14 | $("#editCourseName3").val(courseName); 15 | $("#editCourseId3").val(courseId); 16 | $("#editStudentName3").val(studentName); 17 | $("#editStudentId3").val(studentId); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/js/student.js: -------------------------------------------------------------------------------- 1 | function showStudentInModal(obj){ 2 | 3 | /*获取 学生表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var studentRewOrPun = prevAll.eq(0).text(); 8 | var studentDepartment = prevAll.eq(1).text(); 9 | var studentMajor = prevAll.eq(2).text(); 10 | var studentClasses = prevAll.eq(3).text(); 11 | var studentGender = prevAll.eq(4).text(); 12 | var studentName = prevAll.eq(5).text(); 13 | var studentId = prevAll.eq(6).text(); 14 | 15 | $("#editStudentRewOrPun1").text(studentRewOrPun); 16 | $("#editStudentDepartment1").val(studentDepartment); 17 | $("#editStudentMajor1").val(studentMajor); 18 | $("#editStudentClass1").val(studentClasses); 19 | 20 | if(studentGender == '男'){ 21 | $("input[name='studentGender'][value='女']").attr("checked",false); 22 | $("input[name='studentGender'][value='男']").attr("checked",true); 23 | }else if(studentGender == '女'){ 24 | $("input[name='studentGender'][value='男']").attr("checked",false); 25 | $("input[name='studentGender'][value='女']").attr("checked",true); 26 | } 27 | 28 | $("#editStudentName1").val(studentName); 29 | $("#editStudentId1").val(studentId); 30 | 31 | } -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/score.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: shpun 4 | Date: 2018/8/28 5 | Time: 18:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8"%> 10 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 11 | <% 12 | pageContext.setAttribute("path", request.getContextPath()); 13 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 学籍管理系统 29 | 30 | 31 | 32 | 33 | 42 | 43 |
44 |
45 | 46 |
47 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |

成绩管理

59 | 60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 | 75 | 124 | 125 | 126 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 |
学号名字课程号课程名成绩操作
${score.student.studentId}${score.student.studentName}${score.course.courseId}${score.course.courseName}${score.stuCouScore} 197 | 删除 198 |
203 | 204 | 205 | 206 |
207 | 208 | 209 |
210 | 当前${scorePageInfo.pageNum}页,总${scorePageInfo.pages}页,总${scorePageInfo.total}条记录 211 |
212 | 213 |
214 | 244 |
245 | 246 |
247 | 248 |
249 |
250 | 251 | 252 |
253 |
254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/scoreResult.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: shpun 4 | Date: 2018/8/28 5 | Time: 18:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8"%> 10 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 11 | <% 12 | pageContext.setAttribute("path", request.getContextPath()); 13 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 学籍管理系统 29 | 30 | 31 | 32 | 33 | 42 | 43 |
44 |
45 | 46 |
47 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |

成绩管理

59 | 60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 | 75 | 124 | 125 | 126 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 |
学号名字课程号课程名成绩操作
${score.student.studentId}${score.student.studentName}${score.course.courseId}${score.course.courseName}${score.stuCouScore} 197 | 删除 198 |
203 | 204 | 205 | 206 |
207 | 208 | 209 |
210 | 当前${scorePageInfo.pageNum}页,总${scorePageInfo.pages}页,总${scorePageInfo.total}条记录 211 |
212 | 213 |
214 | 244 |
245 | 246 |
247 | 248 |
249 |
250 | 251 | 252 |
253 |
254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | Archetype Created Web Application 12 | 13 | 14 | 15 | 16 | dispatcher 17 | org.springframework.web.servlet.DispatcherServlet 18 | 19 | contextConfigLocation 20 | classpath:spring/spring-*.xml 21 | 22 | 23 | 2 24 | 25 | 26 | 27 | 28 | dispatcher 29 | / 30 | 31 | 32 | 33 | encodingFilter 34 | 35 | org.springframework.web.filter.CharacterEncodingFilter 36 | 37 | 38 | encoding 39 | utf-8 40 | 41 | 42 | 43 | 44 | encodingFilter 45 | /* 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <% 5 | pageContext.setAttribute("path", request.getContextPath()); 6 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 学籍管理系统 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |

学籍管理系统

23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 | 40 | 41 |
42 | 43 | 44 |
45 | 46 | 47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /target/SSMStuSys/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Built-By: shpun 3 | Created-By: IntelliJ IDEA 4 | Build-Jdk: 1.8.0_151 5 | 6 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/META-INF/spring.components: -------------------------------------------------------------------------------- 1 | # 2 | #Fri Aug 31 20:33:20 CST 2018 3 | com.shpun.controller.StudentController=org.springframework.stereotype.Component 4 | com.shpun.service.impl.ScoreServiceImpl=org.springframework.stereotype.Component 5 | com.shpun.controller.CourseController=org.springframework.stereotype.Component 6 | com.shpun.dao.ScoreDao=org.springframework.stereotype.Component 7 | com.shpun.service.impl.TeacherServiceImpl=org.springframework.stereotype.Component 8 | com.shpun.dao.CourseDao=org.springframework.stereotype.Component 9 | com.shpun.dao.StudentDao=org.springframework.stereotype.Component 10 | com.shpun.service.impl.StudentServiceImpl=org.springframework.stereotype.Component 11 | com.shpun.controller.ScoreController=org.springframework.stereotype.Component 12 | com.shpun.service.impl.CourseServiceImpl=org.springframework.stereotype.Component 13 | com.shpun.controller.ManagerController=org.springframework.stereotype.Component 14 | com.shpun.dao.TeacherDao=org.springframework.stereotype.Component 15 | com.shpun.controller.LoginController=org.springframework.stereotype.Component 16 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/jdbcMysql.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/studentsystem?useUnicode=true&characterEncoding=UTF-8 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG,stdout 2 | log4j.logger.org.mybatis=DEBUG 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%5p %d %c: %m%n -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/mapper/CourseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into courses (courseName,teacherId,courseCredit) value (#{courseName},#{teacher.teacherId},#{courseCredit}) 9 | 10 | 11 | 12 | delete from courses where courseId=#{courseId} 13 | 14 | 15 | 16 | update courses set courseName=#{courseName},teacherId=#{teacher.teacherId},courseCredit=#{courseCredit} where courseId=#{courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 52 | 53 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/mapper/ScoreMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into scores (studentId,courseId,stuCouScore) value (#{student.studentId},#{course.courseId},#{stuCouScore}) 9 | 10 | 11 | 12 | delete from scores where studentId=#{student.studentId} and courseId=#{course.courseId} 13 | 14 | 15 | 16 | update scores set stuCouScore=#{stuCouScore} where studentId=#{student.studentId} and courseId=#{course.courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into students (studentName,studentGender,studentClass,studentMajor,studentDepartment,studentRewOrPun) value (#{studentName},#{studentGender},#{studentClass},#{studentMajor},#{studentDepartment},#{studentRewOrPun}) 9 | 10 | 11 | 12 | delete from students where studentId=#{studentId} 13 | 14 | 15 | 16 | update students set studentName=#{studentName},studentGender=#{studentGender},studentClass=#{studentClass},studentMajor=#{studentMajor},studentDepartment=#{studentDepartment},studentRewOrPun=#{studentRewOrPun} where studentId=#{studentId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/mapper/TeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into teachers (teacherName,teacherJobTitle) value (#{teacherName},#{teacherJobTitle}) 9 | 10 | 11 | 12 | delete from teachers where teacherId=#{teacherId} 13 | 14 | 15 | 16 | update teachers set teacherName=#{teacherName},teacherJobTitle=#{teacherJobTitle} where teacherId=#{teacherId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | helperDialect=mysql 54 | reasonable=true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/js/course.js: -------------------------------------------------------------------------------- 1 | function showTeaCouInModal(obj){ 2 | 3 | /*获取 老师课程表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var courseCredit = prevAll.eq(0).text(); 8 | var courseName = prevAll.eq(1).text(); 9 | var courseId = prevAll.eq(2).text(); 10 | var teacherName = prevAll.eq(3).text(); 11 | var teacherId = prevAll.eq(4).text(); 12 | 13 | $("#editCourseCredit2").val(courseCredit); 14 | $("#editCourseName2").val(courseName); 15 | $("#editCourseId2").val(courseId); 16 | $("#editTeacherName2").val(teacherName); 17 | $("#editTeacherId2").val(teacherId); 18 | 19 | 20 | } -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/js/score.js: -------------------------------------------------------------------------------- 1 | function showStuCouScoInModal(obj){ 2 | 3 | /*获取 学生课程成绩表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var score = prevAll.eq(0).text(); 8 | var courseName = prevAll.eq(1).text(); 9 | var courseId = prevAll.eq(2).text(); 10 | var studentName = prevAll.eq(3).text(); 11 | var studentId = prevAll.eq(4).text(); 12 | 13 | $("#editCourseScore3").val(score); 14 | $("#editCourseName3").val(courseName); 15 | $("#editCourseId3").val(courseId); 16 | $("#editStudentName3").val(studentName); 17 | $("#editStudentId3").val(studentId); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/js/student.js: -------------------------------------------------------------------------------- 1 | function showStudentInModal(obj){ 2 | 3 | /*获取 学生表 的一行的数据并传值到模态框中,onclick事件先于模态框的show*/ 4 | 5 | var prevAll = $(obj).parent().prevAll(); 6 | 7 | var studentRewOrPun = prevAll.eq(0).text(); 8 | var studentDepartment = prevAll.eq(1).text(); 9 | var studentMajor = prevAll.eq(2).text(); 10 | var studentClasses = prevAll.eq(3).text(); 11 | var studentGender = prevAll.eq(4).text(); 12 | var studentName = prevAll.eq(5).text(); 13 | var studentId = prevAll.eq(6).text(); 14 | 15 | $("#editStudentRewOrPun1").text(studentRewOrPun); 16 | $("#editStudentDepartment1").val(studentDepartment); 17 | $("#editStudentMajor1").val(studentMajor); 18 | $("#editStudentClass1").val(studentClasses); 19 | 20 | if(studentGender == '男'){ 21 | $("input[name='studentGender'][value='女']").attr("checked",false); 22 | $("input[name='studentGender'][value='男']").attr("checked",true); 23 | }else if(studentGender == '女'){ 24 | $("input[name='studentGender'][value='男']").attr("checked",false); 25 | $("input[name='studentGender'][value='女']").attr("checked",true); 26 | } 27 | 28 | $("#editStudentName1").val(studentName); 29 | $("#editStudentId1").val(studentId); 30 | 31 | } -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/jsp/score.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: shpun 4 | Date: 2018/8/28 5 | Time: 18:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8"%> 10 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 11 | <% 12 | pageContext.setAttribute("path", request.getContextPath()); 13 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 学籍管理系统 29 | 30 | 31 | 32 | 33 | 42 | 43 |
44 |
45 | 46 |
47 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |

成绩管理

59 | 60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 | 75 | 124 | 125 | 126 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 |
学号名字课程号课程名成绩操作
${score.student.studentId}${score.student.studentName}${score.course.courseId}${score.course.courseName}${score.stuCouScore} 197 | 删除 198 |
203 | 204 | 205 | 206 |
207 | 208 | 209 |
210 | 当前${scorePageInfo.pageNum}页,总${scorePageInfo.pages}页,总${scorePageInfo.total}条记录 211 |
212 | 213 |
214 | 244 |
245 | 246 |
247 | 248 |
249 |
250 | 251 | 252 |
253 |
254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/jsp/scoreResult.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: shpun 4 | Date: 2018/8/28 5 | Time: 18:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8"%> 10 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 11 | <% 12 | pageContext.setAttribute("path", request.getContextPath()); 13 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 14 | %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 学籍管理系统 29 | 30 | 31 | 32 | 33 | 42 | 43 |
44 |
45 | 46 |
47 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |

成绩管理

59 | 60 |
61 | 62 |
63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 |
73 | 74 | 75 | 124 | 125 | 126 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 |
学号名字课程号课程名成绩操作
${score.student.studentId}${score.student.studentName}${score.course.courseId}${score.course.courseName}${score.stuCouScore} 197 | 删除 198 |
203 | 204 | 205 | 206 |
207 | 208 | 209 |
210 | 当前${scorePageInfo.pageNum}页,总${scorePageInfo.pages}页,总${scorePageInfo.total}条记录 211 |
212 | 213 |
214 | 244 |
245 | 246 |
247 | 248 |
249 |
250 | 251 | 252 |
253 |
254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /target/SSMStuSys/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | Archetype Created Web Application 12 | 13 | 14 | 15 | 16 | dispatcher 17 | org.springframework.web.servlet.DispatcherServlet 18 | 19 | contextConfigLocation 20 | classpath:spring/spring-*.xml 21 | 22 | 23 | 2 24 | 25 | 26 | 27 | 28 | dispatcher 29 | / 30 | 31 | 32 | 33 | encodingFilter 34 | 35 | org.springframework.web.filter.CharacterEncodingFilter 36 | 37 | 38 | encoding 39 | utf-8 40 | 41 | 42 | 43 | 44 | encodingFilter 45 | /* 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /target/SSMStuSys/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <% 5 | pageContext.setAttribute("path", request.getContextPath()); 6 | pageContext.setAttribute("basePath",request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()); 7 | %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 学籍管理系统 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |

学籍管理系统

23 | 24 |
25 | 26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 | 40 | 41 |
42 | 43 | 44 |
45 | 46 | 47 |
48 | 49 | 登录 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /target/classes/META-INF/spring.components: -------------------------------------------------------------------------------- 1 | # 2 | #Tue Sep 04 19:16:14 CST 2018 3 | com.shpun.controller.StudentController=org.springframework.stereotype.Component 4 | com.shpun.service.impl.ScoreServiceImpl=org.springframework.stereotype.Component 5 | com.shpun.dao.ScoreDao=org.springframework.stereotype.Component 6 | com.shpun.controller.CourseController=org.springframework.stereotype.Component 7 | com.shpun.service.impl.TeacherServiceImpl=org.springframework.stereotype.Component 8 | com.shpun.dao.CourseDao=org.springframework.stereotype.Component 9 | com.shpun.service.impl.StudentServiceImpl=org.springframework.stereotype.Component 10 | com.shpun.dao.StudentDao=org.springframework.stereotype.Component 11 | com.shpun.controller.ScoreController=org.springframework.stereotype.Component 12 | com.shpun.service.impl.CourseServiceImpl=org.springframework.stereotype.Component 13 | com.shpun.controller.ManagerController=org.springframework.stereotype.Component 14 | com.shpun.dao.TeacherDao=org.springframework.stereotype.Component 15 | com.shpun.controller.LoginController=org.springframework.stereotype.Component 16 | -------------------------------------------------------------------------------- /target/classes/jdbcMysql.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/studentsystem?useUnicode=true&characterEncoding=UTF-8 3 | jdbc.username=root 4 | jdbc.password=root -------------------------------------------------------------------------------- /target/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG,stdout 2 | log4j.logger.org.mybatis=DEBUG 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%5p %d %c: %m%n -------------------------------------------------------------------------------- /target/classes/mapper/CourseMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into courses (courseName,teacherId,courseCredit) value (#{courseName},#{teacher.teacherId},#{courseCredit}) 9 | 10 | 11 | 12 | delete from courses where courseId=#{courseId} 13 | 14 | 15 | 16 | update courses set courseName=#{courseName},teacherId=#{teacher.teacherId},courseCredit=#{courseCredit} where courseId=#{courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 52 | 53 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /target/classes/mapper/ScoreMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into scores (studentId,courseId,stuCouScore) value (#{student.studentId},#{course.courseId},#{stuCouScore}) 9 | 10 | 11 | 12 | delete from scores where studentId=#{student.studentId} and courseId=#{course.courseId} 13 | 14 | 15 | 16 | update scores set stuCouScore=#{stuCouScore} where studentId=#{student.studentId} and courseId=#{course.courseId} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /target/classes/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into students (studentName,studentGender,studentClass,studentMajor,studentDepartment,studentRewOrPun) value (#{studentName},#{studentGender},#{studentClass},#{studentMajor},#{studentDepartment},#{studentRewOrPun}) 9 | 10 | 11 | 12 | delete from students where studentId=#{studentId} 13 | 14 | 15 | 16 | update students set studentName=#{studentName},studentGender=#{studentGender},studentClass=#{studentClass},studentMajor=#{studentMajor},studentDepartment=#{studentDepartment},studentRewOrPun=#{studentRewOrPun} where studentId=#{studentId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /target/classes/mapper/TeacherMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | insert into teachers (teacherName,teacherJobTitle) value (#{teacherName},#{teacherJobTitle}) 9 | 10 | 11 | 12 | delete from teachers where teacherId=#{teacherId} 13 | 14 | 15 | 16 | update teachers set teacherName=#{teacherName},teacherJobTitle=#{teacherJobTitle} where teacherId=#{teacherId} 17 | 18 | 19 | 23 | 24 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /target/classes/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /target/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | helperDialect=mysql 54 | reasonable=true 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /target/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /target/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/com/shpun/service/TestCourseService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Course; 4 | import com.shpun.pojo.Student; 5 | import com.shpun.pojo.Teacher; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.context.ApplicationContext; 9 | import org.springframework.context.support.ClassPathXmlApplicationContext; 10 | import org.springframework.test.context.ContextConfiguration; 11 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 12 | 13 | import java.util.List; 14 | 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @ContextConfiguration(locations = {"classpath:spring/spring-*.xml"}) 17 | public class TestCourseService { 18 | 19 | @Test 20 | public void testInsertCourse(){ 21 | 22 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 23 | CourseService courseService = context.getBean(CourseService.class); 24 | 25 | Course course = new Course(); 26 | course.setCourseName("Java"); 27 | 28 | Teacher teacher = new Teacher(); 29 | teacher.setTeacherId(10003); 30 | 31 | course.setTeacher(teacher); 32 | course.setCourseCredit(5); 33 | 34 | courseService.insertCourse(course); 35 | System.out.println("id:"+course.getCourseId()); 36 | 37 | } 38 | 39 | @Test 40 | public void testDeleteCourse(){ 41 | 42 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 43 | CourseService courseService = context.getBean(CourseService.class); 44 | 45 | courseService.deleteCourse(10010); 46 | 47 | } 48 | 49 | @Test 50 | public void testUpdateCourse(){ 51 | 52 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 53 | CourseService courseService = context.getBean(CourseService.class); 54 | 55 | Course course = new Course(); 56 | course.setCourseId(10009); 57 | course.setCourseName("Java"); 58 | 59 | Teacher teacher = new Teacher(); 60 | teacher.setTeacherId(10003); 61 | 62 | course.setTeacher(teacher); 63 | course.setCourseCredit(5); 64 | 65 | courseService.updateCourse(course); 66 | 67 | } 68 | 69 | @Test 70 | public void testSearchFromCourse(){ 71 | 72 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 73 | CourseService courseService = context.getBean(CourseService.class); 74 | 75 | List courseList = courseService.searchFromCourse("C"); 76 | 77 | for(Course c : courseList){ 78 | System.out.println(c); 79 | } 80 | 81 | } 82 | 83 | @Test 84 | public void testSelectCourseById(){ 85 | 86 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 87 | CourseService courseService = context.getBean(CourseService.class); 88 | 89 | System.out.println(courseService.selectCourseById(10001)); 90 | 91 | } 92 | 93 | @Test 94 | public void testSelectAllCourses(){ 95 | 96 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 97 | CourseService courseService = context.getBean(CourseService.class); 98 | 99 | List courseList = courseService.selectAllCourses(); 100 | 101 | for(Course c : courseList){ 102 | System.out.println(c); 103 | } 104 | 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /test/com/shpun/service/TestScoreService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Course; 4 | import com.shpun.pojo.Score; 5 | import com.shpun.pojo.Student; 6 | import com.shpun.pojo.Teacher; 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | import org.springframework.context.ApplicationContext; 10 | import org.springframework.context.support.ClassPathXmlApplicationContext; 11 | import org.springframework.test.context.ContextConfiguration; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | 14 | import java.util.List; 15 | 16 | @RunWith(SpringJUnit4ClassRunner.class) 17 | @ContextConfiguration(locations = {"classpath:spring/spring-*.xml"}) 18 | public class TestScoreService { 19 | 20 | @Test 21 | public void testInsertScore(){ 22 | 23 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 24 | ScoreService scoreService = context.getBean(ScoreService.class); 25 | 26 | Score score = new Score(); 27 | 28 | Student student = new Student(); 29 | student.setStudentId(10103); 30 | Course course = new Course(); 31 | course.setCourseId(10004); 32 | 33 | score.setStudent(student); 34 | score.setCourse(course); 35 | score.setStuCouScore(68); 36 | 37 | scoreService.insertScore(score); 38 | 39 | } 40 | 41 | @Test 42 | public void testDeleteScore(){ 43 | 44 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 45 | ScoreService scoreService = context.getBean(ScoreService.class); 46 | 47 | Score score = new Score(); 48 | 49 | Student student = new Student(); 50 | student.setStudentId(10103); 51 | Course course = new Course(); 52 | course.setCourseId(10003); 53 | 54 | score.setStudent(student); 55 | score.setCourse(course); 56 | 57 | scoreService.deleteScore(score); 58 | 59 | } 60 | 61 | @Test 62 | public void testUpdateScore(){ 63 | 64 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 65 | ScoreService scoreService = context.getBean(ScoreService.class); 66 | 67 | Score score = new Score(); 68 | 69 | Student student = new Student(); 70 | student.setStudentId(10105); 71 | Course course = new Course(); 72 | course.setCourseId(10004); 73 | 74 | score.setStudent(student); 75 | score.setCourse(course); 76 | score.setStuCouScore(77); 77 | 78 | scoreService.updateScore(score); 79 | 80 | } 81 | 82 | @Test 83 | public void testSearchFromScore(){ 84 | 85 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 86 | ScoreService scoreService = context.getBean(ScoreService.class); 87 | 88 | List scoreList = scoreService.searchFromScore("94"); 89 | 90 | for(Score s : scoreList){ 91 | System.out.println(s); 92 | } 93 | 94 | } 95 | 96 | @Test 97 | public void testSelectScoreById(){ 98 | 99 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 100 | ScoreService scoreService = context.getBean(ScoreService.class); 101 | 102 | Score score = new Score(); 103 | 104 | Student student = new Student(); 105 | student.setStudentId(10102); 106 | Course course = new Course(); 107 | course.setCourseId(10002); 108 | 109 | score.setStudent(student); 110 | score.setCourse(course); 111 | 112 | System.out.println(scoreService.selectScoreById(score)); 113 | 114 | } 115 | 116 | @Test 117 | public void testSelectAllScores(){ 118 | 119 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 120 | ScoreService scoreService = context.getBean(ScoreService.class); 121 | 122 | List scoreList = scoreService.selectAllScores(); 123 | 124 | for(Score s : scoreList){ 125 | System.out.println(s); 126 | } 127 | 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /test/com/shpun/service/TestStudentService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | 4 | import com.shpun.pojo.Student; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.context.ApplicationContext; 8 | import org.springframework.context.support.ClassPathXmlApplicationContext; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | import java.util.List; 13 | 14 | @RunWith(SpringJUnit4ClassRunner.class) 15 | @ContextConfiguration(locations = {"classpath:spring/spring-*.xml"}) 16 | public class TestStudentService { 17 | 18 | @Test 19 | public void testInsertStudent(){ 20 | 21 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 22 | StudentService studentService = context.getBean(StudentService.class); 23 | 24 | Student student = new Student(); 25 | student.setStudentName("曾四"); 26 | student.setStudentGender("男"); 27 | student.setStudentClass("电气2班"); 28 | student.setStudentMajor("电气工程及其自动化"); 29 | student.setStudentDepartment("计算机科学系"); 30 | 31 | studentService.insertStudent(student); 32 | System.out.println("insert studentId:" + student.getStudentId()); 33 | 34 | } 35 | 36 | @Test 37 | public void testDeleteStudent(){ 38 | 39 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 40 | StudentService studentService = context.getBean(StudentService.class); 41 | 42 | studentService.deleteStudent(10121); 43 | 44 | } 45 | 46 | @Test 47 | public void testUpdateStudent(){ 48 | 49 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 50 | StudentService studentService = context.getBean(StudentService.class); 51 | 52 | Student student = new Student(); 53 | student.setStudentId(10120); 54 | student.setStudentName("曾四"); 55 | student.setStudentGender("男"); 56 | student.setStudentClass("电气2班"); 57 | student.setStudentMajor("电气工程及其自动化"); 58 | student.setStudentDepartment("计算机科学系"); 59 | 60 | studentService.updateStudent(student); 61 | 62 | } 63 | 64 | @Test 65 | public void testsearchFromStudent(){ 66 | 67 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 68 | StudentService studentService = context.getBean(StudentService.class); 69 | 70 | List studentList = studentService.searchFromStudent("男"); 71 | 72 | for(Student s : studentList){ 73 | System.out.println(s); 74 | } 75 | 76 | } 77 | 78 | @Test 79 | public void testSelectStudentById(){ 80 | 81 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 82 | StudentService studentService = context.getBean(StudentService.class); 83 | 84 | System.out.println(studentService.selectStudentById(10101)); 85 | 86 | } 87 | 88 | @Test 89 | public void testSelectAllStudents(){ 90 | 91 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 92 | StudentService studentService = context.getBean(StudentService.class); 93 | 94 | List studentList = studentService.selectAllStudents(); 95 | 96 | for(Student s : studentList){ 97 | System.out.println(s); 98 | } 99 | 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /test/com/shpun/service/TestTeacherService.java: -------------------------------------------------------------------------------- 1 | package com.shpun.service; 2 | 3 | import com.shpun.pojo.Student; 4 | import com.shpun.pojo.Teacher; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.context.ApplicationContext; 8 | import org.springframework.context.support.ClassPathXmlApplicationContext; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | import java.util.List; 13 | 14 | @RunWith(SpringJUnit4ClassRunner.class) 15 | @ContextConfiguration(locations = {"classpath:spring/spring-*.xml"}) 16 | public class TestTeacherService { 17 | 18 | @Test 19 | public void testInsertTeacher(){ 20 | 21 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 22 | TeacherService teacherService = context.getBean(TeacherService.class); 23 | 24 | Teacher teacher = new Teacher(); 25 | teacher.setTeacherName("黄一"); 26 | teacher.setTeacherJobTitle("讲师"); 27 | 28 | teacherService.insertTeacher(teacher); 29 | System.out.println("insert teacherId:" + teacher.getTeacherId()); 30 | 31 | } 32 | 33 | @Test 34 | public void testDeleteTeacher(){ 35 | 36 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 37 | TeacherService teacherService = context.getBean(TeacherService.class); 38 | 39 | teacherService.deleteTeacher(10008); 40 | 41 | } 42 | 43 | @Test 44 | public void testUpdateTeacher(){ 45 | 46 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 47 | TeacherService teacherService = context.getBean(TeacherService.class); 48 | 49 | Teacher teacher = new Teacher(); 50 | teacher.setTeacherId(10007); 51 | teacher.setTeacherName("更改"); 52 | teacher.setTeacherJobTitle("副教授"); 53 | 54 | teacherService.updateTeacher(teacher); 55 | 56 | } 57 | 58 | @Test 59 | public void testSearchFromTeacher(){ 60 | 61 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 62 | TeacherService teacherService = context.getBean(TeacherService.class); 63 | 64 | List teacherList = teacherService.searchFromTeacher("教授"); 65 | 66 | for(Teacher t : teacherList){ 67 | System.out.println(t); 68 | } 69 | 70 | } 71 | 72 | @Test 73 | public void testSelectTeacherById(){ 74 | 75 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 76 | TeacherService teacherService = context.getBean(TeacherService.class); 77 | 78 | System.out.println(teacherService.selectTeacherById(10001)); 79 | 80 | } 81 | 82 | @Test 83 | public void testSelectAllTeachers(){ 84 | 85 | ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-*.xml"); 86 | TeacherService teacherService = context.getBean(TeacherService.class); 87 | 88 | List teacherList = teacherService.selectAllTeachers(); 89 | 90 | for(Teacher t : teacherList){ 91 | System.out.println(t); 92 | } 93 | 94 | } 95 | 96 | } 97 | --------------------------------------------------------------------------------