├── .gitignore ├── README.md ├── mvnw ├── mvnw.cmd ├── mysql-connector-java-8.0.13.jar ├── pom.xml ├── readme ├── image001.png ├── image003.png ├── image005.png ├── image007.png ├── image009.png ├── image011.png ├── image013.png ├── image015.png ├── image017.png ├── image019.png ├── image021.png ├── image023.png ├── image025.png ├── image027.png ├── image029.png ├── image031.png ├── image033.png ├── image035.png ├── image037.png └── image039.png └── src ├── main ├── java │ └── com │ │ └── friend │ │ └── py │ │ ├── Controller │ │ ├── AccountController.java │ │ ├── AnswerController.java │ │ ├── DeptController.java │ │ ├── LessonController.java │ │ ├── LoginController.java │ │ ├── QuesController.java │ │ ├── StudentController.java │ │ ├── TeacherController.java │ │ └── test.java │ │ ├── MybatisGenerator.java │ │ ├── PyApplication.java │ │ ├── dao │ │ ├── AccountMapper.java │ │ ├── DepartmentMapper.java │ │ ├── LessonMapper.java │ │ ├── StudentMapper.java │ │ ├── TeacherMapper.java │ │ ├── TopicAnswerMapper.java │ │ └── TopicMapper.java │ │ ├── mapper │ │ ├── AccountMapper.xml │ │ ├── DepartmentMapper.xml │ │ ├── LessonMapper.xml │ │ ├── StudentMapper.xml │ │ ├── TeacherMapper.xml │ │ ├── TopicAnswerMapper.xml │ │ └── TopicMapper.xml │ │ └── model │ │ ├── Account.java │ │ ├── AccountExample.java │ │ ├── Department.java │ │ ├── DepartmentExample.java │ │ ├── Lesson.java │ │ ├── LessonExample.java │ │ ├── LessonKey.java │ │ ├── Student.java │ │ ├── StudentExample.java │ │ ├── Teacher.java │ │ ├── TeacherExample.java │ │ ├── Topic.java │ │ ├── TopicAnswer.java │ │ ├── TopicAnswerExample.java │ │ └── TopicExample.java └── resources │ ├── application.properties │ ├── generatorConfig.xml │ ├── static │ ├── css │ │ ├── board.css │ │ ├── bootstrap.css │ │ ├── floating-labels.css │ │ ├── sb-admin-2.min.css │ │ └── signin.css │ └── js │ │ ├── Chart.min.js │ │ ├── DashBoard.js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.js │ │ ├── feather.min.js │ │ ├── jquery-3.3.1.js │ │ └── sb-admin-2.min.js │ └── templates │ ├── AddAnswer.html │ ├── AddQuestion.html │ ├── AdminDashboard.html │ ├── CardTemplates.html │ ├── ChangePassword.html │ ├── DepartmentList.html │ ├── FindAccount.html │ ├── FindDepartment.html │ ├── FindLesson.html │ ├── LeftSideBar.html │ ├── NumberExisted.html │ ├── ShowAllQuestion.html │ ├── ShowAnswer.html │ ├── ShowMyQuestion.html │ ├── ShowNeedAns.html │ ├── ShowQuesDetail.html │ ├── StudentDashboard.html │ ├── SuccessfullyRegister.html │ ├── TeacherDashboard.html │ ├── TeacherRegister.html │ ├── TopNavBar.html │ ├── login.html │ └── register.html └── test └── java └── com └── friend └── py └── PyApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **作者:Friende** 2 | **时间:2019年1月** 3 | 4 | **一、完成内容** 5 | 6 | | 功能 | 列出完成的功能 | 列出未完成的功能 | 7 | | :--------- | :----------------------------------------------------------- | :----------------------------------------------------------- | 8 | | 管理员功能 | 1. 增删改课程信息,包括课程名称,授课教师,课程内容描述,开课学院。 增删改教师,包括教师名称,所讲授课程(可以有多个),教师职称,教师简介。
2. 增删改学院信息。
3. 删除问题。
4. 修改密码。 | 1. 修改交流和留言信息。 | 9 | | 教师功能 | 1. 教师登录后,将提示自己所教授的课程是否有新的未回答的留言并且显示有多少条待回复的问题。登录后,将显示自己所有讲授的课程列表、目前系统所有的提问和回答、和自己有关的提问、自己已经提交的所有回答、未回复的问题。
2. 删除某个同学对自己相关课程的提问。
3. 回答学生对自己相关课程的提问。
4. 修改密码。 | 1. 课程页面。
2. 设置自己的课程只允许某些同学浏览和提问,增加删除可以浏览提问该课程的学生
3. 上传图片的文件附件。 | 10 | | 学生功能 | 1. 登录后,如果自己的留言问题有老师回答,将显示提示有几条回答,并可以通过连接直接跳转到该回答留言信息。
2. 登录后,每个课程均可以有若干留言问题。
3. 可以提出针对某课程的问题留言。留言包括标题,内容,时间日期。
4. 可以浏览查看当前系统中所有学生的留言提问和教师回答。 5. 可以查看或者删除自己发表的问题。6. 修改密码。 | a) 分类浏览所有课程列表 b) 课程详情页面。 c) 分页显示。 d) 按关键字进行检索。 e) 上传图片的文件附件。 | 11 | 12 | **二、课题主要采用技术** 13 | 14 | | 名称 | 使用说明(例如:使用了哪些技术,大概使用了多少页面或者哪些页面采用了,或者哪些功能采用了等等。。。。。。) | 15 | | --------------------------- | ------------------------------------------------------------ | 16 | | Javabean | 几乎所有页面都用到了JavaBean。 | 17 | | EL | 在学生、教师、管理员的登陆后的Dashboard上以及展示问题和回答的若干页面上使用。(占9 / 23) | 18 | | JSTL | / | 19 | | Servlet(监听器、过滤器等) | / | 20 | | AJAX等异步刷新 | 在添加回答、问题的页面上,查找教师、学院、课程的页面上,展示问题、回答的若干页面上使用了ajax。(占8 / 23) | 21 | | 前端框架 | 使用Bootstrap 4。 | 22 | | 后端框架(mvc,持久层等) | 使用SpringMVC框架、SpringBoot框架、Mybatis持久层框架 | 23 | | 其他 | HTML5,xmlns,Thymeleaf视图渲染引擎。 | 24 | 25 | **三、系统设计** 26 | 27 | 1. ##### 数据库 28 | 29 | **account(账号)** 30 | 31 | | | 名称 | 类型 | 备注 | 32 | | ---- | ------- | -------------------------------------- | -------- | 33 | | PK | acc | varchar(10) | 账号 | 34 | | | psd | varchar(18) | 密码 | 35 | | | accType | enum ('admin', 'teacher', 'student') | 账号类型 | 36 | 37 | **department(学院)** 38 | 39 | | | 名称 | 类型 | 备注 | 40 | | ---- | -------- | ----------- | -------- | 41 | | PK | deptNo | varchar(5) | 学院编号 | 42 | | | deptName | varchar(15) | 学院名字 | 43 | 44 | **student(学生)** 45 | 46 | | | 名称 | 类型 | 备注 | 47 | | ---- | --------- | ---------------- | -------------- | 48 | | PK | stuNo | varchar(10) | 学号,也即账号 | 49 | | | stuName | varchar(30) | 姓名 | 50 | | | gender | enum('男', '女') | 性别 | 51 | | FK | deptNo | varchar(5) | 学院号 | 52 | | | totCredit | tinyint | 总学分 | 53 | | | id | varchar(20) | 身份证 | 54 | | | phone | varchar(15) | 联系电话 | 55 | 56 | **teacher(教师)** 57 | 58 | | | 名称 | 类型 | 备注 | 59 | | ---- | -------- | ---------------- | ---------------- | 60 | | PK | teaNo | varchar(10) | 教师号,也即账号 | 61 | | | teaName | varchar(30) | 姓名 | 62 | | | gender | enum('男', '女') | 性别 | 63 | | FK | deptNo | varchar(5) | 学院号 | 64 | | | teaLevel | varchar(10) | 职称 | 65 | | | teaDscpt | varchar(500) | 简介 | 66 | | | salary | double | 薪资 | 67 | | | id | varchar(20) | 身份证 | 68 | | | phone | varchar(15) | 联系电话 | 69 | 70 | **lesson(课程)** 71 | 72 | | | 名称 | 类型 | 备注 | 73 | | ---- | ------- | ------------ | ------ | 74 | | PK | lsnNo | varchar(8), | 课程号 | 75 | | | lsnName | varchar(20) | 课程名 | 76 | | PK | teaNo | varchar(10), | 教师号 | 77 | | | dscpt | varchar(300) | 简介 | 78 | | | deptNo | varchar(5) | 学院号 | 79 | | | credits | tinyint | 学分 | 80 | 81 | **topic(话题、问题)** 82 | 83 | | | 名称 | 类型 | 备注 | 84 | | ---- | ------- | ------------- | ------------ | 85 | | PK | topicNo | varchar(30) | 问题编号 | 86 | | FK | lsnNo | varchar(8) | 课程号 | 87 | | | title | varchar(30) | 标题 | 88 | | | content | varchar(1000) | 内容 | 89 | | FK | acc | varchar(10) | 提问者账号 | 90 | | FK | teaNo | varchar(10) | 被提问教师号 | 91 | | | needAns | int | 是否已有回复 | 92 | | | moment | datetime | 发表时间 | 93 | 94 | **topicAnswer(回答)** 95 | 96 | | | 名称 | 类型 | 备注 | 97 | | ---- | ------- | ------------- | ---------- | 98 | | PK | ansNo | varchar(30) | 回答编号 | 99 | | FK | lsnNo | varchar(8) | 课程号 | 100 | | FK | topicNo | varchar(30) | 对应问题号 | 101 | | | content | varchar(1000) | 内容 | 102 | | FK | acc | varchar(10) | 回答者账号 | 103 | | | moment | varchar(10) | 发表时间 | 104 | 105 | 2. ##### 项目目录树 106 | 107 | - Application来进行开启本地服务器和部署该项目。pom.xml里是本项目的各种依赖 108 | 109 | - MybatisGenerator可以根据generatorConfig.xml里的配置信息生成model、mapper和dao文件。 110 | 111 | - 每个Controller由名字可知是对应JavaBean的控制类,包含返回视图、对每个实体在数据库中的增删改查操作。 112 | 113 | - 每个DAO层接口文件对应每个类在数据库中增删查改操作的借口。 114 | 115 | - 每个Mapper文件以XML的形式将DAO层的接口实现为具体的SQL语句。 116 | 117 | - model层的类是对应JavaBean的定义,名称中带"Key"字样的是对应Bean的联合主键的定义类,可以通过实现名称中带"Example"字样的类的实例,以便方便快捷地进行对应Bean在数据库中的各种操作(包括一般的增删查改和复杂条件查询)。 118 | 119 | css文件夹存放css文件,js存放js文件,templates文件夹存放所有html文件。 120 | 121 | **四、测试数据及其运行结果** 122 | 123 | ![image013](./readme/image013.png) 124 | 125 | 图 1 登陆界面 126 | 127 | ![image015](./readme/image015.png) 128 | 129 | 图 2学生注册界面 130 | 131 | ![image017](./readme/image017.png) 132 | 133 | 图 3学生登入后界面All Questions是所有问题,MyQuestions是我提的所有问题。Sign Out可以注销。 134 | 135 | ![image019](./readme/image019.png) 136 | 137 | 图 4点击My Questions的Go To See按钮后展示该学生提的问题,delete按钮可以删除该问题。点击See 138 | Answers按钮可以看该问题下的回答。 139 | 140 | ![image021](./readme/image021.png) 141 | 142 | 图 5点击See Answers后可以查看回答,回答可以折叠。 143 | 144 | ![image023](./readme/image023.png) 145 | 146 | 图 6点击左侧边栏Add Question进入提问页面。 147 | 148 | ![image025](./readme/image025.png) 149 | 150 | 图 7教师登陆后面板,展示所授的课程,My Answers是我的回答,AnswersNeeded是需要我回答的问题。 151 | 152 | ![image027](./readme/image027.png) 153 | 154 | 图 8点击左侧Add Answer可以回答问题。 155 | 156 | ![image029](./readme/image029.png) 157 | 158 | 图 9管理员登入后面板,可以查看所有问题和回答,左侧边栏有更多功能。 159 | 160 | ![image031](./readme/image031.png) 161 | 162 | 图 10点击左侧Add Teacher可以添加老师 163 | 164 | ![image033](./readme/image033.png) 165 | 166 | 图 11点击Course Management可以增删查改课程 167 | 168 | ![image035](./readme/image035.png) 169 | 170 | 图 12点击Teacher Management可以增删查改教师 171 | 172 | ![image037](./readme/image037.png) 173 | 174 | 图 13点击Department Management可以增删查改学院 175 | 176 | ![image039](./readme/image039.png) 177 | 178 | 图 14点击Change Password可以修改密码 179 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /mysql-connector-java-8.0.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/mysql-connector-java-8.0.13.jar -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | central 7 | aliyun maven 8 | http://maven.aliyun.com/nexus/content/groups/public/ 9 | default 10 | 11 | 12 | true 13 | 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 4.0.0 21 | 22 | org.springframework.boot 23 | spring-boot-starter-parent 24 | 2.1.1.RELEASE 25 | 26 | 27 | com.friend 28 | py 29 | 0.0.1-SNAPSHOT 30 | py 31 | Demo project for Spring Boot 32 | 33 | 34 | 1.8 35 | 36 | 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-jdbc 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-web 45 | 46 | 47 | org.mybatis.spring.boot 48 | mybatis-spring-boot-starter 49 | 1.3.2 50 | 51 | 52 | 53 | mysql 54 | mysql-connector-java 55 | runtime 56 | 57 | 58 | org.springframework.boot 59 | spring-boot-starter-test 60 | test 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-starter-thymeleaf 65 | 66 | 67 | org.mybatis.generator 68 | mybatis-generator-core 69 | 1.3.2 70 | 71 | 72 | org.springframework.boot 73 | spring-boot-devtools 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 81 | src/main/java/com/friend/py 82 | 83 | 84 | **/*.xml 85 | 86 | false 87 | 88 | 89 | 90 | 91 | org.springframework.boot 92 | spring-boot-maven-plugin 93 | 94 | 95 | org.mybatis.generator 96 | mybatis-generator-maven-plugin 97 | 1.3.2 98 | 99 | 100 | true 101 | true 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /readme/image001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image001.png -------------------------------------------------------------------------------- /readme/image003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image003.png -------------------------------------------------------------------------------- /readme/image005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image005.png -------------------------------------------------------------------------------- /readme/image007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image007.png -------------------------------------------------------------------------------- /readme/image009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image009.png -------------------------------------------------------------------------------- /readme/image011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image011.png -------------------------------------------------------------------------------- /readme/image013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image013.png -------------------------------------------------------------------------------- /readme/image015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image015.png -------------------------------------------------------------------------------- /readme/image017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image017.png -------------------------------------------------------------------------------- /readme/image019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image019.png -------------------------------------------------------------------------------- /readme/image021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image021.png -------------------------------------------------------------------------------- /readme/image023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image023.png -------------------------------------------------------------------------------- /readme/image025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image025.png -------------------------------------------------------------------------------- /readme/image027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image027.png -------------------------------------------------------------------------------- /readme/image029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image029.png -------------------------------------------------------------------------------- /readme/image031.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image031.png -------------------------------------------------------------------------------- /readme/image033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image033.png -------------------------------------------------------------------------------- /readme/image035.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image035.png -------------------------------------------------------------------------------- /readme/image037.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image037.png -------------------------------------------------------------------------------- /readme/image039.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyou200902/java-web-AfterClassDiscuss/01327683ed82145d17324c306b4bf3b77749e171/readme/image039.png -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import com.friend.py.dao.AccountMapper; 4 | import com.friend.py.model.Account; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.SessionAttribute; 10 | 11 | @Controller 12 | @Service 13 | public class AccountController { 14 | @Autowired 15 | private AccountMapper accountMapper; 16 | 17 | @RequestMapping("/ChangePassword") 18 | public String UpdatePassword(String number) { 19 | // Account account = accountMapper.selectByPrimaryKey() 20 | return "ChangePassword"; 21 | } 22 | 23 | 24 | @RequestMapping("/UpdatePassword") 25 | public String UpdatePassword(String oldPassword, String newPassword, 26 | @SessionAttribute("account") Account account) { 27 | if(oldPassword.equals(account.getPsd())) { 28 | if(!oldPassword.equals(newPassword)) { 29 | account.setPsd(newPassword); 30 | accountMapper.updateByPrimaryKey(account); 31 | System.out.println("password change success."); 32 | } else { 33 | System.out.println("password not changed."); 34 | } 35 | return "StudentDashboard"; 36 | } else { 37 | System.out.println("password change failed."); 38 | return "ChangePassword"; 39 | } 40 | } 41 | // public void printsession(HttpSession session) { 42 | // String[] names = session.getValueNames(); 43 | // for (int i = 0; i < names.length; i++) { 44 | // System.out.println(names[i] + ":" + session.getValue(names[i])); 45 | // } 46 | // } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/AnswerController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | 4 | import com.friend.py.dao.TopicAnswerMapper; 5 | import com.friend.py.dao.TopicMapper; 6 | import com.friend.py.model.Account; 7 | import com.friend.py.model.Topic; 8 | import com.friend.py.model.TopicAnswer; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.ui.Model; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.ResponseBody; 15 | import org.springframework.web.bind.annotation.SessionAttribute; 16 | 17 | import java.util.Date; 18 | 19 | @Controller 20 | @Service 21 | public class AnswerController { 22 | @Autowired 23 | TopicMapper topicMapper; 24 | @Autowired 25 | TopicAnswerMapper topicAnswerMapper; 26 | 27 | @RequestMapping("/AddAnswer") 28 | private String AddAnswer() { 29 | return "AddAnswer"; 30 | } 31 | 32 | @RequestMapping("/AddAns") 33 | @ResponseBody 34 | private StringBuffer AddAns(String ansNo, String topicNo, String content, 35 | @SessionAttribute Account account) { 36 | StringBuffer stringBuffer = new StringBuffer(); 37 | Topic topic = topicMapper.selectByPrimaryKey(topicNo); 38 | TopicAnswer topicAnswer = topicAnswerMapper.selectByPrimaryKey(ansNo); 39 | if(topicAnswer == null && topic != null) { 40 | String lsnNo = topic.getLsnno(); 41 | String teaNo = topic.getTeano(); 42 | topicAnswer = new TopicAnswer(ansNo, lsnNo, topicNo, content, account.getAcc(), new Date()); 43 | topicAnswerMapper.insert(topicAnswer); 44 | stringBuffer.append("success"); 45 | } else { 46 | stringBuffer.append("not found topic OR Ans number existed."); 47 | } 48 | return stringBuffer; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/DeptController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import com.friend.py.dao.DepartmentMapper; 4 | import com.friend.py.model.Department; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | @Controller 15 | @Service 16 | public class DeptController { 17 | @Autowired private DepartmentMapper departmentMapper; 18 | @RequestMapping("/FindDept") 19 | private String FindDept() { 20 | return "FindDepartment"; 21 | } 22 | 23 | @RequestMapping("/FindDepartment") 24 | @ResponseBody 25 | private Map FindDepartment(String number) { 26 | System.out.println("FindDepartment" + number); 27 | Map map = new HashMap(); 28 | Department department = departmentMapper.selectByPrimaryKey(number); 29 | if(department != null) { 30 | map.put("result", "Successfully found!"); 31 | map.put("deptName", department.getDeptname()); 32 | } else { 33 | map.put("result", "Not Found"); 34 | } 35 | return map; 36 | } 37 | 38 | @RequestMapping("/UpdateDepartment") 39 | @ResponseBody 40 | private StringBuffer UpdateDepartment(String number, String deptName) { 41 | System.out.println("UpdateDepartment" + number); 42 | Department department = departmentMapper.selectByPrimaryKey(number); 43 | StringBuffer stringBuffer = new StringBuffer(); 44 | if(department != null) { 45 | department.setDeptname(deptName); 46 | departmentMapper.updateByPrimaryKey(department); 47 | stringBuffer.append("success"); 48 | } else { 49 | stringBuffer.append("not found"); 50 | } 51 | return stringBuffer; 52 | } 53 | 54 | @RequestMapping("/DelDepartment") 55 | @ResponseBody 56 | private StringBuffer DelDepartment(String number) { 57 | Department department = departmentMapper.selectByPrimaryKey(number); 58 | StringBuffer stringBuffer = new StringBuffer(); 59 | if(department != null) { 60 | departmentMapper.deleteByPrimaryKey(number); 61 | stringBuffer.append("success"); 62 | } else { 63 | stringBuffer.append("not found"); 64 | } 65 | return stringBuffer; 66 | } 67 | 68 | @RequestMapping("/AddDepartment") 69 | @ResponseBody 70 | private StringBuffer AddDepartment(String number, String deptName) { 71 | System.out.println("AddDepartment" + number); 72 | Department department = departmentMapper.selectByPrimaryKey(number); 73 | StringBuffer stringBuffer = new StringBuffer(); 74 | if(department != null) { 75 | stringBuffer.append("Department already existed!"); 76 | } else { 77 | department = new Department(number, deptName); 78 | departmentMapper.insert(department); 79 | stringBuffer.append("success"); 80 | } 81 | return stringBuffer; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/LessonController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import com.friend.py.dao.LessonMapper; 4 | import com.friend.py.model.Lesson; 5 | import com.friend.py.model.LessonKey; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | @Controller 16 | @Service 17 | public class LessonController { 18 | @Autowired private LessonMapper lessonMapper; 19 | 20 | @RequestMapping("/FindLesson") 21 | private String FindLesson() { 22 | return "FindLesson"; 23 | } 24 | 25 | @RequestMapping("/FindLsn") 26 | @ResponseBody 27 | private Map FindLsn(String number, String teano) { 28 | LessonKey lessonKey = new LessonKey(number, teano); 29 | Map map = new HashMap(); 30 | Lesson lesson = lessonMapper.selectByPrimaryKey(lessonKey); 31 | if(lesson != null) { 32 | map.put("result", "success"); 33 | // map.put("number", lesson.getLsnno()); 34 | map.put("name", lesson.getLsnname()); 35 | map.put("dscpt", lesson.getDscpt()); 36 | map.put("dept", lesson.getDeptno()); 37 | map.put("credit", lesson.getCredits().toString()); 38 | } else { 39 | map.put("result", "not found"); 40 | } 41 | return map; 42 | } 43 | 44 | @RequestMapping("/UpdateLsn") 45 | @ResponseBody 46 | private StringBuffer UpdateLsn(String number, String teano, String name, 47 | String dscpt, String dept, String credit) { 48 | StringBuffer stringBuffer = new StringBuffer(); 49 | Byte credits = Byte.valueOf(credit); 50 | LessonKey lessonKey = new LessonKey(number, teano); 51 | Lesson lesson = lessonMapper.selectByPrimaryKey(lessonKey); 52 | if(lesson != null) { 53 | lesson.setLsnname(name); 54 | lesson.setDscpt(dscpt); 55 | lesson.setDeptno(dept); 56 | lesson.setCredits(credits); 57 | lessonMapper.updateByPrimaryKey(lesson); 58 | stringBuffer.append("success"); 59 | } else { 60 | stringBuffer.append("not found"); 61 | } 62 | return stringBuffer; 63 | } 64 | 65 | @RequestMapping("/DelLsn") 66 | @ResponseBody 67 | private StringBuffer DelLsn(String number, String teano) { 68 | StringBuffer stringBuffer = new StringBuffer(); 69 | LessonKey lessonKey = new LessonKey(number, teano); 70 | Lesson lesson = lessonMapper.selectByPrimaryKey(lessonKey); 71 | if(lesson != null) { 72 | lessonMapper.deleteByPrimaryKey(lessonKey); 73 | stringBuffer.append("success"); 74 | } else { 75 | stringBuffer.append("not found"); 76 | } 77 | return stringBuffer; 78 | } 79 | 80 | @RequestMapping("/AddLsn") 81 | @ResponseBody 82 | private StringBuffer AddLsn(String number, String name, String teano, 83 | String dscpt, String dept, String credit) { 84 | StringBuffer stringBuffer = new StringBuffer(); 85 | Byte credits = new Byte(credit); 86 | LessonKey lessonKey = new LessonKey(number, teano); 87 | Lesson lesson = lessonMapper.selectByPrimaryKey(lessonKey); 88 | if(lesson == null) { 89 | lesson = new Lesson(number, teano, name, dscpt, dept, credits); 90 | lessonMapper.insert(lesson); 91 | stringBuffer.append("success"); 92 | } else { 93 | stringBuffer.append("lesson existed"); 94 | } 95 | return stringBuffer; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import com.friend.py.dao.*; 4 | import com.friend.py.model.*; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.ui.Model; 9 | import org.springframework.ui.ModelMap; 10 | import org.springframework.web.bind.annotation.ModelAttribute; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.SessionAttribute; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpSession; 16 | import java.util.ArrayList; 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | 22 | @Controller 23 | @Service 24 | public class LoginController { 25 | @Autowired 26 | private AccountMapper accountMapper; 27 | @Autowired 28 | private TopicMapper topicMapper; 29 | @Autowired 30 | private TopicAnswerMapper topicAnswerMapper; 31 | @Autowired 32 | private LessonMapper lessonMapper; 33 | @Autowired 34 | private TeacherMapper teacherMapper; 35 | @Autowired 36 | private DepartmentMapper departmentMapper; 37 | 38 | @RequestMapping("/") 39 | public String checkLogin(@ModelAttribute("signed") String signed) { 40 | System.out.println("signed == null is " + (signed == null)); //true 41 | // System.out.println("signed.equals(null) is " + signed.equals(null)); // error 42 | 43 | if(signed == null || signed.equals("0")) { 44 | return "login"; 45 | } 46 | // if(signed.equals("0")) { 47 | // System.out.println(signed); 48 | // return "login"; 49 | // } 50 | // System.out.println(signed); 51 | else if(signed.equals("1")) return "StudentDashboard"; 52 | else return "login"; 53 | // return "login"; 54 | } 55 | 56 | @RequestMapping("/login") 57 | public String login(String inputNumber, String inputPassword, String accType, Model model, 58 | String signed, HttpServletRequest request){ 59 | // System.out.println("inputNumber == null is " + (inputNumber == null)); 60 | // System.out.println("inputPassword == null is " + (inputPassword == null)); 61 | // System.out.println("signed == null is " + (signed == null)); 62 | String view = "login"; 63 | Account account = accountMapper.selectByPrimaryKey(inputNumber); 64 | if(inputNumber.equals(account.getAcc()) && 65 | inputPassword.equals(account.getPsd()) && 66 | account.getAcctype().equals(accType)) { 67 | Map m = new HashMap(); 68 | HttpSession session = request.getSession(); 69 | signed = new String("1"); 70 | session.setAttribute("signed", signed); 71 | session.setAttribute("account", account); 72 | TopicExample topicExample = new TopicExample(); 73 | int all = topicMapper.countByExample(topicExample); 74 | // topicExample.createCriteria(); 75 | if(account.getAcctype().equals("student")) { 76 | topicExample.createCriteria().andAccEqualTo(account.getAcc()); 77 | int my = topicMapper.countByExample(topicExample); 78 | m.put("my", String.valueOf(my)); 79 | view = "StudentDashboard"; 80 | } 81 | else if(account.getAcctype().equals("teacher")) { 82 | Teacher teacher = teacherMapper.selectByPrimaryKey(account.getAcc()); 83 | String teaName = teacher.getTeaname(); 84 | String dept = departmentMapper.selectByPrimaryKey(teacher.getDeptno()).getDeptname(); 85 | TopicAnswerExample topicAnswerExample = new TopicAnswerExample(); 86 | topicAnswerExample.createCriteria().andAccEqualTo(account.getAcc()); 87 | int myAns = topicAnswerMapper.countByExample(topicAnswerExample); 88 | topicExample.or().andTeanoEqualTo(account.getAcc()); 89 | int my = topicMapper.countByExample(topicExample); 90 | topicExample.clear(); 91 | topicExample.or().andTeanoEqualTo(account.getAcc()).andNeedansEqualTo(1); 92 | int needAns = topicMapper.countByExample(topicExample); 93 | m.put("my", String.valueOf(my)); 94 | m.put("myAns", String.valueOf(myAns)); 95 | m.put("needAns", String.valueOf(needAns)); 96 | List> list = new ArrayList>(); 97 | List myLessons = null; 98 | LessonExample lessonExample = new LessonExample(); 99 | lessonExample.createCriteria().andTeanoEqualTo(account.getAcc()); 100 | myLessons = lessonMapper.selectByExample(lessonExample); 101 | if(myLessons != null) { 102 | for (int i = 0; i < myLessons.size(); i++) { 103 | Map map = new HashMap<>(); 104 | Lesson lesson = myLessons.get(i); 105 | map.put("lsnOrder", String.valueOf(i+1)); 106 | map.put("lsnName", lesson.getLsnname()); 107 | map.put("teaName", teaName); 108 | map.put("dept", dept); 109 | map.put("dscpt", lesson.getDscpt()); 110 | map.put("credit", lesson.getCredits()); 111 | list.add(map); 112 | } 113 | } 114 | model.addAttribute("myLessons", list); 115 | view = "TeacherDashboard"; 116 | } 117 | else if(account.getAcctype().equals("admin")) { 118 | TopicAnswerExample topicAnswerExample = new TopicAnswerExample(); 119 | // topicAnswerExample.createCriteria(); 120 | int allAns = topicAnswerMapper.countByExample(topicAnswerExample); 121 | m.put("allAns", String.valueOf(allAns)); 122 | view = "AdminDashboard"; 123 | } 124 | m.put("all", String.valueOf(all)); 125 | model.addAttribute("countMap",m); 126 | } 127 | return view; 128 | } 129 | 130 | @RequestMapping("/Dashboard") 131 | private String Dashboard(@SessionAttribute("signed") String signed, 132 | @SessionAttribute Account account, Model model, 133 | HttpServletRequest request) { 134 | System.out.println("Dashboard"+signed); 135 | System.out.println("Dashboard"+account.getAcctype()); 136 | if(signed.equals("1")) { 137 | return login(account.getAcc(), account.getPsd(), account.getAcctype(), model, signed, request); 138 | // if(account.getAcctype().equals("student")) { 139 | // return "StudentDashboard"; 140 | // } 141 | // else if(account.getAcctype().equals("teacher")) { 142 | // return "TeacherDashboard"; 143 | // } 144 | // else if(account.getAcctype().equals("admin")) { 145 | // return "AdminDashboard"; 146 | // } 147 | } 148 | return "login"; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/StudentController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | // Register For Students 3 | 4 | import com.friend.py.dao.AccountMapper; 5 | import com.friend.py.dao.StudentMapper; 6 | import com.friend.py.model.Account; 7 | import com.friend.py.model.Student; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import javax.swing.*; 14 | 15 | //import java.util.List; 16 | 17 | @Controller 18 | @Service 19 | public class StudentController { 20 | @Autowired 21 | private StudentMapper studentMapper; 22 | @Autowired 23 | private AccountMapper accountMapper; 24 | 25 | @RequestMapping("/register") 26 | private String register(){ 27 | return "register"; 28 | } 29 | 30 | @RequestMapping("/AddStu") 31 | private String AddStuAcc(String number, String password, String name, 32 | String gender, String deptNo, Byte totcredit, 33 | String id, String phone){ 34 | // studentMapper = new StudentMapper(); 35 | // System.out.println(number); 36 | // System.out.println(name); 37 | // System.out.println(gender); 38 | // System.out.println(deptNo); 39 | // System.out.println(id); 40 | // System.out.println(phone); 41 | Account account = accountMapper.selectByPrimaryKey(number); 42 | Student student = studentMapper.selectByPrimaryKey(number); 43 | if(account == null || student == null) { 44 | account = new Account(number, password, "student"); 45 | student = student = new Student(number, name, gender, deptNo, new Byte("0"), id, phone); 46 | accountMapper.insert(account); 47 | studentMapper.insert(student); 48 | return "SuccessfullyRegister"; 49 | // JOptionPane.showMessageDialog(null, "Successfully Registered! ", 50 | // "Success", JOptionPane.PLAIN_MESSAGE); 51 | } else { 52 | return "NumberExisted"; 53 | // JOptionPane.showMessageDialog(null, "Number already existed!", 54 | // "Failed", JOptionPane.ERROR_MESSAGE); 55 | } 56 | // return "login"; 57 | } 58 | 59 | @RequestMapping("/DeleteStu") 60 | private String DeleteStu(){ 61 | String s = "test"; 62 | return s; 63 | } 64 | 65 | @RequestMapping("/UpdateStu") 66 | private String UpdateStu(){ 67 | String s = "test"; 68 | return s; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/TeacherController.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import com.friend.py.dao.AccountMapper; 4 | import com.friend.py.dao.DepartmentMapper; 5 | import com.friend.py.dao.TeacherMapper; 6 | import com.friend.py.model.Account; 7 | import com.friend.py.model.Department; 8 | import com.friend.py.model.DepartmentExample; 9 | import com.friend.py.model.Teacher; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | 19 | @Controller 20 | @Service 21 | public class TeacherController { 22 | @Autowired private TeacherMapper teacherMapper; 23 | @Autowired private AccountMapper accountMapper; 24 | @Autowired private DepartmentMapper departmentMapper; 25 | 26 | @RequestMapping("/AddTeacher") 27 | private String AddTeacher() { 28 | return "TeacherRegister"; 29 | } 30 | 31 | @RequestMapping("/DelTeacher") 32 | @ResponseBody 33 | public StringBuffer DelTeacher(String number) { 34 | StringBuffer result = new StringBuffer(); 35 | Account account = accountMapper.selectByPrimaryKey(number); 36 | Teacher teacher = teacherMapper.selectByPrimaryKey(number); 37 | System.out.println(number); 38 | if(account != null) { 39 | accountMapper.deleteByPrimaryKey(number); 40 | result.append("{Teacher account deleted."); 41 | } else { 42 | result.append("Teacher account not found."); 43 | } 44 | if(teacher != null) { 45 | teacherMapper.deleteByPrimaryKey(number); 46 | result.append("Teacher record deleted."); 47 | } else { 48 | result.append("Teacher record not found."); 49 | } 50 | return result; 51 | } 52 | 53 | @RequestMapping("/TeacherRegister") 54 | public String TeacherRegister(String number, String name, String gender, String deptNo, 55 | String teaLevel, String teaDscpt, Double salary, String id, 56 | String phone, String password) { 57 | Account account = accountMapper.selectByPrimaryKey(number); 58 | Teacher teacher = teacherMapper.selectByPrimaryKey(number); 59 | if(teacher == null || account == null) { 60 | account = new Account(number, password, "teacher"); 61 | teacher = new Teacher(number, name, gender, deptNo, teaLevel, teaDscpt, salary, id, phone); 62 | accountMapper.insert(account); 63 | teacherMapper.insert(teacher); 64 | System.out.println("Teacher register succeeded."); 65 | return "SuccessfullyRegister"; 66 | } else { 67 | System.out.println("Teacher register failed."); 68 | return "TeacherRegister"; 69 | } 70 | 71 | } 72 | 73 | @GetMapping("/FindAccount") 74 | public String FindAccount(String teano) { 75 | // System.out.println("findaccount"); 76 | System.out.println("findaccount " + teano); 77 | return "FindAccount"; 78 | } 79 | 80 | // @RequestMapping("/FindTeacher") 81 | // public void FindTeacher(String number, HttpServletRequest request) { 82 | // HttpSession session = request.getSession(); 83 | // String number = (String) session.getAttribute("number"); 84 | // System.out.println(number); 85 | // Teacher teacher = teacherMapper.selectByPrimaryKey(number); 86 | // session.setAttribute("selectedTeacher",teacher); 87 | // return teacher; 88 | // } 89 | @RequestMapping("/FindTeacher") 90 | @ResponseBody 91 | private Map FindTeacher(String number){ //user是与页面参数对应的JavaBean 92 | //map集合用来存放返回值 93 | Teacher teacher = teacherMapper.selectByPrimaryKey(number); 94 | System.out.println("FindTeacher +" + number); 95 | Map map = new HashMap(); 96 | if(teacher != null) { 97 | Department department = departmentMapper.selectByPrimaryKey(teacher.getDeptno()); 98 | map.put("teaname",teacher.getTeaname()); 99 | map.put("gender",teacher.getGender()); 100 | map.put("dept",department.getDeptname()); 101 | map.put("id",teacher.getId()); 102 | map.put("phone",teacher.getPhone()); 103 | System.out.println(map); 104 | }else { 105 | map.put("teaname", ""); 106 | map.put("gender", ""); 107 | map.put("dept", ""); 108 | map.put("id", ""); 109 | map.put("phone", ""); 110 | } 111 | return map; 112 | } 113 | 114 | @RequestMapping("/UpdateTeacher") 115 | @ResponseBody 116 | public StringBuffer UpdateTeacher(String number, String name, 117 | String gender, String deptname, 118 | String id, String phone) { 119 | DepartmentExample departmentExample = new DepartmentExample(); 120 | departmentExample.createCriteria().andDeptnameEqualTo(deptname); 121 | Teacher teacher = teacherMapper.selectByPrimaryKey(number); 122 | Department dept = departmentMapper.selectByExample(departmentExample).get(0); 123 | StringBuffer stringBuffer = new StringBuffer(); 124 | if(teacher != null) { 125 | teacher.setTeaname(name); 126 | teacher.setGender(gender); 127 | teacher.setId(id); 128 | teacher.setPhone(phone); 129 | teacher.setDeptno(dept.getDeptno()); 130 | teacherMapper.updateByPrimaryKey(teacher); 131 | stringBuffer.append("Update Success!"); 132 | } else { 133 | stringBuffer.append("Update Failed!"); 134 | } 135 | return stringBuffer; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/Controller/test.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.Controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.stereotype.Service; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | 7 | @Controller 8 | @Service 9 | public class test { 10 | // public static void main(String[] args) { 11 | // Byte a = 0; 12 | // System.out.println(a); 13 | // } 14 | @RequestMapping("/testbutton") 15 | private String a(){ 16 | System.out.println("a"); 17 | b(); 18 | return "test"; 19 | } 20 | 21 | private void b(){ 22 | System.out.println("b"); 23 | } 24 | @RequestMapping("/test") 25 | public String ttest() { 26 | return "test"; 27 | } 28 | 29 | // public static void main(String[] args){ 30 | // new test().a(); 31 | // } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/MybatisGenerator.java: -------------------------------------------------------------------------------- 1 | package com.friend.py; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.sql.SQLException; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import org.mybatis.generator.api.MyBatisGenerator; 10 | import org.mybatis.generator.config.Configuration; 11 | import org.mybatis.generator.config.xml.ConfigurationParser; 12 | import org.mybatis.generator.exception.InvalidConfigurationException; 13 | import org.mybatis.generator.exception.XMLParserException; 14 | import org.mybatis.generator.internal.DefaultShellCallback; 15 | public class MybatisGenerator { 16 | public static void main(String[] args) { 17 | try { 18 | System.out.println("start generator ..."); 19 | List warnings = new ArrayList(); 20 | boolean overwrite = true; 21 | File configFile = new File(MybatisGenerator.class.getResource("generatorConfig.xml").getFile()); 22 | ConfigurationParser cp = new ConfigurationParser(warnings); 23 | Configuration config = cp.parseConfiguration(configFile); 24 | DefaultShellCallback callback = new DefaultShellCallback(overwrite); 25 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); 26 | myBatisGenerator.generate(null); 27 | System.out.println("end generator!"); 28 | } catch (IOException e) { 29 | e.printStackTrace(); 30 | } catch (XMLParserException e) { 31 | e.printStackTrace(); 32 | } catch (InvalidConfigurationException e) { 33 | e.printStackTrace(); 34 | } catch (SQLException e) { 35 | e.printStackTrace(); 36 | } catch (InterruptedException e) { 37 | e.printStackTrace(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/PyApplication.java: -------------------------------------------------------------------------------- 1 | package com.friend.py; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication 9 | @MapperScan("com.friend.py.dao") 10 | public class PyApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(PyApplication.class, args); 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/AccountMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Account; 4 | import com.friend.py.model.AccountExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface AccountMapper { 11 | int countByExample(AccountExample example); 12 | 13 | int deleteByExample(AccountExample example); 14 | 15 | int deleteByPrimaryKey(String acc); 16 | 17 | int insert(Account record); 18 | 19 | int insertSelective(Account record); 20 | 21 | List selectByExample(AccountExample example); 22 | 23 | Account selectByPrimaryKey(String acc); 24 | 25 | int updateByExampleSelective(@Param("record") Account record, @Param("example") AccountExample example); 26 | 27 | int updateByExample(@Param("record") Account record, @Param("example") AccountExample example); 28 | 29 | int updateByPrimaryKeySelective(Account record); 30 | 31 | int updateByPrimaryKey(Account record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/DepartmentMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Department; 4 | import com.friend.py.model.DepartmentExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface DepartmentMapper { 11 | int countByExample(DepartmentExample example); 12 | 13 | int deleteByExample(DepartmentExample example); 14 | 15 | int deleteByPrimaryKey(String deptno); 16 | 17 | int insert(Department record); 18 | 19 | int insertSelective(Department record); 20 | 21 | List selectByExample(DepartmentExample example); 22 | 23 | Department selectByPrimaryKey(String deptno); 24 | 25 | int updateByExampleSelective(@Param("record") Department record, @Param("example") DepartmentExample example); 26 | 27 | int updateByExample(@Param("record") Department record, @Param("example") DepartmentExample example); 28 | 29 | int updateByPrimaryKeySelective(Department record); 30 | 31 | int updateByPrimaryKey(Department record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/LessonMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Lesson; 4 | import com.friend.py.model.LessonExample; 5 | import com.friend.py.model.LessonKey; 6 | import java.util.List; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository 11 | public interface LessonMapper { 12 | int countByExample(LessonExample example); 13 | 14 | int deleteByExample(LessonExample example); 15 | 16 | int deleteByPrimaryKey(LessonKey key); 17 | 18 | int insert(Lesson record); 19 | 20 | int insertSelective(Lesson record); 21 | 22 | List selectByExample(LessonExample example); 23 | 24 | Lesson selectByPrimaryKey(LessonKey key); 25 | 26 | int updateByExampleSelective(@Param("record") Lesson record, @Param("example") LessonExample example); 27 | 28 | int updateByExample(@Param("record") Lesson record, @Param("example") LessonExample example); 29 | 30 | int updateByPrimaryKeySelective(Lesson record); 31 | 32 | int updateByPrimaryKey(Lesson record); 33 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Student; 4 | import com.friend.py.model.StudentExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface StudentMapper { 11 | int countByExample(StudentExample example); 12 | 13 | int deleteByExample(StudentExample example); 14 | 15 | int deleteByPrimaryKey(String stuno); 16 | 17 | int insert(Student record); 18 | 19 | int insertSelective(Student record); 20 | 21 | List selectByExample(StudentExample example); 22 | 23 | Student selectByPrimaryKey(String stuno); 24 | 25 | int updateByExampleSelective(@Param("record") Student record, @Param("example") StudentExample example); 26 | 27 | int updateByExample(@Param("record") Student record, @Param("example") StudentExample example); 28 | 29 | int updateByPrimaryKeySelective(Student record); 30 | 31 | int updateByPrimaryKey(Student record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/TeacherMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Teacher; 4 | import com.friend.py.model.TeacherExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface TeacherMapper { 11 | int countByExample(TeacherExample example); 12 | 13 | int deleteByExample(TeacherExample example); 14 | 15 | int deleteByPrimaryKey(String teano); 16 | 17 | int insert(Teacher record); 18 | 19 | int insertSelective(Teacher record); 20 | 21 | List selectByExample(TeacherExample example); 22 | 23 | Teacher selectByPrimaryKey(String teano); 24 | 25 | int updateByExampleSelective(@Param("record") Teacher record, @Param("example") TeacherExample example); 26 | 27 | int updateByExample(@Param("record") Teacher record, @Param("example") TeacherExample example); 28 | 29 | int updateByPrimaryKeySelective(Teacher record); 30 | 31 | int updateByPrimaryKey(Teacher record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/TopicAnswerMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.TopicAnswer; 4 | import com.friend.py.model.TopicAnswerExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface TopicAnswerMapper { 11 | int countByExample(TopicAnswerExample example); 12 | 13 | int deleteByExample(TopicAnswerExample example); 14 | 15 | int deleteByPrimaryKey(String ansno); 16 | 17 | int insert(TopicAnswer record); 18 | 19 | int insertSelective(TopicAnswer record); 20 | 21 | List selectByExample(TopicAnswerExample example); 22 | 23 | TopicAnswer selectByPrimaryKey(String ansno); 24 | 25 | int updateByExampleSelective(@Param("record") TopicAnswer record, @Param("example") TopicAnswerExample example); 26 | 27 | int updateByExample(@Param("record") TopicAnswer record, @Param("example") TopicAnswerExample example); 28 | 29 | int updateByPrimaryKeySelective(TopicAnswer record); 30 | 31 | int updateByPrimaryKey(TopicAnswer record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/dao/TopicMapper.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.dao; 2 | 3 | import com.friend.py.model.Topic; 4 | import com.friend.py.model.TopicExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface TopicMapper { 11 | int countByExample(TopicExample example); 12 | 13 | int deleteByExample(TopicExample example); 14 | 15 | int deleteByPrimaryKey(String topicno); 16 | 17 | int insert(Topic record); 18 | 19 | int insertSelective(Topic record); 20 | 21 | List selectByExample(TopicExample example); 22 | 23 | Topic selectByPrimaryKey(String topicno); 24 | 25 | int updateByExampleSelective(@Param("record") Topic record, @Param("example") TopicExample example); 26 | 27 | int updateByExample(@Param("record") Topic record, @Param("example") TopicExample example); 28 | 29 | int updateByPrimaryKeySelective(Topic record); 30 | 31 | int updateByPrimaryKey(Topic record); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/mapper/AccountMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | and ${criterion.condition} 18 | 19 | 20 | and ${criterion.condition} #{criterion.value} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 24 | 25 | 26 | and ${criterion.condition} 27 | 28 | #{listItem} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | and ${criterion.condition} 47 | 48 | 49 | and ${criterion.condition} #{criterion.value} 50 | 51 | 52 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 53 | 54 | 55 | and ${criterion.condition} 56 | 57 | #{listItem} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | acc, psd, accType 69 | 70 | 85 | 91 | 92 | delete from account 93 | where acc = #{acc,jdbcType=VARCHAR} 94 | 95 | 96 | delete from account 97 | 98 | 99 | 100 | 101 | 102 | insert into account (acc, psd, accType 103 | ) 104 | values (#{acc,jdbcType=VARCHAR}, #{psd,jdbcType=VARCHAR}, #{acctype,jdbcType=CHAR} 105 | ) 106 | 107 | 108 | insert into account 109 | 110 | 111 | acc, 112 | 113 | 114 | psd, 115 | 116 | 117 | accType, 118 | 119 | 120 | 121 | 122 | #{acc,jdbcType=VARCHAR}, 123 | 124 | 125 | #{psd,jdbcType=VARCHAR}, 126 | 127 | 128 | #{acctype,jdbcType=CHAR}, 129 | 130 | 131 | 132 | 138 | 139 | update account 140 | 141 | 142 | acc = #{record.acc,jdbcType=VARCHAR}, 143 | 144 | 145 | psd = #{record.psd,jdbcType=VARCHAR}, 146 | 147 | 148 | accType = #{record.acctype,jdbcType=CHAR}, 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | update account 157 | set acc = #{record.acc,jdbcType=VARCHAR}, 158 | psd = #{record.psd,jdbcType=VARCHAR}, 159 | accType = #{record.acctype,jdbcType=CHAR} 160 | 161 | 162 | 163 | 164 | 165 | update account 166 | 167 | 168 | psd = #{psd,jdbcType=VARCHAR}, 169 | 170 | 171 | accType = #{acctype,jdbcType=CHAR}, 172 | 173 | 174 | where acc = #{acc,jdbcType=VARCHAR} 175 | 176 | 177 | update account 178 | set psd = #{psd,jdbcType=VARCHAR}, 179 | accType = #{acctype,jdbcType=CHAR} 180 | where acc = #{acc,jdbcType=VARCHAR} 181 | 182 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/mapper/DepartmentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | and ${criterion.condition} 17 | 18 | 19 | and ${criterion.condition} #{criterion.value} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 23 | 24 | 25 | and ${criterion.condition} 26 | 27 | #{listItem} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | and ${criterion.condition} 46 | 47 | 48 | and ${criterion.condition} #{criterion.value} 49 | 50 | 51 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 52 | 53 | 54 | and ${criterion.condition} 55 | 56 | #{listItem} 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | deptNo, deptName 68 | 69 | 84 | 90 | 91 | delete from department 92 | where deptNo = #{deptno,jdbcType=VARCHAR} 93 | 94 | 95 | delete from department 96 | 97 | 98 | 99 | 100 | 101 | insert into department (deptNo, deptName) 102 | values (#{deptno,jdbcType=VARCHAR}, #{deptname,jdbcType=VARCHAR}) 103 | 104 | 105 | insert into department 106 | 107 | 108 | deptNo, 109 | 110 | 111 | deptName, 112 | 113 | 114 | 115 | 116 | #{deptno,jdbcType=VARCHAR}, 117 | 118 | 119 | #{deptname,jdbcType=VARCHAR}, 120 | 121 | 122 | 123 | 129 | 130 | update department 131 | 132 | 133 | deptNo = #{record.deptno,jdbcType=VARCHAR}, 134 | 135 | 136 | deptName = #{record.deptname,jdbcType=VARCHAR}, 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | update department 145 | set deptNo = #{record.deptno,jdbcType=VARCHAR}, 146 | deptName = #{record.deptname,jdbcType=VARCHAR} 147 | 148 | 149 | 150 | 151 | 152 | update department 153 | 154 | 155 | deptName = #{deptname,jdbcType=VARCHAR}, 156 | 157 | 158 | where deptNo = #{deptno,jdbcType=VARCHAR} 159 | 160 | 161 | update department 162 | set deptName = #{deptname,jdbcType=VARCHAR} 163 | where deptNo = #{deptno,jdbcType=VARCHAR} 164 | 165 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/mapper/LessonMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | and ${criterion.condition} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} 24 | 25 | 26 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 27 | 28 | 29 | and ${criterion.condition} 30 | 31 | #{listItem} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | and ${criterion.condition} 50 | 51 | 52 | and ${criterion.condition} #{criterion.value} 53 | 54 | 55 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 56 | 57 | 58 | and ${criterion.condition} 59 | 60 | #{listItem} 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | lsnNo, teaNo, lsnName, dscpt, deptNo, credits 72 | 73 | 88 | 95 | 96 | delete from lesson 97 | where lsnNo = #{lsnno,jdbcType=VARCHAR} 98 | and teaNo = #{teano,jdbcType=VARCHAR} 99 | 100 | 101 | delete from lesson 102 | 103 | 104 | 105 | 106 | 107 | insert into lesson (lsnNo, teaNo, lsnName, 108 | dscpt, deptNo, credits 109 | ) 110 | values (#{lsnno,jdbcType=VARCHAR}, #{teano,jdbcType=VARCHAR}, #{lsnname,jdbcType=VARCHAR}, 111 | #{dscpt,jdbcType=VARCHAR}, #{deptno,jdbcType=VARCHAR}, #{credits,jdbcType=TINYINT} 112 | ) 113 | 114 | 115 | insert into lesson 116 | 117 | 118 | lsnNo, 119 | 120 | 121 | teaNo, 122 | 123 | 124 | lsnName, 125 | 126 | 127 | dscpt, 128 | 129 | 130 | deptNo, 131 | 132 | 133 | credits, 134 | 135 | 136 | 137 | 138 | #{lsnno,jdbcType=VARCHAR}, 139 | 140 | 141 | #{teano,jdbcType=VARCHAR}, 142 | 143 | 144 | #{lsnname,jdbcType=VARCHAR}, 145 | 146 | 147 | #{dscpt,jdbcType=VARCHAR}, 148 | 149 | 150 | #{deptno,jdbcType=VARCHAR}, 151 | 152 | 153 | #{credits,jdbcType=TINYINT}, 154 | 155 | 156 | 157 | 163 | 164 | update lesson 165 | 166 | 167 | lsnNo = #{record.lsnno,jdbcType=VARCHAR}, 168 | 169 | 170 | teaNo = #{record.teano,jdbcType=VARCHAR}, 171 | 172 | 173 | lsnName = #{record.lsnname,jdbcType=VARCHAR}, 174 | 175 | 176 | dscpt = #{record.dscpt,jdbcType=VARCHAR}, 177 | 178 | 179 | deptNo = #{record.deptno,jdbcType=VARCHAR}, 180 | 181 | 182 | credits = #{record.credits,jdbcType=TINYINT}, 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | update lesson 191 | set lsnNo = #{record.lsnno,jdbcType=VARCHAR}, 192 | teaNo = #{record.teano,jdbcType=VARCHAR}, 193 | lsnName = #{record.lsnname,jdbcType=VARCHAR}, 194 | dscpt = #{record.dscpt,jdbcType=VARCHAR}, 195 | deptNo = #{record.deptno,jdbcType=VARCHAR}, 196 | credits = #{record.credits,jdbcType=TINYINT} 197 | 198 | 199 | 200 | 201 | 202 | update lesson 203 | 204 | 205 | lsnName = #{lsnname,jdbcType=VARCHAR}, 206 | 207 | 208 | dscpt = #{dscpt,jdbcType=VARCHAR}, 209 | 210 | 211 | deptNo = #{deptno,jdbcType=VARCHAR}, 212 | 213 | 214 | credits = #{credits,jdbcType=TINYINT}, 215 | 216 | 217 | where lsnNo = #{lsnno,jdbcType=VARCHAR} 218 | and teaNo = #{teano,jdbcType=VARCHAR} 219 | 220 | 221 | update lesson 222 | set lsnName = #{lsnname,jdbcType=VARCHAR}, 223 | dscpt = #{dscpt,jdbcType=VARCHAR}, 224 | deptNo = #{deptno,jdbcType=VARCHAR}, 225 | credits = #{credits,jdbcType=TINYINT} 226 | where lsnNo = #{lsnno,jdbcType=VARCHAR} 227 | and teaNo = #{teano,jdbcType=VARCHAR} 228 | 229 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/mapper/TopicAnswerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | and ${criterion.condition} 21 | 22 | 23 | and ${criterion.condition} #{criterion.value} 24 | 25 | 26 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 27 | 28 | 29 | and ${criterion.condition} 30 | 31 | #{listItem} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | and ${criterion.condition} 50 | 51 | 52 | and ${criterion.condition} #{criterion.value} 53 | 54 | 55 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 56 | 57 | 58 | and ${criterion.condition} 59 | 60 | #{listItem} 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | ansNo, lsnNo, topicNo, content, acc, moment 72 | 73 | 88 | 94 | 95 | delete from topicAnswer 96 | where ansNo = #{ansno,jdbcType=VARCHAR} 97 | 98 | 99 | delete from topicAnswer 100 | 101 | 102 | 103 | 104 | 105 | insert into topicAnswer (ansNo, lsnNo, topicNo, 106 | content, acc, moment 107 | ) 108 | values (#{ansno,jdbcType=VARCHAR}, #{lsnno,jdbcType=VARCHAR}, #{topicno,jdbcType=VARCHAR}, 109 | #{content,jdbcType=VARCHAR}, #{acc,jdbcType=VARCHAR}, #{moment,jdbcType=TIMESTAMP} 110 | ) 111 | 112 | 113 | insert into topicAnswer 114 | 115 | 116 | ansNo, 117 | 118 | 119 | lsnNo, 120 | 121 | 122 | topicNo, 123 | 124 | 125 | content, 126 | 127 | 128 | acc, 129 | 130 | 131 | moment, 132 | 133 | 134 | 135 | 136 | #{ansno,jdbcType=VARCHAR}, 137 | 138 | 139 | #{lsnno,jdbcType=VARCHAR}, 140 | 141 | 142 | #{topicno,jdbcType=VARCHAR}, 143 | 144 | 145 | #{content,jdbcType=VARCHAR}, 146 | 147 | 148 | #{acc,jdbcType=VARCHAR}, 149 | 150 | 151 | #{moment,jdbcType=TIMESTAMP}, 152 | 153 | 154 | 155 | 161 | 162 | update topicAnswer 163 | 164 | 165 | ansNo = #{record.ansno,jdbcType=VARCHAR}, 166 | 167 | 168 | lsnNo = #{record.lsnno,jdbcType=VARCHAR}, 169 | 170 | 171 | topicNo = #{record.topicno,jdbcType=VARCHAR}, 172 | 173 | 174 | content = #{record.content,jdbcType=VARCHAR}, 175 | 176 | 177 | acc = #{record.acc,jdbcType=VARCHAR}, 178 | 179 | 180 | moment = #{record.moment,jdbcType=TIMESTAMP}, 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | update topicAnswer 189 | set ansNo = #{record.ansno,jdbcType=VARCHAR}, 190 | lsnNo = #{record.lsnno,jdbcType=VARCHAR}, 191 | topicNo = #{record.topicno,jdbcType=VARCHAR}, 192 | content = #{record.content,jdbcType=VARCHAR}, 193 | acc = #{record.acc,jdbcType=VARCHAR}, 194 | moment = #{record.moment,jdbcType=TIMESTAMP} 195 | 196 | 197 | 198 | 199 | 200 | update topicAnswer 201 | 202 | 203 | lsnNo = #{lsnno,jdbcType=VARCHAR}, 204 | 205 | 206 | topicNo = #{topicno,jdbcType=VARCHAR}, 207 | 208 | 209 | content = #{content,jdbcType=VARCHAR}, 210 | 211 | 212 | acc = #{acc,jdbcType=VARCHAR}, 213 | 214 | 215 | moment = #{moment,jdbcType=TIMESTAMP}, 216 | 217 | 218 | where ansNo = #{ansno,jdbcType=VARCHAR} 219 | 220 | 221 | update topicAnswer 222 | set lsnNo = #{lsnno,jdbcType=VARCHAR}, 223 | topicNo = #{topicno,jdbcType=VARCHAR}, 224 | content = #{content,jdbcType=VARCHAR}, 225 | acc = #{acc,jdbcType=VARCHAR}, 226 | moment = #{moment,jdbcType=TIMESTAMP} 227 | where ansNo = #{ansno,jdbcType=VARCHAR} 228 | 229 | -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Account.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class Account { 4 | private String acc; 5 | 6 | private String psd; 7 | 8 | private String acctype; 9 | 10 | public Account(String acc, String psd, String acctype) { 11 | this.acc = acc; 12 | this.psd = psd; 13 | this.acctype = acctype; 14 | } 15 | 16 | public String getAcc() { 17 | return acc; 18 | } 19 | 20 | public void setAcc(String acc) { 21 | this.acc = acc == null ? null : acc.trim(); 22 | } 23 | 24 | public String getPsd() { 25 | return psd; 26 | } 27 | 28 | public void setPsd(String psd) { 29 | this.psd = psd == null ? null : psd.trim(); 30 | } 31 | 32 | public String getAcctype() { 33 | return acctype; 34 | } 35 | 36 | public void setAcctype(String acctype) { 37 | this.acctype = acctype == null ? null : acctype.trim(); 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Department.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class Department { 4 | private String deptno; 5 | 6 | private String deptname; 7 | 8 | public Department(String deptno, String deptname) { 9 | this.deptno = deptno; 10 | this.deptname = deptname; 11 | } 12 | 13 | public String getDeptno() { 14 | return deptno; 15 | } 16 | 17 | public void setDeptno(String deptno) { 18 | this.deptno = deptno == null ? null : deptno.trim(); 19 | } 20 | 21 | public String getDeptname() { 22 | return deptname; 23 | } 24 | 25 | public void setDeptname(String deptname) { 26 | this.deptname = deptname == null ? null : deptname.trim(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Lesson.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class Lesson extends LessonKey { 4 | private String lsnname; 5 | 6 | private String dscpt; 7 | 8 | private String deptno; 9 | 10 | private Byte credits; 11 | 12 | public Lesson(String lsnno, String teanno, String lsnname, String dscpt, String deptno, Byte credits) { 13 | super(lsnno, teanno); 14 | this.lsnname = lsnname; 15 | this.dscpt = dscpt; 16 | this.deptno = deptno; 17 | this.credits = credits; 18 | } 19 | public Lesson(String lsnno, String teanno, String lsnname, String dscpt, String deptno, Integer credits) { 20 | super(lsnno, teanno); 21 | this.lsnname = lsnname; 22 | this.dscpt = dscpt; 23 | this.deptno = deptno; 24 | this.credits = credits.byteValue(); 25 | } 26 | 27 | public Lesson(String whatsthat, String lsnno, String teanno, String lsnname, String dscpt, String deptno, Integer credits) { 28 | super(lsnno, teanno); 29 | System.out.println("Lesson whatsthat="+whatsthat); 30 | this.lsnname = lsnname; 31 | this.dscpt = dscpt; 32 | this.deptno = deptno; 33 | this.credits = credits.byteValue(); 34 | } 35 | 36 | public String getLsnname() { 37 | return lsnname; 38 | } 39 | 40 | public void setLsnname(String lsnname) { 41 | this.lsnname = lsnname == null ? null : lsnname.trim(); 42 | } 43 | 44 | public String getDscpt() { 45 | return dscpt; 46 | } 47 | 48 | public void setDscpt(String dscpt) { 49 | this.dscpt = dscpt == null ? null : dscpt.trim(); 50 | } 51 | 52 | public String getDeptno() { 53 | return deptno; 54 | } 55 | 56 | public void setDeptno(String deptno) { 57 | this.deptno = deptno == null ? null : deptno.trim(); 58 | } 59 | 60 | public Byte getCredits() { 61 | return credits; 62 | } 63 | 64 | public void setCredits(Byte credits) { 65 | this.credits = credits; 66 | } 67 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/LessonKey.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class LessonKey { 4 | private String lsnno; 5 | 6 | private String teano; 7 | 8 | public LessonKey(String lsnno, String teano) { 9 | this.lsnno = lsnno; 10 | this.teano = teano; 11 | } 12 | 13 | public String getLsnno() { 14 | return lsnno; 15 | } 16 | 17 | public void setLsnno(String lsnno) { 18 | this.lsnno = lsnno == null ? null : lsnno.trim(); 19 | } 20 | 21 | public String getTeano() { 22 | return teano; 23 | } 24 | 25 | public void setTeano(String teano) { 26 | this.teano = teano == null ? null : teano.trim(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Student.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class Student { 4 | private String stuno; 5 | 6 | private String stuname; 7 | 8 | private String gender; 9 | 10 | private String deptno; 11 | 12 | private Byte totcredit; 13 | 14 | private String id; 15 | 16 | private String phone; 17 | 18 | public Student(String stuno, String stuname, String gender, String deptno, Byte totcredit, String id, String phone) { 19 | this.stuno = stuno; 20 | this.stuname = stuname; 21 | this.gender = gender; 22 | this.deptno = deptno; 23 | this.totcredit = totcredit; 24 | this.id = id; 25 | this.phone = phone; 26 | } 27 | public Student(String stuno, String stuname, String gender, String deptno, Integer totcredit, String id, String phone) { 28 | this.stuno = stuno; 29 | this.stuname = stuname; 30 | this.gender = gender; 31 | this.deptno = deptno; 32 | this.totcredit = totcredit.byteValue(); 33 | this.id = id; 34 | this.phone = phone; 35 | } 36 | 37 | public String getStuno() { 38 | return stuno; 39 | } 40 | 41 | public void setStuno(String stuno) { 42 | this.stuno = stuno == null ? null : stuno.trim(); 43 | } 44 | 45 | public String getStuname() { 46 | return stuname; 47 | } 48 | 49 | public void setStuname(String stuname) { 50 | this.stuname = stuname == null ? null : stuname.trim(); 51 | } 52 | 53 | public String getGender() { 54 | return gender; 55 | } 56 | 57 | public void setGender(String gender) { 58 | this.gender = gender == null ? null : gender.trim(); 59 | } 60 | 61 | public String getDeptno() { 62 | return deptno; 63 | } 64 | 65 | public void setDeptno(String deptno) { 66 | this.deptno = deptno == null ? null : deptno.trim(); 67 | } 68 | 69 | public Byte getTotcredit() { 70 | return totcredit; 71 | } 72 | 73 | public void setTotcredit(Byte totcredit) { 74 | this.totcredit = totcredit; 75 | } 76 | 77 | public String getId() { 78 | return id; 79 | } 80 | 81 | public void setId(String id) { 82 | this.id = id == null ? null : id.trim(); 83 | } 84 | 85 | public String getPhone() { 86 | return phone; 87 | } 88 | 89 | public void setPhone(String phone) { 90 | this.phone = phone == null ? null : phone.trim(); 91 | } 92 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Teacher.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | public class Teacher { 4 | private String teano; 5 | 6 | private String teaname; 7 | 8 | private String gender; 9 | 10 | private String deptno; 11 | 12 | private String tealevel; 13 | 14 | private String teadscpt; 15 | 16 | private Double salary; 17 | 18 | private String id; 19 | 20 | private String phone; 21 | 22 | public Teacher(String teano, String teaname, String gender, 23 | String deptno, String tealevel, String teadscpt, 24 | Double salary, String id, String phone) { 25 | this.teano = teano; 26 | this.teaname = teaname; 27 | this.gender = gender; 28 | this.deptno = deptno; 29 | this.tealevel = tealevel; 30 | this.teadscpt = teadscpt; 31 | this.salary = salary; 32 | this.id = id; 33 | this.phone = phone; 34 | } 35 | 36 | public String getTeano() { 37 | return teano; 38 | } 39 | 40 | public void setTeano(String teano) { 41 | this.teano = teano == null ? null : teano.trim(); 42 | } 43 | 44 | public String getTeaname() { 45 | return teaname; 46 | } 47 | 48 | public void setTeaname(String teaname) { 49 | this.teaname = teaname == null ? null : teaname.trim(); 50 | } 51 | 52 | public String getGender() { 53 | return gender; 54 | } 55 | 56 | public void setGender(String gender) { 57 | this.gender = gender == null ? null : gender.trim(); 58 | } 59 | 60 | public String getDeptno() { 61 | return deptno; 62 | } 63 | 64 | public void setDeptno(String deptno) { 65 | this.deptno = deptno == null ? null : deptno.trim(); 66 | } 67 | 68 | public String getTealevel() { 69 | return tealevel; 70 | } 71 | 72 | public void setTealevel(String tealevel) { 73 | this.tealevel = tealevel == null ? null : tealevel.trim(); 74 | } 75 | 76 | public String getTeadscpt() { 77 | return teadscpt; 78 | } 79 | 80 | public void setTeadscpt(String teadscpt) { 81 | this.teadscpt = teadscpt == null ? null : teadscpt.trim(); 82 | } 83 | 84 | public Double getSalary() { 85 | return salary; 86 | } 87 | 88 | public void setSalary(Double salary) { 89 | this.salary = salary; 90 | } 91 | 92 | public String getId() { 93 | return id; 94 | } 95 | 96 | public void setId(String id) { 97 | this.id = id == null ? null : id.trim(); 98 | } 99 | 100 | public String getPhone() { 101 | return phone; 102 | } 103 | 104 | public void setPhone(String phone) { 105 | this.phone = phone == null ? null : phone.trim(); 106 | } 107 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/Topic.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Date; 5 | 6 | public class Topic { 7 | private String topicno; 8 | 9 | private String lsnno; 10 | 11 | private String title; 12 | 13 | private String content; 14 | 15 | private String acc; 16 | 17 | private String teano; 18 | 19 | private Integer needans; 20 | 21 | private Date moment; 22 | 23 | public Topic(String topicno, String lsnno, String title, String content, String acc, String teano, Integer needans, Date moment) { 24 | this.topicno = topicno; 25 | this.lsnno = lsnno; 26 | this.title = title; 27 | this.content = content; 28 | this.acc = acc; 29 | this.teano = teano; 30 | this.needans = needans; 31 | this.moment = moment; 32 | } 33 | 34 | public Topic(String topicno, String lsnno, String title, String content, String acc, String teano, Integer needans, Timestamp moment) { 35 | this.topicno = topicno; 36 | this.lsnno = lsnno; 37 | this.title = title; 38 | this.content = content; 39 | this.acc = acc; 40 | this.teano = teano; 41 | this.needans = needans; 42 | this.moment = moment; 43 | } 44 | 45 | public Topic(String whatsthat, String topicno, String lsnno, String title, 46 | String content, String acc, String teano, Integer needans, Timestamp timestamp) { 47 | System.out.println("top 3 whatsthat is " + whatsthat); 48 | this.topicno = topicno; 49 | this.lsnno = lsnno; 50 | this.title = title; 51 | this.content = content; 52 | this.acc = acc; 53 | this.teano = teano; 54 | this.needans = needans; 55 | this.moment = timestamp; 56 | } 57 | public String getTopicno() { 58 | return topicno; 59 | } 60 | 61 | public void setTopicno(String topicno) { 62 | this.topicno = topicno == null ? null : topicno.trim(); 63 | } 64 | 65 | public String getLsnno() { 66 | return lsnno; 67 | } 68 | 69 | public void setLsnno(String lsnno) { 70 | this.lsnno = lsnno == null ? null : lsnno.trim(); 71 | } 72 | 73 | public String getTitle() { 74 | return title; 75 | } 76 | 77 | public void setTitle(String title) { 78 | this.title = title == null ? null : title.trim(); 79 | } 80 | 81 | public String getContent() { 82 | return content; 83 | } 84 | 85 | public void setContent(String content) { 86 | this.content = content == null ? null : content.trim(); 87 | } 88 | 89 | public String getAcc() { 90 | return acc; 91 | } 92 | 93 | public void setAcc(String acc) { 94 | this.acc = acc == null ? null : acc.trim(); 95 | } 96 | 97 | public String getTeano() { 98 | return teano; 99 | } 100 | 101 | public void setTeano(String teano) { 102 | this.teano = teano == null ? null : teano.trim(); 103 | } 104 | 105 | public Integer getNeedans() { 106 | return needans; 107 | } 108 | 109 | public void setNeedans(Integer needans) { 110 | this.needans = needans; 111 | } 112 | 113 | public Date getMoment() { 114 | return moment; 115 | } 116 | 117 | public void setMoment(Date moment) { 118 | this.moment = moment; 119 | } 120 | } -------------------------------------------------------------------------------- /src/main/java/com/friend/py/model/TopicAnswer.java: -------------------------------------------------------------------------------- 1 | package com.friend.py.model; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.Date; 5 | 6 | public class TopicAnswer { 7 | private String ansno; 8 | 9 | private String lsnno; 10 | 11 | private String topicno; 12 | 13 | private String content; 14 | 15 | private String acc; 16 | 17 | private Date moment; 18 | 19 | public TopicAnswer(String ansno, String lsnno, String topicno, String content, String acc, Date moment) { 20 | this.ansno = ansno; 21 | this.lsnno = lsnno; 22 | this.topicno = topicno; 23 | this.content = content; 24 | this.acc = acc; 25 | this.moment = moment; 26 | } 27 | 28 | public TopicAnswer(String ansno, String lsnno, String topicno, String content, String acc, Timestamp moment) { 29 | this.ansno = ansno; 30 | this.lsnno = lsnno; 31 | this.topicno = topicno; 32 | this.content = content; 33 | this.acc = acc; 34 | this.moment = moment; 35 | } 36 | 37 | public TopicAnswer(String whatsthat, String ansno, String lsnno, String topicno, String content, String acc, Timestamp moment) { 38 | this.ansno = ansno; 39 | this.lsnno = lsnno; 40 | this.topicno = topicno; 41 | this.content = content; 42 | this.acc = acc; 43 | this.moment = moment; 44 | } 45 | 46 | public String getAnsno() { 47 | return ansno; 48 | } 49 | 50 | public void setAnsno(String ansno) { 51 | this.ansno = ansno == null ? null : ansno.trim(); 52 | } 53 | 54 | public String getLsnno() { 55 | return lsnno; 56 | } 57 | 58 | public void setLsnno(String lsnno) { 59 | this.lsnno = lsnno == null ? null : lsnno.trim(); 60 | } 61 | 62 | public String getTopicno() { 63 | return topicno; 64 | } 65 | 66 | public void setTopicno(String topicno) { 67 | this.topicno = topicno == null ? null : topicno.trim(); 68 | } 69 | 70 | public String getContent() { 71 | return content; 72 | } 73 | 74 | public void setContent(String content) { 75 | this.content = content == null ? null : content.trim(); 76 | } 77 | 78 | public String getAcc() { 79 | return acc; 80 | } 81 | 82 | public void setAcc(String acc) { 83 | this.acc = acc == null ? null : acc.trim(); 84 | } 85 | 86 | public Date getMoment() { 87 | return moment; 88 | } 89 | 90 | public void setMoment(Date moment) { 91 | this.moment = moment; 92 | } 93 | } -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #jdbc.driver=com.mysql.cj.jdbc.Driver 2 | spring.datasource.url=jdbc:mysql://localhost:3306/final?useUnicode=true&characterEncoding=utf8 3 | spring.datasource.username=root 4 | spring.datasource.password= 5 | # 密码已删去 6 | 7 | #Mybatis配置 8 | mybatis.type-aliases-package=com.friend.py.model 9 | mybatis.mapper-locations=classpath:mapper/*.xml 10 | mybatis.typeAliasesPackage=com.friend.py.model 11 | spring.thymeleaf.prefix=classpath:templates/ 12 | spring.thymeleaf.suffix=.html 13 | ##定义初始连接数 14 | #initialSize=0 15 | ##定义最大连接数 16 | #maxActive=20 17 | ##定义最大空闲 18 | #maxIdle=20 19 | ##定义最小空闲 20 | #minIdle=1 21 | ##定义最长等待时间 22 | #maxWait=60000 23 | #server.port=63342 -------------------------------------------------------------------------------- /src/main/resources/generatorConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 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 | 131 |
132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 |
150 |
-------------------------------------------------------------------------------- /src/main/resources/static/css/board.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: .875rem; 3 | } 4 | 5 | .feather { 6 | width: 16px; 7 | height: 16px; 8 | vertical-align: text-bottom; 9 | } 10 | 11 | /* 12 | * Sidebar 13 | */ 14 | 15 | .sidebar { 16 | position: fixed; 17 | top: 0; 18 | bottom: 0; 19 | left: 0; 20 | z-index: 100; /* Behind the navbar */ 21 | padding: 48px 0 0; /* Height of navbar */ 22 | box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1); 23 | } 24 | 25 | .sidebar-sticky { 26 | position: relative; 27 | top: 0; 28 | height: calc(100vh - 48px); 29 | padding-top: .5rem; 30 | overflow-x: hidden; 31 | overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */ 32 | } 33 | 34 | @supports ((position: -webkit-sticky) or (position: sticky)) { 35 | .sidebar-sticky { 36 | position: -webkit-sticky; 37 | position: sticky; 38 | } 39 | } 40 | 41 | .sidebar .nav-link { 42 | font-weight: 500; 43 | color: #333; 44 | } 45 | 46 | .sidebar .nav-link .feather { 47 | margin-right: 4px; 48 | color: #999; 49 | } 50 | 51 | .sidebar .nav-link.active { 52 | color: #007bff; 53 | } 54 | 55 | .sidebar .nav-link:hover .feather, 56 | .sidebar .nav-link.active .feather { 57 | color: inherit; 58 | } 59 | 60 | .sidebar-heading { 61 | font-size: .75rem; 62 | text-transform: uppercase; 63 | } 64 | 65 | /* 66 | * Content 67 | */ 68 | 69 | [role="main"] { 70 | padding-top: 133px; /* Space for fixed navbar */ 71 | } 72 | 73 | @media (min-width: 768px) { 74 | [role="main"] { 75 | padding-top: 48px; /* Space for fixed navbar */ 76 | } 77 | } 78 | 79 | /* 80 | * Navbar 81 | */ 82 | 83 | .navbar-brand { 84 | padding-top: .75rem; 85 | padding-bottom: .75rem; 86 | font-size: 1rem; 87 | background-color: rgba(0, 0, 0, .25); 88 | box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); 89 | } 90 | 91 | .navbar .form-control { 92 | padding: .75rem 1rem; 93 | border-width: 0; 94 | border-radius: 0; 95 | } 96 | 97 | .form-control-dark { 98 | color: #fff; 99 | background-color: rgba(255, 255, 255, .1); 100 | border-color: rgba(255, 255, 255, .1); 101 | } 102 | 103 | .form-control-dark:focus { 104 | border-color: transparent; 105 | box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); 106 | } 107 | -------------------------------------------------------------------------------- /src/main/resources/static/css/floating-labels.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: -ms-flexbox; 8 | display: flex; 9 | -ms-flex-align: center; 10 | align-items: center; 11 | padding-top: 40px; 12 | padding-bottom: 40px; 13 | background-color: #f5f5f5; 14 | } 15 | 16 | .form-signin { 17 | width: 100%; 18 | max-width: 420px; 19 | padding: 15px; 20 | margin: auto; 21 | } 22 | 23 | .form-label-group { 24 | position: relative; 25 | margin-bottom: 1rem; 26 | } 27 | 28 | .form-label-group > input, 29 | .form-label-group > label { 30 | height: 3.125rem; 31 | padding: .75rem; 32 | } 33 | 34 | .form-label-group > label { 35 | position: absolute; 36 | top: 0; 37 | left: 0; 38 | display: block; 39 | width: 100%; 40 | margin-bottom: 0; /* Override default `