├── README.md
├── images
└── data
│ └── springboot-penguin
│ └── upload
│ └── images
│ ├── 6ab08a65-c969-4d6a-84dd-f0233d574459.png
│ ├── acm.png
│ ├── blackboard.png
│ ├── chaxun.png
│ ├── headimg_placeholder.png
│ ├── kaowu.png
│ ├── lixiao.png
│ ├── problemset_ai.png
│ ├── problemset_algorithm.jpg
│ ├── problemset_bigdata.jpg
│ ├── problemset_c++.jpg
│ ├── problemset_c.jpg
│ ├── problemset_computer.jpg
│ ├── problemset_database.jpg
│ ├── problemset_datastructures.jpg
│ ├── problemset_default.jpg
│ ├── problemset_digitalcircuits.jpg
│ ├── problemset_graphic.jpg
│ ├── problemset_internetofthings.jpg
│ ├── problemset_java.jpg
│ ├── problemset_networld.jpg
│ ├── problemset_os.jpg
│ ├── problemset_python.jpg
│ ├── problemset_softwareTest.jpg
│ ├── sushe.png
│ ├── sutuo.png
│ ├── tushuguan.png
│ ├── xinximenhu.png
│ ├── xuefei.png
│ └── xuegong.png
├── mvnw
├── mvnw.cmd
├── pom.xml
├── preview
└── 在线考试系统答辩PPT.pptx
├── sql
└── db_qexz_penguin.sql
└── src
├── main
├── java
│ └── com
│ │ └── qexz
│ │ ├── Application.java
│ │ ├── ServletInitializer.java
│ │ ├── common
│ │ └── QexzConst.java
│ │ ├── config
│ │ ├── DruidConfig.java
│ │ ├── QexzWebMvcConfigurerAdapter.java
│ │ ├── RedisConfig.java
│ │ └── SessionConfig.java
│ │ ├── controller
│ │ ├── AccountController.java
│ │ ├── CommentController.java
│ │ ├── ContestController.java
│ │ ├── DefaultController.java
│ │ ├── GradeController.java
│ │ ├── ManageController.java
│ │ ├── PostController.java
│ │ ├── QuestionController.java
│ │ ├── ReplyController.java
│ │ └── SubjectController.java
│ │ ├── dao
│ │ ├── AccountMapper.java
│ │ ├── CommentMapper.java
│ │ ├── ContestMapper.java
│ │ ├── GradeMapper.java
│ │ ├── PostMapper.java
│ │ ├── QuestionMapper.java
│ │ ├── ReplyMapper.java
│ │ └── SubjectMapper.java
│ │ ├── dto
│ │ └── AjaxResult.java
│ │ ├── exception
│ │ ├── QexzWebError.java
│ │ └── QexzWebException.java
│ │ ├── model
│ │ ├── Account.java
│ │ ├── Comment.java
│ │ ├── Contest.java
│ │ ├── Grade.java
│ │ ├── Post.java
│ │ ├── Question.java
│ │ ├── Reply.java
│ │ └── Subject.java
│ │ ├── service
│ │ ├── AccountService.java
│ │ ├── CommentService.java
│ │ ├── ContestService.java
│ │ ├── GradeService.java
│ │ ├── PostService.java
│ │ ├── QuestionService.java
│ │ ├── ReplyService.java
│ │ ├── SubjectService.java
│ │ └── impl
│ │ │ ├── AccountServiceImpl.java
│ │ │ ├── CommentServiceImpl.java
│ │ │ ├── ContestServiceImpl.java
│ │ │ ├── GradeServiceImpl.java
│ │ │ ├── PostServiceImpl.java
│ │ │ ├── QuestionServiceImpl.java
│ │ │ ├── ReplyServiceImpl.java
│ │ │ └── SubjectServiceImpl.java
│ │ └── util
│ │ └── MD5.java
└── resources
│ ├── application-dev.properties
│ ├── application-prod.properties
│ ├── application.properties
│ ├── mapper
│ ├── AccountMapper.xml
│ ├── CommentMapper.xml
│ ├── ContestMapper.xml
│ ├── GradeMapper.xml
│ ├── PostMapper.xml
│ ├── QuestionMapper.xml
│ ├── ReplyMapper.xml
│ └── SubjectMapper.xml
│ ├── static
│ ├── css
│ │ ├── app.css
│ │ ├── base.css
│ │ ├── bootstrap-datetimepicker
│ │ │ └── bootstrap-datetimepicker.min.css
│ │ ├── contest
│ │ │ ├── detail.css
│ │ │ └── index.css
│ │ ├── discuss
│ │ │ ├── discuss.css
│ │ │ ├── discussDetail.css
│ │ │ └── postDiscuss.css
│ │ ├── home.css
│ │ ├── manage
│ │ │ ├── manage-app.css
│ │ │ ├── manage-editContestProblem.css
│ │ │ └── manage-login.css
│ │ ├── problem
│ │ │ ├── problemdetail.css
│ │ │ ├── problemlist.css
│ │ │ └── problemset.css
│ │ ├── style.css
│ │ └── user
│ │ │ ├── myDiscussPost.css
│ │ │ ├── myExam.css
│ │ │ ├── password.css
│ │ │ └── profile.css
│ ├── img
│ │ ├── 404.jpg
│ │ ├── bg.jpg
│ │ ├── logo.png
│ │ ├── logo_flat.png
│ │ ├── manage-logo.png
│ │ └── tfans.jpg
│ └── js
│ │ ├── adminApp.js
│ │ ├── app.js
│ │ ├── bootstrap-datetimepicker
│ │ ├── bootstrap-datetimepicker.min.js
│ │ └── locales
│ │ │ └── bootstrap-datetimepicker.zh-CN.js
│ │ ├── contest
│ │ ├── detail.js
│ │ └── index.js
│ │ ├── discuss
│ │ ├── discuss.js
│ │ ├── discussDetail.js
│ │ └── postDiscuss.js
│ │ ├── home.js
│ │ ├── manage
│ │ ├── manage-accountList.js
│ │ ├── manage-app.js
│ │ ├── manage-commentBoard.js
│ │ ├── manage-contestBoard.js
│ │ ├── manage-editContestProblem.js
│ │ ├── manage-login.js
│ │ ├── manage-postBoard.js
│ │ ├── manage-questionBoard.js
│ │ ├── manage-resultContestBoard.js
│ │ ├── manage-resultStudentBoard.js
│ │ └── manage-subjectBoard.js
│ │ ├── problem
│ │ ├── problemdetail.js
│ │ ├── problemlist.js
│ │ └── problemset.js
│ │ └── user
│ │ ├── myDiscussPost.js
│ │ ├── myExam.js
│ │ ├── password.js
│ │ └── profile.js
│ └── templates
│ ├── bootstrap-datetimepicker-test.html
│ ├── contest
│ ├── detail.html
│ └── index.html
│ ├── discuss
│ ├── discuss.html
│ ├── discussDetail.html
│ └── postDiscuss.html
│ ├── error
│ └── 404.html
│ ├── home.html
│ ├── login.html
│ ├── manage
│ ├── manage-accountList.html
│ ├── manage-commentBoard.html
│ ├── manage-contestBoard.html
│ ├── manage-editContestProblem.html
│ ├── manage-login.html
│ ├── manage-postBoard.html
│ ├── manage-questionBoard.html
│ ├── manage-resultContestBoard.html
│ ├── manage-resultStudentBoard.html
│ └── manage-subjectBoard.html
│ ├── problem
│ ├── problemdetail.html
│ ├── problemlist.html
│ └── problemset.html
│ └── user
│ ├── myDiscussPost.html
│ ├── myExam.html
│ ├── password.html
│ └── profile.html
└── test
└── java
└── com
└── qexz
├── ApplicationTests.java
└── service
├── AccountServiceTest.java
├── ContestServiceTest.java
└── SubjectServiceTest.java
/README.md:
--------------------------------------------------------------------------------
1 | # 在线考试系统(低仿牛客网)
2 |
3 | ## 系统概要
4 | 在线考试系统旨在为学生提供一个在线考试的平台,在这里,学生不仅可以网上在线考试,而且可以浏览题库中心下的各个课程的题库,也可以在讨论区下发表自己的想法,当然也在帖子下留言评论.
5 |
6 | ## 功能实现
7 | #### 1. 在线考试模块
8 | - [x] 考试倒计时、考试安排表
9 | - [x] 答题卡、作答区
10 | - [ ] 批改完试卷后查看成绩情况以及参考答案
11 |
12 | #### 2. 题库系统模块
13 | - [x] 课程分类
14 | - [x] 题目列表、题目难度
15 | - [x] 题目描述、参考答案等
16 | - [ ] 题目标签
17 | - [ ] 在线编程(Online Judge)
18 |
19 | #### 3. 论坛系统模块
20 | - [x] 发布帖子、回帖、评论
21 | - [x] 浏览帖子
22 | - [x] 传送门窗口
23 | - [ ] 点赞、浏览统计
24 | - [ ] 帖子分类
25 | - [ ] 帖子编辑、删除
26 |
27 | #### 4. 个人中心模块
28 | - [x] 更新个人信息、上传头像等
29 | - [x] 考试记录
30 | - [x] 发帖记录
31 | - [ ] 考试统计分析
32 |
33 | #### 5. 后台管理模块
34 | - [x] 用户管理
35 | - [x] 考试管理
36 | - [x] 题目管理
37 | - [x] 课程管理
38 | - [x] 成绩管理
39 | - [x] 帖子管理
40 | - [x] 评论管理
41 |
42 | ## 技术选型
43 | ### 后台技术选型
44 | * SpringBoot(Spring、SpringMVC)
45 | * MyBatis
46 | * Thymeleaf
47 |
48 | ### 前端技术选型
49 | * Semantic UI
50 | * Bootstrap
51 | * jQuery
52 |
53 | ### 开发环境
54 | * 操作系统:Windows 10
55 | * 编程语言: Java 8
56 | * 开发工具: IDEA、Navicat、Git
57 | * 项目构建: Maven 3.3.9
58 | * 服务器:Tomcat 8.5
59 | * 数据库: MySQL、Redis
60 | * 代码托管平台: GitHub
61 |
62 | ### 部署环境
63 | * 操作系统: CentOS 7.4
64 | * 编程语言: Java 8
65 | * 服务器: Tomcat 8.5、Nginx 1.12.2
66 | * 数据库: MySQL、Redis
67 |
68 | ## 预览效果
69 | 
70 |
71 | 
72 |
73 | 
74 |
75 | 
76 |
77 | 
78 |
79 | 
80 |
81 | ## 讨论
82 | 有问题请在[issue](https://github.com/gdufeZLYL/springboot-penguin/issues)讨论
83 |
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/6ab08a65-c969-4d6a-84dd-f0233d574459.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/6ab08a65-c969-4d6a-84dd-f0233d574459.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/acm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/acm.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/blackboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/blackboard.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/chaxun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/chaxun.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/headimg_placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/headimg_placeholder.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/kaowu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/kaowu.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/lixiao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/lixiao.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_ai.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_ai.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_algorithm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_algorithm.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_bigdata.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_bigdata.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_c++.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_c++.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_c.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_c.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_computer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_computer.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_database.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_database.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_datastructures.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_datastructures.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_default.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_default.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_digitalcircuits.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_digitalcircuits.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_graphic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_graphic.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_internetofthings.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_internetofthings.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_java.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_java.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_networld.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_networld.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_os.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_os.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_python.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_python.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/problemset_softwareTest.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/problemset_softwareTest.jpg
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/sushe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/sushe.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/sutuo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/sutuo.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/tushuguan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/tushuguan.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/xinximenhu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/xinximenhu.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/xuefei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/xuefei.png
--------------------------------------------------------------------------------
/images/data/springboot-penguin/upload/images/xuegong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/images/data/springboot-penguin/upload/images/xuegong.png
--------------------------------------------------------------------------------
/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 enable echoing my setting MAVEN_BATCH_ECHO to 'on'
39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
40 |
41 | @REM set %HOME% to equivalent of $HOME
42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
43 |
44 | @REM Execute a user defined script before this one
45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
49 | :skipRcPre
50 |
51 | @setlocal
52 |
53 | set ERROR_CODE=0
54 |
55 | @REM To isolate internal variables from possible post scripts, we use another setlocal
56 | @setlocal
57 |
58 | @REM ==== START VALIDATION ====
59 | if not "%JAVA_HOME%" == "" goto OkJHome
60 |
61 | echo.
62 | echo Error: JAVA_HOME not found in your environment. >&2
63 | echo Please set the JAVA_HOME variable in your environment to match the >&2
64 | echo location of your Java installation. >&2
65 | echo.
66 | goto error
67 |
68 | :OkJHome
69 | if exist "%JAVA_HOME%\bin\java.exe" goto init
70 |
71 | echo.
72 | echo Error: JAVA_HOME is set to an invalid directory. >&2
73 | echo JAVA_HOME = "%JAVA_HOME%" >&2
74 | echo Please set the JAVA_HOME variable in your environment to match the >&2
75 | echo location of your Java installation. >&2
76 | echo.
77 | goto error
78 |
79 | @REM ==== END VALIDATION ====
80 |
81 | :init
82 |
83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
84 | @REM Fallback to current working directory if not found.
85 |
86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
88 |
89 | set EXEC_DIR=%CD%
90 | set WDIR=%EXEC_DIR%
91 | :findBaseDir
92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
93 | cd ..
94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
95 | set WDIR=%CD%
96 | goto findBaseDir
97 |
98 | :baseDirFound
99 | set MAVEN_PROJECTBASEDIR=%WDIR%
100 | cd "%EXEC_DIR%"
101 | goto endDetectBaseDir
102 |
103 | :baseDirNotFound
104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
105 | cd "%EXEC_DIR%"
106 |
107 | :endDetectBaseDir
108 |
109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
110 |
111 | @setlocal EnableExtensions EnableDelayedExpansion
112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
114 |
115 | :endReadAdditionalConfig
116 |
117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
118 |
119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121 |
122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
123 | if ERRORLEVEL 1 goto error
124 | goto end
125 |
126 | :error
127 | set ERROR_CODE=1
128 |
129 | :end
130 | @endlocal & set ERROR_CODE=%ERROR_CODE%
131 |
132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
136 | :skipRcPost
137 |
138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
140 |
141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
142 |
143 | exit /B %ERROR_CODE%
144 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.qexz
7 | springboot-penguin
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 |
12 | springboot-penguin
13 | Demo project for Spring Boot
14 |
15 |
16 | org.springframework.boot
17 | spring-boot-starter-parent
18 | 1.5.9.RELEASE
19 |
20 |
21 |
22 |
23 | UTF-8
24 | UTF-8
25 | 1.8
26 |
27 |
28 |
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-starter-web
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-tomcat
37 |
38 |
39 |
40 |
41 |
42 | org.mybatis.spring.boot
43 | mybatis-spring-boot-starter
44 | 1.3.0
45 |
46 |
47 | mysql
48 | mysql-connector-java
49 |
50 |
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-starter-data-redis
55 |
56 |
57 |
58 |
59 | org.springframework.boot
60 | spring-boot-starter-thymeleaf
61 |
62 |
63 |
64 |
65 | com.alibaba
66 | druid
67 |
68 | 1.0.19
69 |
70 |
71 |
72 |
73 | com.github.ben-manes.caffeine
74 | caffeine
75 |
76 |
77 |
78 |
79 | org.apache.commons
80 | commons-lang3
81 | 3.4
82 |
83 |
84 |
85 |
86 | org.springframework.boot
87 | spring-boot-starter-aop
88 |
89 |
90 |
91 |
92 |
93 | commons-collections
94 | commons-collections
95 |
96 |
97 |
98 |
99 | commons-io
100 | commons-io
101 | 2.4
102 |
103 |
104 | commons-fileupload
105 | commons-fileupload
106 | 1.3.3
107 |
108 |
109 |
110 |
111 | net.sf.json-lib
112 | json-lib
113 | 2.4
114 | jdk15
115 |
116 |
117 | commons-beanutils
118 | commons-beanutils
119 | 1.9.3
120 |
121 |
122 | commons-lang
123 | commons-lang
124 | 2.6
125 |
126 |
127 | commons-logging
128 | commons-logging
129 | 1.1.1
130 |
131 |
132 | net.sf.ezmorph
133 | ezmorph
134 | 1.0.6
135 |
136 |
137 |
138 |
139 | com.github.pagehelper
140 | pagehelper-spring-boot-starter
141 | 1.2.3
142 |
143 |
144 |
145 |
146 | org.apache.poi
147 | poi
148 | 3.17
149 |
150 |
151 |
152 |
153 | org.springframework.session
154 | spring-session-data-redis
155 |
156 |
157 |
158 | org.springframework.boot
159 | spring-boot-starter-test
160 | test
161 |
162 |
163 |
164 |
165 |
166 |
167 | org.springframework.boot
168 | spring-boot-maven-plugin
169 |
170 |
171 | OnlineExam
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/preview/在线考试系统答辩PPT.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/preview/在线考试系统答辩PPT.pptx
--------------------------------------------------------------------------------
/src/main/java/com/qexz/Application.java:
--------------------------------------------------------------------------------
1 | package com.qexz;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
6 | import org.springframework.boot.web.servlet.ErrorPage;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.core.convert.converter.Converter;
9 | import org.springframework.http.HttpStatus;
10 |
11 | import java.util.Date;
12 |
13 | @SpringBootApplication
14 | public class Application {
15 |
16 | public static void main(String[] args) {
17 | SpringApplication.run(Application.class, args);
18 | }
19 |
20 | @Bean
21 | public Converter addNewConvert() {
22 | return new Converter() {
23 | @Override
24 | public Date convert(Long source) {
25 | Date date = null;
26 | try {
27 | date = new Date(source);
28 | } catch (Exception e) {
29 | e.printStackTrace();
30 | }
31 | return date;
32 | }
33 | };
34 | }
35 |
36 | @Bean
37 | public EmbeddedServletContainerCustomizer containerCustomizer() {
38 |
39 | return (container -> {
40 | //ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
41 | ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
42 | //ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
43 |
44 | //container.addErrorPages(error401Page, error404Page, error500Page);
45 | container.addErrorPages(error404Page);
46 | });
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/ServletInitializer.java:
--------------------------------------------------------------------------------
1 | package com.qexz;
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | import org.springframework.boot.web.support.SpringBootServletInitializer;
5 |
6 | public class ServletInitializer extends SpringBootServletInitializer {
7 | @Override
8 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
9 | return application.sources(Application.class);
10 | }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/common/QexzConst.java:
--------------------------------------------------------------------------------
1 | package com.qexz.common;
2 |
3 | public class QexzConst {
4 |
5 | // Session
6 | public final static String CURRENT_ACCOUNT = "current_account";
7 |
8 | //本地服务器-文件,图片所在位置,图片上传位置
9 | // public static final String UPLOAD_FILE_PATH = "file:D:/IdeaProjects/data/springboot-penguin/upload/";
10 | // public static final String UPLOAD_FILE_IMAGE_PATH = "D:/IdeaProjects/data/springboot-penguin/upload/images/";
11 |
12 | //云服务器-文件,图片所在位置,图片上传位置
13 | public static final String UPLOAD_FILE_PATH = "file:/usr/java/data/springboot-penguin/upload/";
14 | public static final String UPLOAD_FILE_IMAGE_PATH = "/usr/java/data/springboot-penguin/upload/images/";
15 |
16 | //默认头像url
17 | public static final String DEFAULT_AVATAR_IMG_URL = "headimg_placeholder.png";
18 | //课程默认图片
19 | public static final String DEFAULT_SUBJECT_IMG_URL = "problemset_default.jpg";
20 |
21 | public static final int subjectPageSize = 16;
22 | public static final int contestPageSize = 10;
23 | public static final int questionPageSize = 10;
24 | public static final int accountPageSize = 16;
25 | public static final int postPageSize = 8;
26 | public static final int gradePageSize = 12;
27 | public static final int commentPageSize = 16;
28 |
29 | //MD5加盐
30 | public static final String MD5_SALT = "qexz";
31 | //分页数据
32 | public final static String DATA = "data";
33 |
34 | public final static String SPLIT_CHAR = "_~_";
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/config/QexzWebMvcConfigurerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.qexz.config;
2 |
3 | import com.qexz.common.QexzConst;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
7 |
8 | @Configuration
9 | public class QexzWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
10 |
11 |
12 | /**
13 | * 配置静态访问资源
14 | * @param registry
15 | */
16 | @Override
17 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
18 | //自定义项目内目录
19 | //registry.addResourceHandler("/my/**").addResourceLocations("classpath:/my/");
20 | //指向外部目录
21 | registry.addResourceHandler("/upload/**").addResourceLocations(QexzConst.UPLOAD_FILE_PATH);
22 | super.addResourceHandlers(registry);
23 | }
24 | }
--------------------------------------------------------------------------------
/src/main/java/com/qexz/config/RedisConfig.java:
--------------------------------------------------------------------------------
1 | package com.qexz.config;
2 |
3 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
4 | import com.fasterxml.jackson.annotation.PropertyAccessor;
5 | import com.fasterxml.jackson.databind.ObjectMapper;
6 | import org.springframework.cache.CacheManager;
7 | import org.springframework.cache.annotation.CachingConfigurerSupport;
8 | import org.springframework.cache.annotation.EnableCaching;
9 | import org.springframework.cache.interceptor.KeyGenerator;
10 | import org.springframework.context.annotation.Bean;
11 | import org.springframework.context.annotation.Configuration;
12 | import org.springframework.data.redis.cache.RedisCacheManager;
13 | import org.springframework.data.redis.connection.RedisConnectionFactory;
14 | import org.springframework.data.redis.core.RedisTemplate;
15 | import org.springframework.data.redis.core.StringRedisTemplate;
16 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
17 |
18 | import java.lang.reflect.Method;
19 |
20 | @Configuration
21 | @EnableCaching
22 | public class RedisConfig extends CachingConfigurerSupport {
23 |
24 | @Bean
25 | public KeyGenerator keyGenerator() {
26 | return new KeyGenerator() {
27 | @Override
28 | public Object generate(Object target, Method method, Object... params) {
29 | StringBuilder sb = new StringBuilder();
30 | sb.append(target.getClass().getName());
31 | sb.append(method.getName());
32 | for (Object obj : params) {
33 | sb.append(obj.toString());
34 | }
35 | return sb.toString();
36 | }
37 | };
38 | }
39 |
40 | @SuppressWarnings("rawtypes")
41 | @Bean
42 | public CacheManager cacheManager(RedisTemplate redisTemplate) {
43 | RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
44 | //设置缓存过期时间
45 | //rcm.setDefaultExpiration(60);//秒
46 | return rcm;
47 | }
48 |
49 | @Bean
50 | public RedisTemplate redisTemplate(RedisConnectionFactory factory) {
51 | StringRedisTemplate template = new StringRedisTemplate(factory);
52 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
53 | ObjectMapper om = new ObjectMapper();
54 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
55 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
56 | jackson2JsonRedisSerializer.setObjectMapper(om);
57 | template.setValueSerializer(jackson2JsonRedisSerializer);
58 | template.afterPropertiesSet();
59 | return template;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/config/SessionConfig.java:
--------------------------------------------------------------------------------
1 | package com.qexz.config;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
5 |
6 | /**
7 | * 分布式session一致性,redis,7天
8 | */
9 | @Configuration
10 | @EnableRedisHttpSession(maxInactiveIntervalInSeconds = 86400*7)
11 | public class SessionConfig {
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/CommentController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.dto.AjaxResult;
4 | import com.qexz.model.Comment;
5 | import com.qexz.service.CommentService;
6 | import com.qexz.service.PostService;
7 | import org.apache.commons.logging.Log;
8 | import org.apache.commons.logging.LogFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | @RestController
13 | @RequestMapping(value = "/comment")
14 | public class CommentController {
15 |
16 | private static Log LOG = LogFactory.getLog(CommentController.class);
17 |
18 | @Autowired
19 | private CommentService commentService;
20 | @Autowired
21 | private PostService postService;
22 |
23 | //添加评论
24 | @RequestMapping(value="/api/addComment", method= RequestMethod.POST)
25 | @ResponseBody
26 | public AjaxResult addComment(@RequestBody Comment comment) {
27 | AjaxResult ajaxResult = new AjaxResult();
28 | postService.updateReplyNumById(comment.getPostId());
29 | int commentId = commentService.addComment(comment);
30 | return new AjaxResult().setData(commentId);
31 | }
32 |
33 | //删除评论
34 | @DeleteMapping("/api/deleteComment/{id}")
35 | public AjaxResult deleteComment(@PathVariable int id) {
36 | AjaxResult ajaxResult = new AjaxResult();
37 | boolean result = commentService.deleteCommentById(id);
38 | return new AjaxResult().setData(result);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/ContestController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.dto.AjaxResult;
4 | import com.qexz.model.Contest;
5 | import com.qexz.service.ContestService;
6 | import com.qexz.service.QuestionService;
7 | import org.apache.commons.logging.Log;
8 | import org.apache.commons.logging.LogFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Controller;
11 | import org.springframework.web.bind.annotation.*;
12 |
13 | @RestController
14 | @RequestMapping(value = "/contest")
15 | public class ContestController {
16 |
17 | private static Log LOG = LogFactory.getLog(ContestController.class);
18 |
19 | @Autowired
20 | private ContestService contestService;
21 | @Autowired
22 | private QuestionService questionService;
23 |
24 | //添加考试
25 | @RequestMapping(value="/api/addContest", method= RequestMethod.POST)
26 | @ResponseBody
27 | public AjaxResult addContest(@RequestBody Contest contest) {
28 | AjaxResult ajaxResult = new AjaxResult();
29 | int contestId = contestService.addContest(contest);
30 | return new AjaxResult().setData(contestId);
31 | }
32 |
33 | //更新考试信息
34 | @RequestMapping(value="/api/updateContest", method= RequestMethod.POST)
35 | @ResponseBody
36 | public AjaxResult updateContest(@RequestBody Contest contest) {
37 | AjaxResult ajaxResult = new AjaxResult();
38 | boolean result = contestService.updateContest(contest);
39 | return new AjaxResult().setData(result);
40 | }
41 |
42 | //删除考试信息
43 | @DeleteMapping("/api/deleteContest/{id}")
44 | public AjaxResult deleteContest(@PathVariable int id) {
45 | AjaxResult ajaxResult = new AjaxResult();
46 | boolean result = contestService.deleteContest(id);
47 | return new AjaxResult().setData(result);
48 | }
49 |
50 | //完成考试批改
51 | @RequestMapping(value="/api/finishContest/{id}", method= RequestMethod.POST)
52 | @ResponseBody
53 | public AjaxResult finishContest(@PathVariable int id) {
54 | AjaxResult ajaxResult = new AjaxResult();
55 | Contest contest = contestService.getContestById(id);
56 | contest.setState(3);
57 | questionService.updateQuestionsStateByContestId(id, 1);
58 | boolean result = contestService.updateContest(contest);
59 | return new AjaxResult().setData(result);
60 | }
61 |
62 |
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/GradeController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.common.QexzConst;
4 | import com.qexz.dto.AjaxResult;
5 | import com.qexz.model.Account;
6 | import com.qexz.model.Grade;
7 | import com.qexz.model.Question;
8 | import com.qexz.service.GradeService;
9 | import com.qexz.service.QuestionService;
10 | import net.sf.json.JSONObject;
11 | import org.apache.commons.logging.Log;
12 | import org.apache.commons.logging.LogFactory;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.stereotype.Controller;
15 | import org.springframework.web.bind.annotation.RequestBody;
16 | import org.springframework.web.bind.annotation.RequestMapping;
17 | import org.springframework.web.bind.annotation.RequestMethod;
18 | import org.springframework.web.bind.annotation.ResponseBody;
19 |
20 | import javax.servlet.http.HttpServletRequest;
21 | import java.util.Arrays;
22 | import java.util.Date;
23 | import java.util.List;
24 |
25 | @Controller
26 | @RequestMapping(value = "/grade")
27 | public class GradeController {
28 |
29 | private static Log LOG = LogFactory.getLog(GradeController.class);
30 |
31 | @Autowired
32 | private GradeService gradeService;
33 | @Autowired
34 | private QuestionService questionService;
35 |
36 | //提交试卷
37 | @RequestMapping(value="/api/submitContest", method= RequestMethod.POST)
38 | @ResponseBody
39 | public AjaxResult submitContest(HttpServletRequest request, @RequestBody Grade grade) {
40 | AjaxResult ajaxResult = new AjaxResult();
41 | Account currentAccount = (Account) request.getSession().getAttribute(QexzConst.CURRENT_ACCOUNT);
42 | List answerStrs = Arrays.asList(grade.getAnswerJson().split(QexzConst.SPLIT_CHAR));
43 | int autoResult = 0;
44 | List questions = questionService.getQuestionsByContestId(grade.getContestId());
45 |
46 | for (int i = 0; i < questions.size(); i++) {
47 | Question question = questions.get(i);
48 | if (question.getQuestionType() <= 1 && question.getAnswer()
49 | .equals(answerStrs.get(i))) {
50 | autoResult += question.getScore();
51 | }
52 | }
53 | grade.setStudentId(currentAccount.getId());
54 | grade.setResult(autoResult);
55 | grade.setAutoResult(autoResult);
56 | grade.setManulResult(0);
57 | int gradeId = gradeService.addGrade(grade);
58 | return new AjaxResult().setData(gradeId);
59 | }
60 |
61 | //完成批改试卷
62 | @RequestMapping(value="/api/finishGrade", method= RequestMethod.POST)
63 | @ResponseBody
64 | public AjaxResult finishGrade(@RequestBody Grade grade) {
65 | AjaxResult ajaxResult = new AjaxResult();
66 | grade.setResult(grade.getAutoResult()+grade.getManulResult());
67 | grade.setFinishTime(new Date());
68 | grade.setState(1);
69 | boolean result = gradeService.updateGrade(grade);
70 | return new AjaxResult().setData(result);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/PostController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.dto.AjaxResult;
4 | import com.qexz.model.Post;
5 | import com.qexz.service.PostService;
6 | import org.apache.commons.logging.Log;
7 | import org.apache.commons.logging.LogFactory;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | @RestController
12 | @RequestMapping(value = "/post")
13 | public class PostController {
14 |
15 | private static Log LOG = LogFactory.getLog(PostController.class);
16 |
17 | @Autowired
18 | private PostService postService;
19 |
20 | //添加帖子
21 | @RequestMapping(value="/api/addPost", method= RequestMethod.POST)
22 | @ResponseBody
23 | public AjaxResult addPost(@RequestBody Post post) {
24 | AjaxResult ajaxResult = new AjaxResult();
25 | int postId = postService.addPost(post);
26 | return new AjaxResult().setData(postId);
27 | }
28 |
29 | //更新帖子
30 | @RequestMapping(value="/api/updatePost", method= RequestMethod.POST)
31 | @ResponseBody
32 | public AjaxResult updatePost(@RequestBody Post post) {
33 | AjaxResult ajaxResult = new AjaxResult();
34 | boolean result = postService.updatePostById(post);
35 | return new AjaxResult().setData(result);
36 | }
37 |
38 | //删除帖子
39 | @DeleteMapping("/api/deletePost/{id}")
40 | public AjaxResult deletePost(@PathVariable int id) {
41 | AjaxResult ajaxResult = new AjaxResult();
42 | boolean result = postService.deletePostById(id);
43 | return new AjaxResult().setData(result);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/QuestionController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.dto.AjaxResult;
4 | import com.qexz.model.Contest;
5 | import com.qexz.model.Question;
6 | import com.qexz.service.QuestionService;
7 | import org.apache.commons.logging.Log;
8 | import org.apache.commons.logging.LogFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | @RestController
13 | @RequestMapping(value = "/question")
14 | public class QuestionController {
15 |
16 | private static Log LOG = LogFactory.getLog(QuestionController.class);
17 |
18 | @Autowired
19 | private QuestionService questionService;
20 |
21 | //添加题目
22 | @RequestMapping(value="/api/addQuestion", method= RequestMethod.POST)
23 | @ResponseBody
24 | public AjaxResult addQuestion(@RequestBody Question question) {
25 | AjaxResult ajaxResult = new AjaxResult();
26 | int questionId = questionService.addQuestion(question);
27 | return new AjaxResult().setData(questionId);
28 | }
29 |
30 | //更新题目信息
31 | @RequestMapping(value="/api/updateQuestion", method= RequestMethod.POST)
32 | @ResponseBody
33 | public AjaxResult updateQuestion(@RequestBody Question question) {
34 | AjaxResult ajaxResult = new AjaxResult();
35 | boolean result = questionService.updateQuestion(question);
36 | return new AjaxResult().setData(result);
37 | }
38 |
39 | //删除题目信息
40 | @DeleteMapping("/api/deleteQuestion/{id}")
41 | public AjaxResult deleteContest(@PathVariable int id) {
42 | AjaxResult ajaxResult = new AjaxResult();
43 | boolean result = questionService.deleteQuestion(id);
44 | return new AjaxResult().setData(result);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/ReplyController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.dto.AjaxResult;
4 | import com.qexz.model.Reply;
5 | import com.qexz.service.ReplyService;
6 | import org.apache.commons.logging.Log;
7 | import org.apache.commons.logging.LogFactory;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | @RestController
12 | @RequestMapping(value = "/reply")
13 | public class ReplyController {
14 |
15 | private static Log LOG = LogFactory.getLog(ReplyController.class);
16 |
17 | @Autowired
18 | private ReplyService replyService;
19 |
20 | //添加回复
21 | @RequestMapping(value="/api/addReply", method= RequestMethod.POST)
22 | @ResponseBody
23 | public AjaxResult addReply(@RequestBody Reply reply) {
24 | AjaxResult ajaxResult = new AjaxResult();
25 | int replyId = replyService.addReply(reply);
26 | return new AjaxResult().setData(replyId);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/controller/SubjectController.java:
--------------------------------------------------------------------------------
1 | package com.qexz.controller;
2 |
3 | import com.qexz.common.QexzConst;
4 | import com.qexz.dto.AjaxResult;
5 | import com.qexz.model.Subject;
6 | import com.qexz.service.AccountService;
7 | import com.qexz.service.SubjectService;
8 | import org.apache.commons.logging.Log;
9 | import org.apache.commons.logging.LogFactory;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.*;
13 |
14 | import javax.servlet.http.HttpServletRequest;
15 | import javax.servlet.http.HttpServletResponse;
16 |
17 | @RestController
18 | @RequestMapping(value = "/subject")
19 | public class SubjectController {
20 |
21 | private static Log LOG = LogFactory.getLog(SubjectController.class);
22 |
23 | @Autowired
24 | private SubjectService subjectService;
25 |
26 | //添加课程
27 | @RequestMapping(value="/api/addSubject", method= RequestMethod.POST)
28 | @ResponseBody
29 | public AjaxResult addSubject(@RequestBody Subject subject) {
30 | AjaxResult ajaxResult = new AjaxResult();
31 | subject.setImgUrl(QexzConst.DEFAULT_SUBJECT_IMG_URL);
32 | subject.setQuestionNum(0);
33 | int subjectId = subjectService.addSubject(subject);
34 | return new AjaxResult().setData(subjectId);
35 | }
36 |
37 | //更新课程
38 | @RequestMapping(value="/api/updateSubject", method= RequestMethod.POST)
39 | @ResponseBody
40 | public AjaxResult updateSubject(@RequestBody Subject subject) {
41 | AjaxResult ajaxResult = new AjaxResult();
42 | boolean result = subjectService.updateSubject(subject);
43 | return new AjaxResult().setData(result);
44 | }
45 |
46 | //删除课程
47 | @DeleteMapping("/api/deleteSubject/{id}")
48 | public AjaxResult deleteSubject(@PathVariable int id) {
49 | AjaxResult ajaxResult = new AjaxResult();
50 | boolean result = subjectService.deleteSubjectById(id);
51 | return new AjaxResult().setData(result);
52 | }
53 |
54 | /**
55 | * 分页获取所有课程列表
56 | */
57 | @RequestMapping(value = "/api/getSubjects", method = RequestMethod.POST)
58 | @ResponseBody
59 | public AjaxResult getSubjects(HttpServletRequest request, HttpServletResponse response) {
60 | AjaxResult ajaxResult = new AjaxResult();
61 | // try {
62 | // String username = request.getParameter("username");
63 | // String password = request.getParameter("password");
64 | // Account current_account = accountService.getAccountByUsername(username);
65 | // if(current_account != null) {
66 | // String pwd = MD5.md5(QexzConst.MD5_SALT+password);
67 | // if(pwd.equals(current_account.getPassword())) {
68 | // request.getSession().setAttribute(QexzConst.CURRENT_ACCOUNT,current_account);
69 | // ajaxResult.setData(current_account);
70 | // } else {
71 | // return AjaxResult.fixedError(QexzWebError.WRONG_PASSWORD);
72 | // }
73 | // } else {
74 | // return AjaxResult.fixedError(QexzWebError.WRONG_USERNAME);
75 | // }
76 | // } catch (Exception e) {
77 | // LOG.error(e.getMessage(), e);
78 | // return AjaxResult.fixedError(QexzWebError.COMMON);
79 | // }
80 | return ajaxResult;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/AccountMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Account;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 | import java.util.Set;
10 |
11 | @Component
12 | @Mapper
13 | public interface AccountMapper {
14 |
15 | int insertAccount(@Param("account") Account account);
16 |
17 | int updateAccountById(@Param("account") Account account);
18 |
19 | int updateAvatarImgUrlById(@Param("avatarImgUrl") String avatarImgUrl, @Param("id") int id);
20 |
21 | Account getAccountByUsername(@Param("username") String username);
22 |
23 | List getAccountsByIds(@Param("studentIds") List studentIds);
24 |
25 | int getCount();
26 |
27 | List getAccounts();
28 |
29 | int deleteAccount(@Param("id") int id);
30 |
31 | int updateState(@Param("id") int id, @Param("state") int state);
32 |
33 | List getAccountsByIdSets(@Param("ids") Set ids);
34 |
35 | Account getAccountById(@Param("id") int id);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/CommentMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Comment;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Component
11 | @Mapper
12 | public interface CommentMapper {
13 |
14 | int insertComment(@Param("comment") Comment comment);
15 |
16 | List getCommentsByPostId(@Param("postId") int postId);
17 |
18 | int getCount();
19 |
20 | List getComments();
21 |
22 | int deleteCommentById(@Param("id") int id);
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/ContestMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Contest;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.Date;
9 | import java.util.List;
10 | import java.util.Set;
11 |
12 | @Component
13 | @Mapper
14 | public interface ContestMapper {
15 |
16 | int insertContest(@Param("contest") Contest contest);
17 |
18 | int updateContestById(@Param("contest") Contest contest);
19 |
20 | Contest getContestById(@Param("id") int id);
21 |
22 | int getCount();
23 |
24 | List getContests();
25 |
26 | int deleteContest(@Param("id") int id);
27 |
28 | int updateStateToStart(@Param("currentTime") Date currentTime);
29 |
30 | int updateStateToEnd(@Param("currentTime") Date currentTime);
31 |
32 | List getContestsByContestIds(@Param("contestIds") Set contestIds);
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/GradeMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Grade;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Component
11 | @Mapper
12 | public interface GradeMapper {
13 |
14 | int insertGrade(@Param("grade") Grade grade);
15 |
16 | int deleteGrade(@Param("id") int id);
17 |
18 | int updateGradeById(@Param("grade") Grade grade);
19 |
20 | Grade getGradeById(@Param("id") int id);
21 |
22 | int getCountByStudentId(@Param("studentId") int studentId);
23 |
24 | List getGradesByStudentId(@Param("studentId") int studentId);
25 |
26 | List getGradesByContestId(@Param("contestId") int contestId);
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/PostMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Post;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.Date;
9 | import java.util.List;
10 |
11 | @Component
12 | @Mapper
13 | public interface PostMapper {
14 |
15 | int insertPost(@Param("post") Post post);
16 |
17 | int updatePostById(@Param("post") Post post);
18 |
19 | Post getPostById(@Param("id") int id);
20 |
21 | int deletePostById(@Param("id") int id);
22 |
23 | int getCount();
24 |
25 | List getPosts();
26 |
27 | int updateReplyNumById(@Param("id") int id, @Param("lastReplyTime") Date lastReplyTime);
28 |
29 | int getCountByAuthorId(@Param("authorId") int authorId);
30 |
31 | List getPostsByAuthorId(@Param("authorId") int authorId);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/QuestionMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Question;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Component
11 | @Mapper
12 | public interface QuestionMapper {
13 |
14 | int insertQuestion(@Param("question") Question question);
15 |
16 | int deleteQuestion(@Param("id") int id);
17 |
18 | int updateQuestionById(@Param("question") Question question);
19 |
20 | Question getQuestionById(@Param("id") int id);
21 |
22 | int getCountByContent(@Param("content") String content);
23 |
24 | List getQuestionsByContent(@Param("content") String content);
25 |
26 | List getQuestionByContestId(@Param("contestId") int contestId);
27 |
28 | int getCountByProblemsetIdAndContentAndDiffculty(@Param("problemsetId") int problemsetId,
29 | @Param("content") String content,
30 | @Param("difficulty") int diffculty);
31 |
32 | List getQuestionsByProblemsetIdAndContentAndDiffculty(@Param("problemsetId") int problemsetId,
33 | @Param("content") String content,
34 | @Param("difficulty") int diffculty);
35 |
36 | int updateQuestionsStateByContestId(@Param("contestId") int contestId,
37 | @Param("state") int state);
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/ReplyMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Reply;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Component
11 | @Mapper
12 | public interface ReplyMapper {
13 |
14 | int insertReply(@Param("reply") Reply reply);
15 |
16 | List getReliesByPostId(@Param("postId") int postId);
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dao/SubjectMapper.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dao;
2 |
3 | import com.qexz.model.Subject;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.List;
9 |
10 | @Component
11 | @Mapper
12 | public interface SubjectMapper {
13 |
14 | int insertSubject(@Param("subject") Subject subject);
15 |
16 | int updateSubjectById(@Param("subject") Subject subject);
17 |
18 | Subject getSubjectById(@Param("id") int id);
19 |
20 | int getCount();
21 |
22 | List getSubjects();
23 |
24 | int deleteSubjectById(@Param("id") int id);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/dto/AjaxResult.java:
--------------------------------------------------------------------------------
1 | package com.qexz.dto;
2 |
3 | import com.qexz.exception.QexzWebError;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | /**
9 | * 封装json对象,所有返回结果都使用它
10 | */
11 | public class AjaxResult extends HashMap {
12 |
13 | //TODO::深度依赖了,后面需要统一throw
14 | @Deprecated
15 | public static final String COMMON_ERROR = "接口调用出错";
16 |
17 | public static final String MESSAGE = "message";
18 | public static final String SUCCESS = "success";
19 | public static final String DATA = "data";
20 | public static final String CODE = "code";
21 |
22 | public static final AjaxResult BLANK_SUCCESS = new AjaxResult().setSuccess(true);
23 |
24 | private static final Map map = new HashMap<>();
25 |
26 | public static AjaxResult fixedError(QexzWebError qexzWebError) {
27 | if (map.get(qexzWebError) == null) {
28 | synchronized (AjaxResult.class) {
29 | map.computeIfAbsent(qexzWebError, e -> new AjaxResult().setState(e));
30 | }
31 | }
32 | return map.get(qexzWebError);
33 | }
34 |
35 | public AjaxResult() {
36 | put(MESSAGE, "");
37 | put(SUCCESS, false);
38 | }
39 |
40 | public AjaxResult setState(QexzWebError qexzWebError) {
41 | put(MESSAGE, qexzWebError.errMsg);
42 | put(CODE, qexzWebError.code);
43 | put(SUCCESS, false);
44 | return this;
45 | }
46 |
47 | private AjaxResult setCode(int code) {
48 | put(CODE, code);
49 | return this;
50 | }
51 |
52 | public AjaxResult setMessage(String msg) {
53 | setSuccess(false);
54 | put(MESSAGE, msg);
55 | return this;
56 | }
57 |
58 | public AjaxResult setSuccess(boolean ret) {
59 | put(SUCCESS, ret);
60 | return this;
61 | }
62 |
63 | public AjaxResult setData(Object obj) {
64 | setSuccess(true);
65 | put(DATA, obj);
66 | return this;
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/src/main/java/com/qexz/exception/QexzWebError.java:
--------------------------------------------------------------------------------
1 | package com.qexz.exception;
2 |
3 | public enum QexzWebError {
4 |
5 | COMMON("服务器端出错", 3000),
6 | WRONG_USERNAME_OR_PASSWORD("账号或密码错误", 3001),
7 | WRONG_USERNAME("该账号不存在", 3002),
8 | WRONG_PASSWORD("密码错误", 3003),
9 | NOT_EQUALS_CONFIRM_PASSWORD("确认密码不一致", 3004),
10 | UPLOAD_FILE_IMAGE_ANALYZE_ERROR("服务端解析文件出错", 3005),
11 | UPLOAD_FILE_IMAGE_NOT_QUALIFIED("图片不合法",3006),
12 | AREADY_EXIST_USERNAME("该账号已经存在了", 3007);
13 |
14 | public final String errMsg;
15 | public final int code;
16 |
17 | QexzWebError(String errMsg, int code) {
18 | this.errMsg = errMsg;
19 | this.code = code;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/exception/QexzWebException.java:
--------------------------------------------------------------------------------
1 | package com.qexz.exception;
2 |
3 | public class QexzWebException extends Exception {
4 |
5 | public final QexzWebError qexzWebError;
6 |
7 | public QexzWebException(QexzWebError qexzWebError) {
8 | this.qexzWebError = qexzWebError;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Account.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Date;
5 |
6 | public class Account implements Serializable {
7 |
8 |
9 | private static final long serialVersionUID = -5833060742923499664L;
10 | private int id;
11 | private String name;
12 | private String username;
13 | private String password;
14 | private String qq;
15 | private String phone;
16 | private String email;
17 | private String description;
18 | private String avatarImgUrl;
19 | private int state;
20 | private int level;
21 | private Date createTime;
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 | public void setId(int id) {
28 | this.id = id;
29 | }
30 |
31 | public String getName() {
32 | return name;
33 | }
34 |
35 | public void setName(String name) {
36 | this.name = name;
37 | }
38 |
39 | public String getUsername() {
40 | return username;
41 | }
42 |
43 | public void setUsername(String username) {
44 | this.username = username;
45 | }
46 |
47 | public String getPassword() {
48 | return password;
49 | }
50 |
51 | public void setPassword(String password) {
52 | this.password = password;
53 | }
54 |
55 | public String getQq() {
56 | return qq;
57 | }
58 |
59 | public void setQq(String qq) {
60 | this.qq = qq;
61 | }
62 |
63 | public String getPhone() {
64 | return phone;
65 | }
66 |
67 | public void setPhone(String phone) {
68 | this.phone = phone;
69 | }
70 |
71 | public String getEmail() {
72 | return email;
73 | }
74 |
75 | public void setEmail(String email) {
76 | this.email = email;
77 | }
78 |
79 | public String getDescription() {
80 | return description;
81 | }
82 |
83 | public void setDescription(String description) {
84 | this.description = description;
85 | }
86 |
87 | public String getAvatarImgUrl() {
88 | return avatarImgUrl;
89 | }
90 |
91 | public void setAvatarImgUrl(String avatarImgUrl) {
92 | this.avatarImgUrl = avatarImgUrl;
93 | }
94 |
95 | public int getState() {
96 | return state;
97 | }
98 |
99 | public void setState(int state) {
100 | this.state = state;
101 | }
102 |
103 | public int getLevel() {
104 | return level;
105 | }
106 |
107 | public void setLevel(int level) {
108 | this.level = level;
109 | }
110 |
111 | public Date getCreateTime() {
112 | return createTime;
113 | }
114 |
115 | public void setCreateTime(Date createTime) {
116 | this.createTime = createTime;
117 | }
118 |
119 | @Override
120 | public String toString() {
121 | return "Account{" +
122 | "id=" + id +
123 | ", name='" + name + '\'' +
124 | ", username='" + username + '\'' +
125 | ", password='" + password + '\'' +
126 | ", qq='" + qq + '\'' +
127 | ", phone='" + phone + '\'' +
128 | ", email='" + email + '\'' +
129 | ", description='" + description + '\'' +
130 | ", avatarImgUrl='" + avatarImgUrl + '\'' +
131 | ", state=" + state +
132 | ", level=" + level +
133 | ", createTime=" + createTime +
134 | '}';
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Comment.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | public class Comment {
7 |
8 | private int id;
9 | private int userId;
10 | private int postId;
11 | private String content;
12 | private Date createTime;
13 |
14 | Account user;
15 | List replies;
16 |
17 | public int getId() {
18 | return id;
19 | }
20 |
21 | public void setId(int id) {
22 | this.id = id;
23 | }
24 |
25 | public int getUserId() {
26 | return userId;
27 | }
28 |
29 | public void setUserId(int userId) {
30 | this.userId = userId;
31 | }
32 |
33 | public int getPostId() {
34 | return postId;
35 | }
36 |
37 | public void setPostId(int postId) {
38 | this.postId = postId;
39 | }
40 |
41 | public String getContent() {
42 | return content;
43 | }
44 |
45 | public void setContent(String content) {
46 | this.content = content;
47 | }
48 |
49 | public Date getCreateTime() {
50 | return createTime;
51 | }
52 |
53 | public void setCreateTime(Date createTime) {
54 | this.createTime = createTime;
55 | }
56 |
57 | public List getReplies() {
58 | return replies;
59 | }
60 |
61 | public void setReplies(List replies) {
62 | this.replies = replies;
63 | }
64 |
65 | public Account getUser() {
66 | return user;
67 | }
68 |
69 | public void setUser(Account user) {
70 | this.user = user;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Contest.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 |
5 | public class Contest {
6 |
7 | private int id;
8 | private String title;
9 | private int totalScore;
10 | private int subjectId;
11 | private Date createTime;
12 | private Date updateTime;
13 | private Date startTime;
14 | private Date endTime;
15 | private int state;
16 |
17 | private String subjectName;
18 |
19 | public int getId() {
20 | return id;
21 | }
22 |
23 | public void setId(int id) {
24 | this.id = id;
25 | }
26 |
27 | public String getTitle() {
28 | return title;
29 | }
30 |
31 | public void setTitle(String title) {
32 | this.title = title;
33 | }
34 |
35 | public int getTotalScore() {
36 | return totalScore;
37 | }
38 |
39 | public void setTotalScore(int totalScore) {
40 | this.totalScore = totalScore;
41 | }
42 |
43 | public int getSubjectId() {
44 | return subjectId;
45 | }
46 |
47 | public void setSubjectId(int subjectId) {
48 | this.subjectId = subjectId;
49 | }
50 |
51 | public Date getCreateTime() {
52 | return createTime;
53 | }
54 |
55 | public void setCreateTime(Date createTime) {
56 | this.createTime = createTime;
57 | }
58 |
59 | public Date getUpdateTime() {
60 | return updateTime;
61 | }
62 |
63 | public void setUpdateTime(Date updateTime) {
64 | this.updateTime = updateTime;
65 | }
66 |
67 | public Date getStartTime() {
68 | return startTime;
69 | }
70 |
71 | public void setStartTime(Date startTime) {
72 | this.startTime = startTime;
73 | }
74 |
75 | public Date getEndTime() {
76 | return endTime;
77 | }
78 |
79 | public void setEndTime(Date endTime) {
80 | this.endTime = endTime;
81 | }
82 |
83 | public int getState() {
84 | return state;
85 | }
86 |
87 | public void setState(int state) {
88 | this.state = state;
89 | }
90 |
91 | public String getSubjectName() {
92 | return subjectName;
93 | }
94 |
95 | public void setSubjectName(String subjectName) {
96 | this.subjectName = subjectName;
97 | }
98 |
99 | @Override
100 | public String toString() {
101 | return "Contest{" +
102 | "id=" + id +
103 | ", title='" + title + '\'' +
104 | ", totalScore=" + totalScore +
105 | ", subjectId=" + subjectId +
106 | ", createTime=" + createTime +
107 | ", updateTime=" + updateTime +
108 | ", startTime=" + startTime +
109 | ", endTime=" + endTime +
110 | ", state=" + state +
111 | ", subjectName='" + subjectName + '\'' +
112 | '}';
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Grade.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | public class Grade {
7 |
8 | private int id;
9 | private int studentId;
10 | private int contestId;
11 | private int result;
12 | private int autoResult;
13 | private int manulResult;
14 | private String answerJson;
15 | private Date createTime;
16 | private Date finishTime;
17 | private int state;
18 |
19 | private Account student;
20 | private Contest contest;
21 | private List questions;
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 | public void setId(int id) {
28 | this.id = id;
29 | }
30 |
31 | public int getStudentId() {
32 | return studentId;
33 | }
34 |
35 | public void setStudentId(int studentId) {
36 | this.studentId = studentId;
37 | }
38 |
39 | public int getContestId() {
40 | return contestId;
41 | }
42 |
43 | public void setContestId(int contestId) {
44 | this.contestId = contestId;
45 | }
46 |
47 | public int getResult() {
48 | return result;
49 | }
50 |
51 | public void setResult(int result) {
52 | this.result = result;
53 | }
54 |
55 | public int getAutoResult() {
56 | return autoResult;
57 | }
58 |
59 | public void setAutoResult(int autoResult) {
60 | this.autoResult = autoResult;
61 | }
62 |
63 | public int getManulResult() {
64 | return manulResult;
65 | }
66 |
67 | public void setManulResult(int manulResult) {
68 | this.manulResult = manulResult;
69 | }
70 |
71 | public String getAnswerJson() {
72 | return answerJson;
73 | }
74 |
75 | public void setAnswerJson(String answerJson) {
76 | this.answerJson = answerJson;
77 | }
78 |
79 | public Date getCreateTime() {
80 | return createTime;
81 | }
82 |
83 | public void setCreateTime(Date createTime) {
84 | this.createTime = createTime;
85 | }
86 |
87 | public Date getFinishTime() {
88 | return finishTime;
89 | }
90 |
91 | public void setFinishTime(Date finishTime) {
92 | this.finishTime = finishTime;
93 | }
94 |
95 | public int getState() {
96 | return state;
97 | }
98 |
99 | public void setState(int state) {
100 | this.state = state;
101 | }
102 |
103 | public Account getStudent() {
104 | return student;
105 | }
106 |
107 | public void setStudent(Account student) {
108 | this.student = student;
109 | }
110 |
111 | public Contest getContest() {
112 | return contest;
113 | }
114 |
115 | public void setContest(Contest contest) {
116 | this.contest = contest;
117 | }
118 |
119 | public List getQuestions() {
120 | return questions;
121 | }
122 |
123 | public void setQuestions(List questions) {
124 | this.questions = questions;
125 | }
126 |
127 | @Override
128 | public String toString() {
129 | return "Grade{" +
130 | "id=" + id +
131 | ", studentId=" + studentId +
132 | ", contestId=" + contestId +
133 | ", result=" + result +
134 | ", autoResult=" + autoResult +
135 | ", manulResult=" + manulResult +
136 | ", answerJson='" + answerJson + '\'' +
137 | ", createTime=" + createTime +
138 | ", finishTime=" + finishTime +
139 | ", state=" + state +
140 | ", student=" + student +
141 | ", contest=" + contest +
142 | ", questions=" + questions +
143 | '}';
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Post.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 |
5 | public class Post {
6 |
7 | private int id;
8 | private int authorId;
9 | private String htmlContent;
10 | private String textContent;
11 | private Date createTime;
12 | private Date updateTime;
13 | private Date lastReplyTime;
14 | private int replyNum;
15 | private String title;
16 |
17 | private Account author;
18 |
19 | public int getId() {
20 | return id;
21 | }
22 |
23 | public void setId(int id) {
24 | this.id = id;
25 | }
26 |
27 | public int getAuthorId() {
28 | return authorId;
29 | }
30 |
31 | public void setAuthorId(int authorId) {
32 | this.authorId = authorId;
33 | }
34 |
35 | public String getHtmlContent() {
36 | return htmlContent;
37 | }
38 |
39 | public void setHtmlContent(String htmlContent) {
40 | this.htmlContent = htmlContent;
41 | }
42 |
43 | public String getTextContent() {
44 | return textContent;
45 | }
46 |
47 | public void setTextContent(String textContent) {
48 | this.textContent = textContent;
49 | }
50 |
51 | public Date getCreateTime() {
52 | return createTime;
53 | }
54 |
55 | public void setCreateTime(Date createTime) {
56 | this.createTime = createTime;
57 | }
58 |
59 | public Date getUpdateTime() {
60 | return updateTime;
61 | }
62 |
63 | public void setUpdateTime(Date updateTime) {
64 | this.updateTime = updateTime;
65 | }
66 |
67 | public Date getLastReplyTime() {
68 | return lastReplyTime;
69 | }
70 |
71 | public void setLastReplyTime(Date lastReplyTime) {
72 | this.lastReplyTime = lastReplyTime;
73 | }
74 |
75 | public int getReplyNum() {
76 | return replyNum;
77 | }
78 |
79 | public void setReplyNum(int replyNum) {
80 | this.replyNum = replyNum;
81 | }
82 |
83 | public Account getAuthor() {
84 | return author;
85 | }
86 |
87 | public void setAuthor(Account author) {
88 | this.author = author;
89 | }
90 |
91 | public String getTitle() {
92 | return title;
93 | }
94 |
95 | public void setTitle(String title) {
96 | this.title = title;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Question.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 |
5 | public class Question {
6 |
7 | private int id;
8 | private String title;
9 | private String content;
10 | private int questionType;
11 | private String optionA;
12 | private String optionB;
13 | private String optionC;
14 | private String optionD;
15 | private String answer;
16 | private String parse;
17 | private int subjectId;
18 | private int contestId;
19 | private int score;
20 | private int difficulty;
21 | private Date createTime;
22 | private Date updateTime;
23 | private int state;
24 |
25 | private String subjectName;
26 |
27 | public int getId() {
28 | return id;
29 | }
30 |
31 | public void setId(int id) {
32 | this.id = id;
33 | }
34 |
35 | public String getTitle() {
36 | return title;
37 | }
38 |
39 | public void setTitle(String title) {
40 | this.title = title;
41 | }
42 |
43 | public String getContent() {
44 | return content;
45 | }
46 |
47 | public void setContent(String content) {
48 | this.content = content;
49 | }
50 |
51 | public int getQuestionType() {
52 | return questionType;
53 | }
54 |
55 | public void setQuestionType(int questionType) {
56 | this.questionType = questionType;
57 | }
58 |
59 | public String getOptionA() {
60 | return optionA;
61 | }
62 |
63 | public void setOptionA(String optionA) {
64 | this.optionA = optionA;
65 | }
66 |
67 | public String getOptionB() {
68 | return optionB;
69 | }
70 |
71 | public void setOptionB(String optionB) {
72 | this.optionB = optionB;
73 | }
74 |
75 | public String getOptionC() {
76 | return optionC;
77 | }
78 |
79 | public void setOptionC(String optionC) {
80 | this.optionC = optionC;
81 | }
82 |
83 | public String getOptionD() {
84 | return optionD;
85 | }
86 |
87 | public void setOptionD(String optionD) {
88 | this.optionD = optionD;
89 | }
90 |
91 | public String getAnswer() {
92 | return answer;
93 | }
94 |
95 | public void setAnswer(String answer) {
96 | this.answer = answer;
97 | }
98 |
99 | public String getParse() {
100 | return parse;
101 | }
102 |
103 | public void setParse(String parse) {
104 | this.parse = parse;
105 | }
106 |
107 | public int getSubjectId() {
108 | return subjectId;
109 | }
110 |
111 | public void setSubjectId(int subjectId) {
112 | this.subjectId = subjectId;
113 | }
114 |
115 | public int getContestId() {
116 | return contestId;
117 | }
118 |
119 | public void setContestId(int contestId) {
120 | this.contestId = contestId;
121 | }
122 |
123 | public int getScore() {
124 | return score;
125 | }
126 |
127 | public void setScore(int score) {
128 | this.score = score;
129 | }
130 |
131 | public Date getCreateTime() {
132 | return createTime;
133 | }
134 |
135 | public void setCreateTime(Date createTime) {
136 | this.createTime = createTime;
137 | }
138 |
139 | public Date getUpdateTime() {
140 | return updateTime;
141 | }
142 |
143 | public void setUpdateTime(Date updateTime) {
144 | this.updateTime = updateTime;
145 | }
146 |
147 | public int getDifficulty() {
148 | return difficulty;
149 | }
150 |
151 | public void setDifficulty(int difficulty) {
152 | this.difficulty = difficulty;
153 | }
154 |
155 | public int getState() {
156 | return state;
157 | }
158 |
159 | public void setState(int state) {
160 | this.state = state;
161 | }
162 |
163 | public String getSubjectName() {
164 | return subjectName;
165 | }
166 |
167 | public void setSubjectName(String subjectName) {
168 | this.subjectName = subjectName;
169 | }
170 |
171 | @Override
172 | public String toString() {
173 | return "Question{" +
174 | "id=" + id +
175 | ", title='" + title + '\'' +
176 | ", content='" + content + '\'' +
177 | ", questionType=" + questionType +
178 | ", optionA='" + optionA + '\'' +
179 | ", optionB='" + optionB + '\'' +
180 | ", optionC='" + optionC + '\'' +
181 | ", optionD='" + optionD + '\'' +
182 | ", answer='" + answer + '\'' +
183 | ", parse='" + parse + '\'' +
184 | ", subjectId=" + subjectId +
185 | ", contestId=" + contestId +
186 | ", score=" + score +
187 | ", difficulty=" + difficulty +
188 | ", createTime=" + createTime +
189 | ", updateTime=" + updateTime +
190 | ", state=" + state +
191 | ", subjectName='" + subjectName + '\'' +
192 | '}';
193 | }
194 | }
195 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Reply.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 |
5 | public class Reply {
6 |
7 | private int id;
8 | private int userId;
9 | private int atuserId;
10 | private int postId;
11 | private int commentId;
12 | private String content;
13 | private Date createTime;
14 |
15 | private Account user;
16 | private Account atuser;
17 |
18 | public int getId() {
19 | return id;
20 | }
21 |
22 | public void setId(int id) {
23 | this.id = id;
24 | }
25 |
26 | public int getUserId() {
27 | return userId;
28 | }
29 |
30 | public void setUserId(int userId) {
31 | this.userId = userId;
32 | }
33 |
34 | public int getAtuserId() {
35 | return atuserId;
36 | }
37 |
38 | public void setAtuserId(int atuserId) {
39 | this.atuserId = atuserId;
40 | }
41 |
42 | public int getPostId() {
43 | return postId;
44 | }
45 |
46 | public void setPostId(int postId) {
47 | this.postId = postId;
48 | }
49 |
50 | public int getCommentId() {
51 | return commentId;
52 | }
53 |
54 | public void setCommentId(int commentId) {
55 | this.commentId = commentId;
56 | }
57 |
58 | public String getContent() {
59 | return content;
60 | }
61 |
62 | public void setContent(String content) {
63 | this.content = content;
64 | }
65 |
66 | public Date getCreateTime() {
67 | return createTime;
68 | }
69 |
70 | public void setCreateTime(Date createTime) {
71 | this.createTime = createTime;
72 | }
73 |
74 | public Account getUser() {
75 | return user;
76 | }
77 |
78 | public void setUser(Account user) {
79 | this.user = user;
80 | }
81 |
82 | public Account getAtuser() {
83 | return atuser;
84 | }
85 |
86 | public void setAtuser(Account atuser) {
87 | this.atuser = atuser;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/model/Subject.java:
--------------------------------------------------------------------------------
1 | package com.qexz.model;
2 |
3 | import java.util.Date;
4 |
5 | public class Subject {
6 |
7 | private int id;
8 | private String name;
9 | private Date createTime;
10 | private Date updateTime;
11 | private int questionNum;
12 | private String imgUrl;
13 | private int state;
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public void setId(int id) {
20 | this.id = id;
21 | }
22 |
23 | public String getName() {
24 | return name;
25 | }
26 |
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 |
31 | public Date getCreateTime() {
32 | return createTime;
33 | }
34 |
35 | public void setCreateTime(Date createTime) {
36 | this.createTime = createTime;
37 | }
38 |
39 | public Date getUpdateTime() {
40 | return updateTime;
41 | }
42 |
43 | public void setUpdateTime(Date updateTime) {
44 | this.updateTime = updateTime;
45 | }
46 |
47 | public int getQuestionNum() {
48 | return questionNum;
49 | }
50 |
51 | public void setQuestionNum(int questionNum) {
52 | this.questionNum = questionNum;
53 | }
54 |
55 | public String getImgUrl() {
56 | return imgUrl;
57 | }
58 |
59 | public void setImgUrl(String imgUrl) {
60 | this.imgUrl = imgUrl;
61 | }
62 |
63 | public int getState() {
64 | return state;
65 | }
66 |
67 | public void setState(int state) {
68 | this.state = state;
69 | }
70 |
71 | @Override
72 | public String toString() {
73 | return "Subject{" +
74 | "id=" + id +
75 | ", name='" + name + '\'' +
76 | ", createTime=" + createTime +
77 | ", updateTime=" + updateTime +
78 | ", questionNum=" + questionNum +
79 | ", imgUrl='" + imgUrl + '\'' +
80 | ", state=" + state +
81 | '}';
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/AccountService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Account;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.Set;
8 |
9 | public interface AccountService {
10 |
11 | int addAccount(Account account);
12 |
13 | boolean updateAccount(Account account);
14 |
15 | boolean updateAvatarImgUrlById(String avatarImgUrl, int id);
16 |
17 | Account getAccountByUsername(String username);
18 |
19 | List getAccountsByStudentIds(List studentIds);
20 |
21 | Map getAccounts(int pageNum, int pageSize);
22 |
23 | boolean deleteAccount(int id);
24 |
25 | boolean disabledAccount(int id);
26 |
27 | boolean abledAccount(int id);
28 |
29 | List getAccountsByIds(Set ids);
30 |
31 | Account getAccountById(int id);
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/CommentService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Comment;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface CommentService {
9 |
10 | int addComment(Comment comment);
11 |
12 | List getCommentsByPostId(int postId);
13 |
14 | Map getComments(int pageNum, int pageSize);
15 |
16 | boolean deleteCommentById(int id);
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/ContestService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Contest;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 | import java.util.Set;
8 |
9 | public interface ContestService {
10 |
11 | int addContest(Contest contest);
12 |
13 | boolean updateContest(Contest contest);
14 |
15 | Contest getContestById(int id);
16 |
17 | Map getContests(int pageNum, int pageSize);
18 |
19 | boolean deleteContest(int id);
20 |
21 | boolean updateStateToStart();
22 |
23 | boolean updateStateToEnd();
24 |
25 | List getContestsByContestIds(Set contestIds);
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/GradeService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Grade;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface GradeService {
9 |
10 | int addGrade(Grade grade);
11 |
12 | boolean updateGrade(Grade grade);
13 |
14 | boolean deleteGrade(int id);
15 |
16 | Grade getGradeById(int id);
17 |
18 | Map getGradesByStudentId(int pageNum, int pageSize, int studentId);
19 |
20 | List getGradesByContestId(int contestId);
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/PostService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Post;
4 |
5 | import java.util.Map;
6 |
7 | public interface PostService {
8 |
9 | int addPost(Post post);
10 |
11 | boolean updatePostById(Post post);
12 |
13 | boolean deletePostById(int id);
14 |
15 | Map getPosts(int pageNum, int pageSize);
16 |
17 | Post getPostById(int id);
18 |
19 | boolean updateReplyNumById(int id);
20 |
21 | Map getPostsByAuthorId(int pageNum, int pageSize, int authorId);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/QuestionService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Question;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface QuestionService {
9 |
10 | int addQuestion(Question question);
11 |
12 | boolean updateQuestion(Question question);
13 |
14 | List getQuestionsByContestId(int contestId);
15 |
16 | Map getQuestionsByContent(int pageNum, int pageSize, String content);
17 |
18 | Map getQuestionsByProblemsetIdAndContentAndDiffculty(int pageNum, int pageSize,
19 | int problemsetId,
20 | String content,
21 | int diffcult);
22 |
23 | boolean deleteQuestion(int id);
24 |
25 | Question getQuestionById(int id);
26 |
27 | boolean updateQuestionsStateByContestId(int contestId, int state);
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/ReplyService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Reply;
4 |
5 | import java.util.List;
6 |
7 | public interface ReplyService {
8 |
9 | int addReply(Reply reply);
10 |
11 | List getReliesByPostId(int postId);
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/SubjectService.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service;
2 |
3 | import com.qexz.model.Subject;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface SubjectService {
9 |
10 | int addSubject(Subject subject);
11 |
12 | boolean updateSubject(Subject subject);
13 |
14 | Subject getSubjectById(int id);
15 |
16 | Map getSubjects(int pageNum, int pageSize);
17 |
18 | List getSubjects();
19 |
20 | boolean deleteSubjectById(int id);
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/AccountServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.common.QexzConst;
5 | import com.qexz.dao.AccountMapper;
6 | import com.qexz.model.Account;
7 | import com.qexz.service.AccountService;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import java.util.*;
12 | import java.util.stream.Collectors;
13 |
14 | @Service("accountService")
15 | public class AccountServiceImpl implements AccountService {
16 |
17 | @Autowired
18 | private AccountMapper accountMapper;
19 |
20 | @Override
21 | public int addAccount(Account account) {
22 | account.setAvatarImgUrl(QexzConst.DEFAULT_AVATAR_IMG_URL);
23 | return accountMapper.insertAccount(account);
24 | }
25 |
26 | @Override
27 | public boolean updateAccount(Account account) {
28 | return accountMapper.updateAccountById(account) > 0;
29 | }
30 |
31 | @Override
32 | public boolean updateAvatarImgUrlById(String avatarImgUrl, int id) {
33 | return accountMapper.updateAvatarImgUrlById(avatarImgUrl, id) > 0;
34 | }
35 |
36 | @Override
37 | public Account getAccountByUsername(String username) {
38 | return accountMapper.getAccountByUsername(username);
39 | }
40 |
41 | @Override
42 | public List getAccountsByStudentIds(List studentIds) {
43 | return accountMapper.getAccountsByIds(studentIds);
44 | }
45 |
46 | @Override
47 | public Map getAccounts(int pageNum, int pageSize) {
48 | Map data = new HashMap<>();
49 | int count = accountMapper.getCount();
50 | if (count == 0) {
51 | data.put("pageNum", 0);
52 | data.put("pageSize", 0);
53 | data.put("totalPageNum", 1);
54 | data.put("totalPageSize", 0);
55 | data.put("accounts", new ArrayList<>());
56 | return data;
57 | }
58 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
59 | if (pageNum > totalPageNum) {
60 | data.put("pageNum", 0);
61 | data.put("pageSize", 0);
62 | data.put("totalPageNum", totalPageNum);
63 | data.put("totalPageSize", 0);
64 | data.put("accounts", new ArrayList<>());
65 | return data;
66 | }
67 | PageHelper.startPage(pageNum, pageSize);
68 | List accounts = accountMapper.getAccounts();
69 | data.put("pageNum", pageNum);
70 | data.put("pageSize", pageSize);
71 | data.put("totalPageNum", totalPageNum);
72 | data.put("totalPageSize", count);
73 | data.put("accounts", accounts);
74 | return data;
75 | }
76 |
77 | @Override
78 | public boolean deleteAccount(int id) {
79 | return accountMapper.deleteAccount(id) > 0;
80 | }
81 |
82 | @Override
83 | public boolean disabledAccount(int id) {
84 | return accountMapper.updateState(id, 1) > 0;
85 | }
86 |
87 | @Override
88 | public boolean abledAccount(int id) {
89 | return accountMapper.updateState(id, 0) > 0;
90 | }
91 |
92 | @Override
93 | public List getAccountsByIds(Set ids) {
94 | return accountMapper.getAccountsByIdSets(ids);
95 | }
96 |
97 | @Override
98 | public Account getAccountById(int id) {
99 | return accountMapper.getAccountById(id);
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/CommentServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.dao.CommentMapper;
5 | import com.qexz.model.Comment;
6 | import com.qexz.service.CommentService;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.ArrayList;
11 | import java.util.HashMap;
12 | import java.util.List;
13 | import java.util.Map;
14 | import java.util.stream.Collectors;
15 |
16 | @Service("commentService")
17 | public class CommentServiceImpl implements CommentService {
18 |
19 | @Autowired
20 | private CommentMapper commentMapper;
21 |
22 | @Override
23 | public int addComment(Comment comment) {
24 | return commentMapper.insertComment(comment);
25 | }
26 |
27 | @Override
28 | public List getCommentsByPostId(int postId) {
29 | return commentMapper.getCommentsByPostId(postId);
30 | }
31 |
32 | @Override
33 | public Map getComments(int pageNum, int pageSize) {
34 | Map data = new HashMap<>();
35 | int count = commentMapper.getCount();
36 | if (count == 0) {
37 | data.put("pageNum", 0);
38 | data.put("pageSize", 0);
39 | data.put("totalPageNum", 1);
40 | data.put("totalPageSize", 0);
41 | data.put("comments", new ArrayList<>());
42 | return data;
43 | }
44 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
45 | if (pageNum > totalPageNum) {
46 | data.put("pageNum", 0);
47 | data.put("pageSize", 0);
48 | data.put("totalPageNum", totalPageNum);
49 | data.put("totalPageSize", 0);
50 | data.put("comments", new ArrayList<>());
51 | return data;
52 | }
53 | PageHelper.startPage(pageNum, pageSize);
54 | List comments = commentMapper.getComments();
55 | data.put("pageNum", pageNum);
56 | data.put("pageSize", pageSize);
57 | data.put("totalPageNum", totalPageNum);
58 | data.put("totalPageSize", count);
59 | data.put("comments", comments);
60 | return data;
61 | }
62 |
63 | @Override
64 | public boolean deleteCommentById(int id) {
65 | return commentMapper.deleteCommentById(id) > 0;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/ContestServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.common.QexzConst;
5 | import com.qexz.dao.ContestMapper;
6 | import com.qexz.dao.SubjectMapper;
7 | import com.qexz.model.Contest;
8 | import com.qexz.model.Subject;
9 | import com.qexz.service.ContestService;
10 | import org.apache.commons.lang3.StringUtils;
11 | import org.apache.commons.logging.Log;
12 | import org.apache.commons.logging.LogFactory;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.stereotype.Service;
15 |
16 | import java.util.*;
17 | import java.util.stream.Collectors;
18 |
19 | @Service("contestService")
20 | public class ContestServiceImpl implements ContestService{
21 |
22 | private static Log LOG = LogFactory.getLog(ContestServiceImpl.class);
23 |
24 | @Autowired
25 | private ContestMapper contestMapper;
26 | @Autowired
27 | private SubjectMapper subjectMapper;
28 |
29 | @Override
30 | public int addContest(Contest contest) {
31 | contest.setTotalScore(0);
32 | contest.setState(0);
33 | return contestMapper.insertContest(contest);
34 | }
35 |
36 | @Override
37 | public boolean updateContest(Contest contest) {
38 | return contestMapper.updateContestById(contest) > 0;
39 | }
40 |
41 | @Override
42 | public Contest getContestById(int id) {
43 | return contestMapper.getContestById(id);
44 | }
45 |
46 | @Override
47 | public Map getContests(int pageNum, int pageSize) {
48 | Map data = new HashMap<>();
49 | int count = contestMapper.getCount();
50 | if (count == 0) {
51 | data.put("pageNum", 0);
52 | data.put("pageSize", 0);
53 | data.put("totalPageNum", 1);
54 | data.put("totalPageSize", 0);
55 | data.put("contests", new ArrayList<>());
56 | return data;
57 | }
58 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
59 | if (pageNum > totalPageNum) {
60 | data.put("pageNum", 0);
61 | data.put("pageSize", 0);
62 | data.put("totalPageNum", totalPageNum);
63 | data.put("totalPageSize", 0);
64 | data.put("contests", new ArrayList<>());
65 | return data;
66 | }
67 | List subjects = subjectMapper.getSubjects();
68 | PageHelper.startPage(pageNum, pageSize);
69 | List contests = contestMapper.getContests();
70 | Map subjectId2name = subjects.stream().
71 | collect(Collectors.toMap(Subject::getId, Subject::getName));
72 | for (Contest contest : contests) {
73 | contest.setSubjectName(subjectId2name.
74 | getOrDefault(contest.getSubjectId(), "未知科目"));
75 | }
76 | data.put("pageNum", pageNum);
77 | data.put("pageSize", pageSize);
78 | data.put("totalPageNum", totalPageNum);
79 | data.put("totalPageSize", count);
80 | data.put("contests", contests);
81 | return data;
82 | }
83 |
84 | @Override
85 | public boolean deleteContest(int id) {
86 | return contestMapper.deleteContest(id) > 0;
87 | }
88 |
89 | @Override
90 | public boolean updateStateToStart() {
91 | return contestMapper.updateStateToStart(new Date()) > 0;
92 | }
93 |
94 | @Override
95 | public boolean updateStateToEnd() {
96 | return contestMapper.updateStateToEnd(new Date()) > 0;
97 | }
98 |
99 | @Override
100 | public List getContestsByContestIds(Set contestIds) {
101 | return contestMapper.getContestsByContestIds(contestIds);
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/GradeServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.dao.GradeMapper;
5 | import com.qexz.model.Grade;
6 | import com.qexz.service.GradeService;
7 | import org.apache.commons.logging.Log;
8 | import org.apache.commons.logging.LogFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.ArrayList;
13 | import java.util.HashMap;
14 | import java.util.List;
15 | import java.util.Map;
16 |
17 | @Service("gradeService")
18 | public class GradeServiceImpl implements GradeService {
19 |
20 | private static Log LOG = LogFactory.getLog(GradeServiceImpl.class);
21 |
22 | @Autowired
23 | private GradeMapper gradeMapper;
24 |
25 | @Override
26 | public int addGrade(Grade grade) {
27 | return gradeMapper.insertGrade(grade);
28 | }
29 |
30 | @Override
31 | public boolean updateGrade(Grade grade) {
32 | return gradeMapper.updateGradeById(grade) > 0;
33 | }
34 |
35 | @Override
36 | public boolean deleteGrade(int id) {
37 | return gradeMapper.deleteGrade(id) > 0;
38 | }
39 |
40 | @Override
41 | public Grade getGradeById(int id) {
42 | return gradeMapper.getGradeById(id);
43 | }
44 |
45 | @Override
46 | public Map getGradesByStudentId(int pageNum, int pageSize, int studentId) {
47 | Map data = new HashMap<>();
48 | int count = gradeMapper.getCountByStudentId(studentId);
49 | if (count == 0) {
50 | data.put("pageNum", 0);
51 | data.put("pageSize", 0);
52 | data.put("totalPageNum", 1);
53 | data.put("totalPageSize", 0);
54 | data.put("grades", new ArrayList<>());
55 | return data;
56 | }
57 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
58 | if (pageNum > totalPageNum) {
59 | data.put("pageNum", 0);
60 | data.put("pageSize", 0);
61 | data.put("totalPageNum", totalPageNum);
62 | data.put("totalPageSize", 0);
63 | data.put("grades", new ArrayList<>());
64 | return data;
65 | }
66 | PageHelper.startPage(pageNum, pageSize);
67 | List grades = gradeMapper.getGradesByStudentId(studentId);
68 | data.put("pageNum", pageNum);
69 | data.put("pageSize", pageSize);
70 | data.put("totalPageNum", totalPageNum);
71 | data.put("totalPageSize", count);
72 | data.put("grades", grades);
73 | return data;
74 | }
75 |
76 | @Override
77 | public List getGradesByContestId(int contestId) {
78 | return gradeMapper.getGradesByContestId(contestId);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/PostServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.dao.PostMapper;
5 | import com.qexz.model.Post;
6 | import com.qexz.service.PostService;
7 | import org.apache.commons.logging.Log;
8 | import org.apache.commons.logging.LogFactory;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Service;
11 |
12 | import java.util.*;
13 |
14 | @Service("postService")
15 | public class PostServiceImpl implements PostService {
16 |
17 | private static Log LOG = LogFactory.getLog(PostServiceImpl.class);
18 |
19 | @Autowired
20 | private PostMapper postMapper;
21 |
22 | @Override
23 | public int addPost(Post post) {
24 | return postMapper.insertPost(post);
25 | }
26 |
27 | @Override
28 | public boolean updatePostById(Post post) {
29 | return postMapper.updatePostById(post) > 0;
30 | }
31 |
32 | @Override
33 | public boolean deletePostById(int id) {
34 | return postMapper.deletePostById(id) > 0;
35 | }
36 |
37 | @Override
38 | public Map getPosts(int pageNum, int pageSize) {
39 | Map data = new HashMap<>();
40 | int count = postMapper.getCount();
41 | if (count == 0) {
42 | data.put("pageNum", 0);
43 | data.put("pageSize", 0);
44 | data.put("totalPageNum", 1);
45 | data.put("totalPageSize", 0);
46 | data.put("posts", new ArrayList<>());
47 | return data;
48 | }
49 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
50 | if (pageNum > totalPageNum) {
51 | data.put("pageNum", 0);
52 | data.put("pageSize", 0);
53 | data.put("totalPageNum", totalPageNum);
54 | data.put("totalPageSize", 0);
55 | data.put("posts", new ArrayList<>());
56 | return data;
57 | }
58 | PageHelper.startPage(pageNum, pageSize);
59 | List posts = postMapper.getPosts();
60 | data.put("pageNum", pageNum);
61 | data.put("pageSize", pageSize);
62 | data.put("totalPageNum", totalPageNum);
63 | data.put("totalPageSize", count);
64 | data.put("posts", posts);
65 | return data;
66 | }
67 |
68 | @Override
69 | public Post getPostById(int id) {
70 | return postMapper.getPostById(id);
71 | }
72 |
73 | @Override
74 | public boolean updateReplyNumById(int id) {
75 | return postMapper.updateReplyNumById(id, new Date()) > 0;
76 | }
77 |
78 | @Override
79 | public Map getPostsByAuthorId(int pageNum, int pageSize, int authorId) {
80 | Map data = new HashMap<>();
81 | int count = postMapper.getCountByAuthorId(authorId);
82 | if (count == 0) {
83 | data.put("pageNum", 0);
84 | data.put("pageSize", 0);
85 | data.put("totalPageNum", 1);
86 | data.put("totalPageSize", 0);
87 | data.put("posts", new ArrayList<>());
88 | return data;
89 | }
90 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
91 | if (pageNum > totalPageNum) {
92 | data.put("pageNum", 0);
93 | data.put("pageSize", 0);
94 | data.put("totalPageNum", totalPageNum);
95 | data.put("totalPageSize", 0);
96 | data.put("posts", new ArrayList<>());
97 | return data;
98 | }
99 | PageHelper.startPage(pageNum, pageSize);
100 | List posts = postMapper.getPostsByAuthorId(authorId);
101 | data.put("pageNum", pageNum);
102 | data.put("pageSize", pageSize);
103 | data.put("totalPageNum", totalPageNum);
104 | data.put("totalPageSize", count);
105 | data.put("posts", posts);
106 | return data;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/ReplyServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.qexz.dao.ReplyMapper;
4 | import com.qexz.model.Reply;
5 | import com.qexz.service.ReplyService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 |
11 | @Service("replyService")
12 | public class ReplyServiceImpl implements ReplyService {
13 |
14 | @Autowired
15 | private ReplyMapper replyMapper;
16 |
17 | @Override
18 | public int addReply(Reply reply) {
19 | return replyMapper.insertReply(reply);
20 | }
21 |
22 | @Override
23 | public List getReliesByPostId(int postId) {
24 | return replyMapper.getReliesByPostId(postId);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/service/impl/SubjectServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.qexz.service.impl;
2 |
3 | import com.github.pagehelper.PageHelper;
4 | import com.qexz.common.QexzConst;
5 | import com.qexz.controller.DefaultController;
6 | import com.qexz.dao.SubjectMapper;
7 | import com.qexz.model.Subject;
8 | import com.qexz.service.SubjectService;
9 | import org.apache.commons.lang3.StringUtils;
10 | import org.apache.commons.logging.Log;
11 | import org.apache.commons.logging.LogFactory;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.stereotype.Service;
14 |
15 | import java.util.ArrayList;
16 | import java.util.HashMap;
17 | import java.util.List;
18 | import java.util.Map;
19 |
20 | @Service("subjectService")
21 | public class SubjectServiceImpl implements SubjectService {
22 |
23 | private static Log LOG = LogFactory.getLog(SubjectServiceImpl.class);
24 |
25 | @Autowired
26 | private SubjectMapper subjectMapper;
27 |
28 | @Override
29 | public int addSubject(Subject subject) {
30 | if (subject != null && StringUtils.isEmpty(subject.getImgUrl())) {
31 | subject.setImgUrl(QexzConst.DEFAULT_SUBJECT_IMG_URL);
32 | }
33 | subject.setQuestionNum(0);
34 | return subjectMapper.insertSubject(subject);
35 | }
36 |
37 | @Override
38 | public boolean updateSubject(Subject subject) {
39 | return subjectMapper.updateSubjectById(subject) > 0;
40 | }
41 |
42 | @Override
43 | public Subject getSubjectById(int id) {
44 | return subjectMapper.getSubjectById(id);
45 | }
46 |
47 | @Override
48 | public Map getSubjects(int pageNum, int pageSize) {
49 | Map data = new HashMap<>();
50 | int count = subjectMapper.getCount();
51 | if (count == 0) {
52 | data.put("pageNum", 0);
53 | data.put("pageSize", 0);
54 | data.put("totalPageNum", 1);
55 | data.put("totalPageSize", 0);
56 | data.put("subjects", new ArrayList<>());
57 | return data;
58 | }
59 | int totalPageNum = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
60 | if (pageNum > totalPageNum) {
61 | data.put("pageNum", 0);
62 | data.put("pageSize", 0);
63 | data.put("totalPageNum", totalPageNum);
64 | data.put("totalPageSize", 0);
65 | data.put("subjects", new ArrayList<>());
66 | return data;
67 | }
68 | PageHelper.startPage(pageNum, pageSize);
69 | List subjects = subjectMapper.getSubjects();
70 | data.put("pageNum", pageNum);
71 | data.put("pageSize", pageSize);
72 | data.put("totalPageNum", totalPageNum);
73 | data.put("totalPageSize", count);
74 | data.put("subjects", subjects);
75 | return data;
76 | }
77 |
78 | @Override
79 | public List getSubjects() {
80 | return subjectMapper.getSubjects();
81 | }
82 |
83 | @Override
84 | public boolean deleteSubjectById(int id) {
85 | return subjectMapper.deleteSubjectById(id) > 0;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/com/qexz/util/MD5.java:
--------------------------------------------------------------------------------
1 | package com.qexz.util;
2 |
3 | import java.security.MessageDigest;
4 |
5 | /**
6 | * MD5加密类
7 | * @描述:密码加密
8 | *
9 | */
10 | public final class MD5 {
11 |
12 | /**
13 | * Md5加密
14 | * @param s
15 | * @return
16 | */
17 | public final static String md5(String s) {
18 | char hexDigits[] = { '0', '1', '2', '3', '4',
19 | '5', '6', '7', '8', '9',
20 | 'A', 'B', 'C', 'D', 'E', 'F'};
21 | try {
22 | byte[] btInput = s.getBytes();
23 | MessageDigest mdInst = MessageDigest.getInstance("MD5");
24 | mdInst.update(btInput);
25 | byte[] md = mdInst.digest();
26 | int j = md.length;
27 | char str[] = new char[j * 2];
28 | int k = 0;
29 | for (int i = 0; i < j; i++) {
30 | byte byte0 = md[i];
31 | str[k++] = hexDigits[byte0 >>> 4 & 0xf];
32 | str[k++] = hexDigits[byte0 & 0xf];
33 | }
34 | return new String(str);
35 | }
36 | catch (Exception e) {
37 | e.printStackTrace();
38 | return null;
39 | }
40 | }
41 |
42 | public static void main(String[] args) {
43 | System.out.println(MD5.md5("967042"));
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/src/main/resources/application-dev.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/application-dev.properties
--------------------------------------------------------------------------------
/src/main/resources/application-prod.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/application-prod.properties
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/application.properties
--------------------------------------------------------------------------------
/src/main/resources/mapper/AccountMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | id,`name`,username,password,qq,phone,email,description,avatar_img_url,state,`level`,create_time
20 |
21 |
22 |
23 | insert into t_penguin_account
24 | (name, username, password, qq, phone, email, description,
25 | avatar_img_url, level)
26 | values (#{account.name}, #{account.username}, #{account.password},
27 | #{account.qq}, #{account.phone}, #{account.email}, #{account.description},
28 | #{account.avatarImgUrl}, #{account.level})
29 |
30 |
31 |
32 | UPDATE t_penguin_account
33 | SET
34 | password = #{account.password}, qq = #{account.qq}, phone = #{account.phone},
35 | email = #{account.email}, description = #{account.description},
36 | avatar_img_url = #{account.avatarImgUrl}
37 | WHERE
38 | id = #{account.id}
39 |
40 |
41 |
42 | UPDATE t_penguin_account
43 | SET
44 | avatar_img_url = #{avatarImgUrl}
45 | WHERE
46 | id = #{id}
47 |
48 |
49 |
50 |
56 |
57 |
69 |
70 |
75 |
76 |
82 |
83 |
84 | delete from t_penguin_account
85 | where id = #{id}
86 |
87 |
88 |
89 | update t_penguin_account set
90 | state = #{state}
91 | where id = #{id}
92 |
93 |
94 |
106 |
107 |
108 |
114 |
115 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/CommentMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | id,user_id,post_id,content,create_time
13 |
14 |
15 |
20 |
21 |
28 |
29 |
34 |
35 |
41 |
42 |
46 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/ContestMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | id,title,total_score,subject_id,start_time,end_time,create_time,update_time,state
17 |
18 |
19 |
20 | insert into t_penguin_contest
21 | (title, total_score, subject_id, start_time, end_time, state)
22 | values (#{contest.title}, #{contest.totalScore}, #{contest.subjectId},
23 | #{contest.startTime}, #{contest.endTime}, #{contest.state})
24 |
25 |
26 |
27 | DELETE FROM t_penguin_contest
28 | where id = #{id}
29 |
30 |
31 |
32 | UPDATE t_penguin_contest
33 | SET
34 | title = #{contest.title}, total_score = #{contest.totalScore},
35 | subject_id = #{contest.subjectId}, start_time = #{contest.startTime},
36 | end_time = #{contest.endTime}, state = #{contest.state}
37 | WHERE
38 | id = #{contest.id}
39 |
40 |
41 |
47 |
48 |
53 |
54 |
60 |
61 |
62 | UPDATE t_penguin_contest
63 | SET
64 | state = 1
65 | WHERE
66 | state 0 AND start_time #{currentTime} AND end_time ]]> #{currentTime}
67 |
68 |
69 |
70 | UPDATE t_penguin_contest
71 | SET
72 | state = 2
73 | WHERE
74 | state 2 AND end_time #{currentTime}
75 |
76 |
77 |
89 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/GradeMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | id,student_id,contest_id,result,auto_result,manul_result,
18 | answer_json,create_time,finish_time,state
19 |
20 |
21 |
22 | insert into t_penguin_grade
23 | (student_id, contest_id, result, auto_result, manul_result,
24 | answer_json)
25 | values (#{grade.studentId}, #{grade.contestId}, #{grade.result},
26 | #{grade.autoResult}, #{grade.manulResult}, #{grade.answerJson})
27 |
28 |
29 |
30 | DELETE FROM t_penguin_grade
31 | where id = #{id}
32 |
33 |
34 |
35 | UPDATE t_penguin_grade
36 | SET
37 | result = #{grade.result}, manul_result = #{grade.manulResult},
38 | finish_time = #{grade.finishTime}, state = #{grade.state}
39 | WHERE
40 | id = #{grade.id}
41 |
42 |
43 |
49 |
50 |
56 |
57 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/PostMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | id, author_id, html_content, text_content, create_time,
17 | update_time, last_reply_time, reply_num, title
18 |
19 |
20 |
21 | insert into t_penguin_post
22 | (author_id, title, html_content, text_content)
23 | values (#{post.authorId}, #{post.title}, #{post.htmlContent}, #{post.textContent})
24 |
25 |
26 |
27 | UPDATE t_penguin_post
28 | SET
29 | title = #{title}, html_content = #{post.htmlContent}, text_content = #{post.textContent}
30 | WHERE
31 | id = #{post.id}
32 |
33 |
34 |
40 |
41 |
42 | delete from t_penguin_post
43 | where id = #{id}
44 |
45 |
46 |
51 |
52 |
58 |
59 |
60 | UPDATE t_penguin_post
61 | SET
62 | reply_num = reply_num + 1, last_reply_time = #{lastReplyTime}
63 | WHERE
64 | id = #{id}
65 |
66 |
67 |
73 |
74 |
81 |
82 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/QuestionMapper.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 | id,title,content,question_type,option_a,option_b,option_c,
25 | option_d,answer,parse,subject_id,contest_id,create_time,
26 | update_time,score,difficulty,state
27 |
28 |
29 |
30 | insert into t_penguin_question
31 | (title, content, question_type, option_a, option_b, option_c,
32 | option_d, answer, parse, subject_id, contest_id, score, difficulty,
33 | state)
34 | values (#{question.title}, #{question.content}, #{question.questionType},
35 | #{question.optionA}, #{question.optionB}, #{question.optionC}, #{question.optionD},
36 | #{question.answer}, #{question.parse}, #{question.subjectId}, #{question.contestId},
37 | #{question.score}, #{question.difficulty}, #{question.state})
38 |
39 |
40 |
41 | DELETE FROM t_penguin_question
42 | where id = #{id}
43 |
44 |
45 |
46 | UPDATE t_penguin_question
47 | SET
48 | title = #{question.title}, content = #{question.content},
49 | question_type = #{question.questionType}, option_a = #{question.optionA},
50 | option_b = #{question.optionB}, option_c = #{question.optionC},
51 | option_d = #{question.optionD}, answer = #{question.answer},
52 | parse = #{question.parse}, subject_id = #{question.subjectId},
53 | contest_id = #{question.contestId}, score = #{question.score},
54 | difficulty = #{question.difficulty}
55 | WHERE
56 | id = #{question.id}
57 |
58 |
59 |
65 |
66 |
75 |
76 |
85 |
86 |
93 |
94 |
106 |
107 |
119 |
120 |
121 | UPDATE t_penguin_question
122 | SET
123 | state = #{state}
124 | WHERE
125 | contest_id = #{contestId}
126 |
127 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/ReplyMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | id,user_id,atuser_id,post_id,comment_id,content,create_time
15 |
16 |
17 |
18 | insert into t_penguin_reply
19 | (user_id, atuser_id, post_id, comment_id, content)
20 | values (#{reply.userId}, #{reply.atuserId},
21 | #{reply.postId}, #{reply.commentId}, #{reply.content})
22 |
23 |
24 |
31 |
--------------------------------------------------------------------------------
/src/main/resources/mapper/SubjectMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | id,`name`,question_num,img_url,state,create_time,update_time
15 |
16 |
17 |
18 | insert into t_penguin_subject
19 | (name, question_num, img_url)
20 | values (#{subject.name}, #{subject.questionNum}, #{subject.imgUrl})
21 |
22 |
23 |
24 | UPDATE t_penguin_subject
25 | SET
26 | name = #{subject.name}, question_num = #{subject.questionNum},
27 | img_url = #{subject.imgUrl}
28 | WHERE
29 | id = #{subject.id}
30 |
31 |
32 |
38 |
39 |
44 |
45 |
50 |
51 |
52 | DELETE FROM t_penguin_subject
53 | where id = #{id}
54 |
55 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/app.css:
--------------------------------------------------------------------------------
1 | body, html{
2 | height: 100%;
3 | min-width: 0;
4 | }
5 | .pg_page_container{
6 | width: 95%;
7 | min-height: 100%;
8 | height: auto;
9 | margin: 0 auto 50px auto;
10 | }
11 | #footer{
12 | padding: 20px;
13 | line-height:2rem;
14 | color: #fff;
15 | background: #333;
16 | }
17 | #footer a{
18 | color: #fff;
19 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/contest/detail.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 160px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.problemDetail.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .ui.grid {
30 | margin-top: 1em;
31 | }
32 | /*溢出显示省略号*/
33 | .active.section {
34 | width: 245px;
35 | overflow: hidden;
36 | white-space: nowrap;
37 | text-overflow: ellipsis;
38 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/contest/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 310px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.countdownTime.container {
21 | margin-top: 1em;
22 | padding-left: 20em;
23 | }
24 | .ui.contestList.container {
25 | margin-top: 1em;
26 | }
27 | .ui.subPage.container {
28 | margin-top: 2em;
29 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/discuss/discuss.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 60px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.discussList.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .ui.subPage.container {
30 | margin-top: 2em;
31 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/discuss/discussDetail.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 60px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.discussList.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .discuss-title {
30 | font-size: 16px;!important;
31 | }
32 | .discuss-author-avatar {
33 | height: 50px;!important;
34 | width: 50px;!important;
35 | }
36 | .discuss-author-name {
37 | font-size: 13px;!important;
38 | }
39 | .discuss-author-edit-info {
40 | font-size: 13px;!important;
41 | }
42 | /*溢出显示省略号*/
43 | .active.section {
44 | width: 245px;
45 | overflow: hidden;
46 | white-space: nowrap;
47 | text-overflow: ellipsis;
48 | }
49 |
50 | /* table 样式 */
51 | table {
52 | border-top: 1px solid #ccc;
53 | border-left: 1px solid #ccc;
54 | }
55 | table td,
56 | table th {
57 | border-bottom: 1px solid #ccc;
58 | border-right: 1px solid #ccc;
59 | padding: 3px 5px;
60 | }
61 | table th {
62 | border-bottom: 2px solid #ccc;
63 | text-align: center;
64 | }
65 |
66 | /* blockquote 样式 */
67 | blockquote {
68 | display: block;
69 | border-left: 8px solid #d0e5f2;
70 | padding: 5px 10px;
71 | margin: 10px 0;
72 | line-height: 1.4;
73 | font-size: 100%;
74 | background-color: #f1f1f1;
75 | }
76 |
77 | /* code 样式 */
78 | code {
79 | display: inline-block;
80 | *display: inline;
81 | *zoom: 1;
82 | background-color: #f1f1f1;
83 | border-radius: 3px;
84 | padding: 3px 5px;
85 | margin: 0 3px;
86 | }
87 | pre code {
88 | display: block;
89 | }
90 |
91 | /* ul ol 样式 */
92 | ul, ol {
93 | margin: 10px 0 10px 20px;
94 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/discuss/postDiscuss.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 60px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.postDiscuss.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .ui.subPage.container {
30 | margin-top: 2em;
31 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/home.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 |
12 | .pg_page_container{
13 | width: 100% !important;
14 | height: 100% !important;
15 | }
16 | .ui.menu{
17 | margin: 0 !important;
18 | }
19 | #main_background{
20 | /*background-image: url(/img/bg.jpg);*/
21 | background-repeat: no-repeat;
22 | background-size: 100% 100%;
23 | height: 100%;
24 | }
25 | .logo_panel{
26 | /*width: 350px;*/
27 | width: 700px;
28 | height: 300px;
29 | position: relative;
30 | top:15%;
31 | margin: 0 auto;
32 | text-align: center;
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/manage/manage-app.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Base structure
3 | */
4 |
5 | /* Move down content because we have a fixed navbar that is 50px tall */
6 | body {
7 | padding-top: 50px;
8 | }
9 |
10 |
11 | /*
12 | * Global add-ons
13 | */
14 |
15 | .sub-header {
16 | padding-bottom: 10px;
17 | border-bottom: 1px solid #eee;
18 | }
19 |
20 | /*
21 | * Top navigation
22 | * Hide default border to remove 1px line.
23 | */
24 | .navbar-fixed-top {
25 | border: 0;
26 | }
27 |
28 | /*
29 | * Sidebar
30 | */
31 |
32 | /* Hide for mobile, show later */
33 | .sidebar {
34 | display: none;
35 | }
36 | @media (min-width: 768px) {
37 | .sidebar {
38 | position: fixed;
39 | top: 51px;
40 | bottom: 0;
41 | left: 0;
42 | z-index: 1000;
43 | display: block;
44 | padding: 20px;
45 | overflow-x: hidden;
46 | overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
47 | background-color: #f5f5f5;
48 | border-right: 1px solid #eee;
49 | }
50 | }
51 |
52 | /* Sidebar navigation */
53 | .nav-sidebar {
54 | margin-right: -21px; /* 20px padding + 1px border */
55 | margin-bottom: 20px;
56 | margin-left: -20px;
57 | }
58 | .nav-sidebar > li > a {
59 | padding-right: 20px;
60 | padding-left: 20px;
61 | }
62 | .nav-sidebar > .active > a,
63 | .nav-sidebar > .active > a:hover,
64 | .nav-sidebar > .active > a:focus {
65 | color: #fff;
66 | background-color: #428bca;
67 | }
68 |
69 |
70 | /*
71 | * Main content
72 | */
73 |
74 | .main {
75 | padding: 20px;
76 | }
77 | @media (min-width: 768px) {
78 | .main {
79 | padding-right: 40px;
80 | padding-left: 40px;
81 | }
82 | }
83 | .main .page-header {
84 | margin-top: 0;
85 | }
86 |
87 |
88 | /*
89 | * Placeholder dashboard ideas
90 | */
91 |
92 | .placeholders {
93 | margin-bottom: 30px;
94 | text-align: center;
95 | }
96 | .placeholders h4 {
97 | margin-bottom: 0;
98 | }
99 | .placeholder {
100 | margin-bottom: 20px;
101 | }
102 | .placeholder img {
103 | display: inline-block;
104 | border-radius: 50%;
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/manage/manage-editContestProblem.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/css/manage/manage-editContestProblem.css
--------------------------------------------------------------------------------
/src/main/resources/static/css/manage/manage-login.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 40px;
3 | padding-bottom: 40px;
4 | background-color: #EEEEEE;
5 | }
6 |
7 | .form-signin {
8 | max-width: 330px;
9 | padding: 15px;
10 | margin: 0 auto;
11 | }
12 | .form-signin .form-signin-heading,
13 | .form-signin .checkbox {
14 | margin-bottom: 10px;
15 | }
16 | .form-signin .checkbox {
17 | font-weight: normal;
18 | }
19 | .form-signin .form-control {
20 | position: relative;
21 | height: auto;
22 | -webkit-box-sizing: border-box;
23 | -moz-box-sizing: border-box;
24 | box-sizing: border-box;
25 | padding: 10px;
26 | font-size: 16px;
27 | }
28 | .form-signin .form-control:focus {
29 | z-index: 2;
30 | }
31 | .form-signin input[type="text"] {
32 | margin-bottom: -1px;
33 | border-bottom-right-radius: 0;
34 | border-bottom-left-radius: 0;
35 | }
36 | .form-signin input[type="password"] {
37 | margin-bottom: 10px;
38 | border-top-left-radius: 0;
39 | border-top-right-radius: 0;
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/problem/problemdetail.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 160px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.problemDetail.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .ui.grid {
30 | margin-top: 1em;
31 | }
32 | /*溢出显示省略号*/
33 | .active.section {
34 | width: 245px;
35 | overflow: hidden;
36 | white-space: nowrap;
37 | text-overflow: ellipsis;
38 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/problem/problemlist.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 60px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.problemList.container {
21 | margin-top: 1em;
22 | }
23 | .ui.accordion.segment {
24 | margin-top: 1em;
25 | }
26 | .ui.table {
27 | margin-top: 1em;
28 | }
29 | .ui.subPage.container {
30 | margin-top: 2em;
31 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/problem/problemset.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #FFFFFF;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | }
7 | .ui.footer.segment {
8 | margin: 5em 0em 0em;
9 | padding: 5em 0em;
10 | }
11 | .ui.menu{
12 | margin: 0 !important;
13 | }
14 | .second-footer {
15 | height: 90px;
16 | }
17 | .ui.header.container {
18 | margin-top: 4em;
19 | }
20 | .ui.problemSet.container {
21 | margin-top: 1em;
22 | }
23 | .ui.subPage.container {
24 | margin-top: 2em;
25 | }
26 | .ui.four.column.stackable.grid {
27 | padding-top: 1em;
28 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/style.css:
--------------------------------------------------------------------------------
1 | /*错误页面*/
2 | #errorpage{width:600px;text-align: center;padding: 80px 0;margin:0 auto;height:360px;}
3 | #errorpage .pinknum{color: #fe3a3b;}
4 | #errorpage p{font-size: 18px;font-weight: bold;padding-top: 30px;}
5 | #errorpage .greyspan{color: #999;}
6 | #errorpage i{font-size: 72px;color: #ccc;}
7 | #errorpage .errorsug{margin: 12px auto 62px;text-align: left;display: inline-block;*display: inline;}
8 | #errorpage .errorsug p{font-size: 14px;padding-top: 6px;text-indent: 15px;}
9 | #errorpage .bt a{background: #fe3a3b;padding: 9px 46px 11px;*padding: 7px 24px 9px;color: #fff;border: 0;font-size: 14px;}
10 |
11 | #errorpage .tfans_error .tfans{float: left;}
12 | #errorpage .tfans_error .errortans{margin: 0;text-align: left;float: left;z-index: 5;height: 300px;position: relative;padding: 80px 0 0 24px;}
13 | #errorpage .tfans_error .errortans .ter{position: absolute; left: 155px; top: 10px; z-index: 3; }
14 | #errorpage .tfans_error .errortans p{font-weight: normal;z-index: 10;position: relative;}
15 | #errorpage .tfans_error .errortans p b{font-size: 38px; }
16 | #errorpage .tfans_error .errortans div{margin-top: 30px; }
17 | #errorpage .tfans_error .errortans div button{font-size: 17px; padding: 3px 42px 5px; border-radius: 3px; }
18 |
19 | #errorpage .logo{display: inline-block;float: left;height:303px; width:256px;background: url(../img/tfans.jpg);}
20 | #errorpage .info{display: inline-block;float: left;position: relative;}
21 | #errorpage .e404{display: inline-block;position:absolute;top: -60px;left: 145px;;height:164px; width:150px;background: url(../img/404.jpg);}
22 | #errorpage .lh{height:90px;}
23 | #errorpage .err{font-size: 36px;}
24 |
25 |
26 | /*右侧菜单*/
27 | .left_floating{ position:fixed; _position:absolute;right:15px;_right:10px;z-index:9999; bottom:200px;}
28 | .left_floating a:hover{ text-decoration:none;}
29 | .left_floating ul{ /* background: #6a6a6c; */ margin:0px; padding:0px;}
30 | .left_floating ul li{ text-align:center; width: 45px; height: 45px; position: relative; margin-bottom: 1px;}
31 | .left_floating .floating_div{width:45px; height:45px; overflow:hidden;}
32 | .left_floating .floating_div .iconfont{ width:45px; height:45px; font-size:20px; display:inline-block; text-align:center; line-height:45px;}
33 | .left_floating .floating_a {color:#dbdbdb;display: block;position: absolute;right: 0;}
34 | a.floating_a:hover {width: 105px;background: #ff3a3b;color:#fff; text-decoration:none;}
35 | .left_floating .floating_div:hover{ color:#fff;width: 105px; text-align:left;}
36 | .left_floating .floating_div .floating_name{ color:#fff; font-size:16px;}
37 | .floating_top,.floating_shop{color:#dbdbdb;}
38 | .floating_top .floating_ree,.floating_shop .floating_ree{ /* border-bottom:1px solid #fff; */width:45px; height:45px; overflow:hidden; line-height:45px; position:relative; font-size:20px;}
39 | .floating_top .floating_ree .returntop{font-size:20px;}
40 | .floating_shop .floating_ree .iconfont{ font-size:25px;}
41 | .floating_goin .floating_ree{ line-height:58px;}
42 | .floating_shop .floating_ree .floating_sp{font-size:25px;}
43 | .floating_shop .floating_ree .floating_bak{ background:url(../images/bg_mini.png); width:20px; height:24px; text-align:center; position:absolute; top:2px; color:#fff; font-size:12px; left:11px; line-height:20px;}
44 | .floating_shop .floating_ree .floating_bac{ background:url(../images/bg_mini.png); width:20px; height:24px; text-align:center; position:absolute; top:2px; color:#fff; font-size:12px; left:22px; line-height:20px;}
45 | .left_floating ul li a{display:block;background: #6a6a6c;}
46 | .left_floating ul li a:hover{background: #333;}
47 |
48 | .floating_goin .floating_ree #qiao-icon-wrap{position: absolute;top: 0;left: 0;}
49 | .floating_goin .floating_ree #qiao-icon-wrap .qiao-icon-group{width: 45px !important;height: 45px !important;background: transparent !important;}
50 | .floating_goin .floating_ree #qiao-icon-wrap .qiao-mess-container .qiao-mess-foot-send-btn{border: 1px solid #FF3536 !important;background: #FF3536 !important;}
51 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/user/myDiscussPost.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #EEEEEE;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | width: 1000px;
7 | }
8 |
9 | .ui.footer.segment {
10 | margin: 5em 0em 0em;
11 | padding: 5em 0em;
12 | }
13 |
14 | .second-footer {
15 | height: 100px;
16 | }
17 | .ui.pagination.menu {
18 | margin-left: 4em;
19 | margin-top: 2em;
20 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/user/myExam.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #EEEEEE;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | width: 1050px;
7 | }
8 |
9 | .ui.footer.segment {
10 | margin: 5em 0em 0em;
11 | padding: 5em 0em;
12 | }
13 |
14 | .second-footer {
15 | height: 100px;
16 | }
17 | .paper {
18 |
19 | }
20 | .paper-title {
21 | text-align: center;
22 | }
23 | .paper-type {
24 | background-color: #9ED5C9;
25 | font-weight: bolder;
26 | color: #FFFFFF;
27 | text-align: center;
28 | }
29 | .paper-finish-time {
30 | font-size: 10px;
31 | }
32 | .ui.pagination.menu {
33 | margin-left: 4em;
34 | margin-top: 2em;
35 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/user/password.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #EEEEEE;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | width: 1000px;
7 | }
8 |
9 | .ui.footer.segment {
10 | margin: 5em 0em 0em;
11 | padding: 5em 0em;
12 | }
13 |
14 | .second-footer {
15 | height: 100px;
16 | }
--------------------------------------------------------------------------------
/src/main/resources/static/css/user/profile.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #EEEEEE;
3 | }
4 | .main.container {
5 | margin-top: 7em;
6 | width: 1000px;
7 | }
8 |
9 | .ui.footer.segment {
10 | margin: 5em 0em 0em;
11 | padding: 5em 0em;
12 | }
13 |
14 | .second-footer {
15 | height: 100px;
16 | }
--------------------------------------------------------------------------------
/src/main/resources/static/img/404.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/404.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/bg.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/logo.png
--------------------------------------------------------------------------------
/src/main/resources/static/img/logo_flat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/logo_flat.png
--------------------------------------------------------------------------------
/src/main/resources/static/img/manage-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/manage-logo.png
--------------------------------------------------------------------------------
/src/main/resources/static/img/tfans.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gdufeZLYL/springboot-penguin/af2ac197fabae6c056628df8021f59b17848c7ee/src/main/resources/static/img/tfans.jpg
--------------------------------------------------------------------------------
/src/main/resources/static/js/adminApp.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var app = {
5 | data:{
6 | nowTime: null
7 | },
8 | // 封装相关的ajax的url
9 | URL: {
10 | now: function () {
11 | return "/time/now";
12 | },
13 | checkLoginUrl: function () {
14 | return "/account/api/login";
15 | },
16 | logoutUrl: function () {
17 | return "/account/logout";
18 | },
19 | homeUrl: function () {
20 | return "/";
21 | },
22 | problemsetUrl: function () {
23 | return "/problemset/list";
24 | },
25 | updateAccountUrl: function () {
26 | return "/account/api/updateAccount";
27 | },
28 | updatePasswordUrl: function () {
29 | return "/account/api/updatePassword";
30 | },
31 | },
32 | /**
33 | * 全局初始化:服务器时间获取,登录功能,退出登录
34 | */
35 | init: function () {
36 | /**
37 | * 退出登录
38 | */
39 | $('#logout').click(function (e) {
40 | window.location.href = app.URL.logoutUrl();
41 | });
42 | },
43 | convertTime: function (localDateTime) {
44 | var year = localDateTime.year;
45 | var monthValue = localDateTime.monthValue;
46 | var dayOfMonth = localDateTime.dayOfMonth;
47 | var hour = localDateTime.hour;
48 | var minute = localDateTime.minute;
49 | var second = localDateTime.second;
50 | return year + "-" + monthValue + "-" + dayOfMonth + " " + hour + ":" + minute + ":" + second;
51 | },
52 | toTimeStamp: function (localDateTime) {
53 | var currTime = localDateTime.year + "-" + localDateTime.monthValue
54 | + "-" + localDateTime.dayOfMonth + " " + localDateTime.hour
55 | + ":" + localDateTime.minute + ":" + localDateTime.second;
56 | //console.log("currTime = " + currTime);
57 | //console.log("new Date(currTime).valueOf() = " + new Date(currTime).valueOf());
58 | return new Date(currTime).valueOf();
59 | },
60 | /**
61 | * 时间戳转化为年 月 日 时 分 秒
62 | * number: 传入时间戳
63 | * format:返回格式,支持自定义,但参数必须与formateArr里保持一致
64 | */
65 | formatTime: function (number, format) {
66 |
67 | var formateArr = ['Y', 'M', 'D', 'h', 'm', 's'];
68 | var returnArr = [];
69 |
70 | var date = new Date(number);
71 | returnArr.push(date.getFullYear());
72 | returnArr.push(app.formatNumber(date.getMonth() + 1));
73 | returnArr.push(app.formatNumber(date.getDate()));
74 |
75 | returnArr.push(app.formatNumber(date.getHours()));
76 | returnArr.push(app.formatNumber(date.getMinutes()));
77 | returnArr.push(app.formatNumber(date.getSeconds()));
78 |
79 | for (var i in returnArr) {
80 | format = format.replace(formateArr[i], returnArr[i]);
81 | }
82 | return format;
83 | },
84 | formatNumber: function (n) {
85 | n = n.toString();
86 | return n[1] ? n : '0' + n;
87 | },
88 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Simplified Chinese translation for bootstrap-datetimepicker
3 | * Yuan Cheung
4 | */
5 | ;(function($){
6 | $.fn.datetimepicker.dates['zh-CN'] = {
7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
10 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
11 | monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
12 | today: "今天",
13 | suffix: [],
14 | meridiem: ["上午", "下午"]
15 | };
16 | }(jQuery));
17 |
--------------------------------------------------------------------------------
/src/main/resources/static/js/contest/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var contestIndexPage = {
5 | data:{
6 | pageNum: 0,
7 | pageSize: 0,
8 | totalPageNum: 0,
9 | totalPageSize: 0,
10 | contests: [],
11 | },
12 | init: function (pageNum, pageSize, totalPageNum, totalPageSize, contests) {
13 | contestIndexPage.data.pageNum = pageNum;
14 | contestIndexPage.data.pageSize = pageSize;
15 | contestIndexPage.data.totalPageNum = totalPageNum;
16 | contestIndexPage.data.totalPageSize = totalPageSize;
17 | contestIndexPage.data.contests = contests;
18 | //分页初始化
19 | contestIndexPage.subPageMenuInit();
20 |
21 | //考试倒计时
22 | var killTime = new Date();
23 | //killTime.setDate(killTime.getDate()+5);
24 | for (var i = 0; i < contests.length; i++) {
25 | if (contests[i].state == 0) {
26 | killTime = new Date(contests[i].startTime);
27 | } else {
28 | break;
29 | }
30 | }
31 | $("#contest-time-countdown").countdown(killTime, function (event) {
32 | // 事件格式
33 | var format = event.strftime("考试倒计时: %D天 %H时 %M分 %S秒");
34 | console.log(format);
35 | $("#contest-time-countdown").html(format);
36 | }).on('finish.countdown', function () {
37 | // 事件完成后回调事件,获取秒杀地址,控制业务逻辑
38 | window.location.reload();
39 | });
40 | },
41 | firstPage: function () {
42 | window.location.href = app.URL.contestIndexUrl() + '?page=1';
43 | },
44 | prevPage: function () {
45 | window.location.href = app.URL.contestIndexUrl() + '?page=' + (pageNum-1);
46 | },
47 | targetPage: function (page) {
48 | window.location.href = app.URL.contestIndexUrl() + '?page=' + page;
49 | },
50 | nextPage: function () {
51 | window.location.href = app.URL.contestIndexUrl() + '?page=' + (pageNum+1);
52 | },
53 | lastPage: function () {
54 | window.location.href = app.URL.contestIndexUrl() + '?page=' + contestIndexPage.data.totalPageNum;
55 | },
56 | subPageMenuInit: function(){
57 | var subPageStr = '';
58 | if (contestIndexPage.data.pageNum == 1) {
59 | subPageStr += '首页';
60 | subPageStr += '上一页';
61 | } else {
62 | subPageStr += '首页';
63 | subPageStr += '上一页';
64 | }
65 | var startPage = (contestIndexPage.data.pageNum-4 > 0 ? contestIndexPage.data.pageNum-4 : 1);
66 | var endPage = (startPage+7 > contestIndexPage.data.totalPageNum ? contestIndexPage.data.totalPageNum : startPage+7);
67 | console.log('startPage = ' + startPage);
68 | console.log('endPage = ' + endPage);
69 | console.log('pageNum = ' + contestIndexPage.data.pageNum);
70 | console.log('totalPageNum = ' + contestIndexPage.data.totalPageNum);
71 | for (var i = startPage; i <= endPage; i++) {
72 | if (i == contestIndexPage.data.pageNum) {
73 | subPageStr += ''+i+'';
74 | } else {
75 | subPageStr += ''+i+''
76 | }
77 | }
78 | if (contestIndexPage.data.pageNum == contestIndexPage.data.totalPageNum) {
79 | subPageStr += '下一页';
80 | subPageStr += '末页';
81 | } else {
82 | subPageStr += '下一页';
83 | subPageStr += '末页';
84 | }
85 | $('#subPageMenu').html(subPageStr);
86 | },
87 | startToContestAction: function (contestId) {
88 | window.location.href = app.URL.contestDetailUrl()+contestId;
89 | },
90 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/discuss/discuss.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var discussPage = {
5 | data:{
6 | pageNum: 0,
7 | pageSize: 0,
8 | totalPageNum: 0,
9 | totalPageSize: 0,
10 | posts: [],
11 | },
12 | init: function (pageNum, pageSize, totalPageNum, totalPageSize, posts) {
13 | discussPage.data.pageNum = pageNum;
14 | discussPage.data.pageSize = pageSize;
15 | discussPage.data.totalPageNum = totalPageNum;
16 | discussPage.data.totalPageSize = totalPageSize;
17 | discussPage.data.posts = posts;
18 | //分页初始化
19 | discussPage.subPageMenuInit();
20 | },
21 | firstPage: function () {
22 | window.location.href = app.URL.discussUrl() + '?page=1';
23 | },
24 | prevPage: function () {
25 | window.location.href = app.URL.discussUrl() + '?page=' + (pageNum-1);
26 | },
27 | targetPage: function (page) {
28 | window.location.href = app.URL.discussUrl() + '?page=' + page;
29 | },
30 | nextPage: function () {
31 | window.location.href = app.URL.discussUrl() + '?page=' + (pageNum+1);
32 | },
33 | lastPage: function () {
34 | window.location.href = app.URL.discussUrl() + '?page=' + discussPage.data.totalPageNum;
35 | },
36 | subPageMenuInit: function(){
37 | var subPageStr = '';
38 | if (discussPage.data.pageNum == 1) {
39 | subPageStr += '首页';
40 | subPageStr += '上一页';
41 | } else {
42 | subPageStr += '首页';
43 | subPageStr += '上一页';
44 | }
45 | var startPage = (discussPage.data.pageNum-4 > 0 ? discussPage.data.pageNum-4 : 1);
46 | var endPage = (startPage+7 > discussPage.data.totalPageNum ? discussPage.data.totalPageNum : startPage+7);
47 | console.log('startPage = ' + startPage);
48 | console.log('endPage = ' + endPage);
49 | console.log('pageNum = ' + discussPage.data.pageNum);
50 | console.log('totalPageNum = ' + discussPage.data.totalPageNum);
51 | for (var i = startPage; i <= endPage; i++) {
52 | if (i == discussPage.data.pageNum) {
53 | subPageStr += ''+i+'';
54 | } else {
55 | subPageStr += ''+i+''
56 | }
57 | }
58 | if (discussPage.data.pageNum == discussPage.data.totalPageNum) {
59 | subPageStr += '下一页';
60 | subPageStr += '末页';
61 | } else {
62 | subPageStr += '下一页';
63 | subPageStr += '末页';
64 | }
65 | $('#subPageMenu').html(subPageStr);
66 | },
67 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/discuss/discussDetail.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var discussDetailPage = {
5 | data:{
6 | post: null,
7 | comments: [],
8 | userId: 0,
9 | },
10 | init: function (post, comments, userId) {
11 | discussDetailPage.data.post = post;
12 | discussDetailPage.data.comments = comments;
13 | discussDetailPage.data.userId = userId;
14 |
15 | $('#postContent').html(post.htmlContent);
16 |
17 | /**
18 | * 回复模态框关闭按钮触发
19 | */
20 | $('#cancelReplyBtn').click(function (e) {
21 | $('#replyModal').modal('hide');
22 | });
23 | /**
24 | * 回复模态框登录按钮触发
25 | */
26 | $('#confirmReplyBtn').click(function (e) {
27 | discussDetailPage.addReplyAction();
28 | });
29 | },
30 | addCommentsAction: function () {
31 | var userId = discussDetailPage.data.userId;
32 | var post = discussDetailPage.data.post;
33 | var content = $('#commentContent').val();
34 |
35 | $.ajax({
36 | url : app.URL.addCommentUrl(),
37 | type : "POST",
38 | dataType: "json",
39 | contentType : "application/json;charset=UTF-8",
40 |
41 | data : JSON.stringify({
42 | userId: userId,
43 | postId: post.id,
44 | content: content,
45 | }),
46 | success:function(result) {
47 | if (result && result['success']) {
48 | // 验证通过 刷新页面
49 | window.location.reload();
50 | } else {
51 | console.log(result.message);
52 | }
53 | },
54 | error:function(result){
55 | console.log(result.message);
56 | }
57 | });
58 | },
59 | /**
60 | * 回复模态框显示
61 | */
62 | showReplyModal: function(index, atuserId) {
63 | var comments = discussDetailPage.data.comments;
64 | $('#replyCommentId').val(comments[index].id);
65 | $('#replyAtuserId').val(atuserId);
66 | $('#replyModal').modal('show');
67 | },
68 | addReplyAction: function () {
69 | var userId = discussDetailPage.data.userId;
70 | var post = discussDetailPage.data.post;
71 | var commentId = $('#replyCommentId').val();
72 | var atuserId = $('#replyAtuserId').val();
73 | var content = $('#replyContent').val();
74 |
75 | $.ajax({
76 | url : app.URL.addReplyUrl(),
77 | type : "POST",
78 | dataType: "json",
79 | contentType : "application/json;charset=UTF-8",
80 |
81 | data : JSON.stringify({
82 | userId: userId,
83 | atuserId: atuserId,
84 | postId: post.id,
85 | commentId: commentId,
86 | content: content,
87 | }),
88 | success:function(result) {
89 | if (result && result['success']) {
90 | // 验证通过 刷新页面
91 | window.location.reload();
92 | } else {
93 | console.log(result.message);
94 | }
95 | },
96 | error:function(result){
97 | console.log(result.message);
98 | }
99 | });
100 | },
101 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/discuss/postDiscuss.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var postDiscussPage = {
5 | data:{
6 | authorId: 0,
7 | E: null,
8 | editor: null,
9 | },
10 | init: function (authorId) {
11 | postDiscussPage.data.authorId = authorId;
12 |
13 | $('#postDiscussSubmitButton').click(function (e) {
14 | postDiscussPage.postDiscuss();
15 | });
16 | /**
17 | TODO::代码规范,文本编辑器
18 | */
19 | postDiscussPage.data.E = window.wangEditor;
20 | postDiscussPage.data.editor = new postDiscussPage.data.E('#editor'); // 或者 var editor = new E( document.getElementById('editor') )
21 | postDiscussPage.data.editor.create();
22 | },
23 | postDiscuss: function () {
24 | var authorId = postDiscussPage.data.authorId;
25 | var editor = postDiscussPage.data.editor;
26 | var title = $('#postTitle').val();
27 | //alert(editor.txt.text());
28 | $.ajax({
29 | url : app.URL.addPostUrl(),
30 | type : "POST",
31 | dataType: "json",
32 | contentType : "application/json;charset=UTF-8",
33 |
34 | data : JSON.stringify({
35 | authorId: authorId,
36 | title: title,
37 | htmlContent: editor.txt.html(),
38 | textContent: editor.txt.text(),
39 | }),
40 | success:function(result) {
41 | if (result && result['success']) {
42 | // 验证通过 刷新页面
43 | //window.location.reload();
44 | window.location.href = app.URL.discussUrl();
45 | } else {
46 | console.log(result.message);
47 | }
48 | },
49 | error:function(result){
50 | console.log(result.message);
51 | }
52 | });
53 | },
54 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/home.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块JavaScript
3 | */
4 | var home = {
5 | data:{
6 |
7 | },
8 | init: function () {
9 |
10 | },
11 | };
--------------------------------------------------------------------------------
/src/main/resources/static/js/manage/manage-commentBoard.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 模块化JavaScript
3 | **/
4 | var manageCommentBoardPage = {
5 | data:{
6 | pageNum: 0,
7 | pageSize: 0,
8 | totalPageNum: 0,
9 | totalPageSize: 0,
10 | comments: [],
11 | },
12 | init: function (pageNum, pageSize, totalPageNum, totalPageSize, comments) {
13 | manageCommentBoardPage.data.pageNum = pageNum;
14 | manageCommentBoardPage.data.pageSize = pageSize;
15 | manageCommentBoardPage.data.totalPageNum = totalPageNum;
16 | manageCommentBoardPage.data.totalPageSize = totalPageSize;
17 | manageCommentBoardPage.data.comments = comments;
18 | //分页初始化
19 | manageCommentBoardPage.subPageMenuInit();
20 | },
21 | firstPage: function () {
22 | window.location.href = app.URL.manageCommentListUrl() + '?page=1';
23 | },
24 | prevPage: function () {
25 | window.location.href = app.URL.manageCommentListUrl() + '?page=' + (pageNum-1);
26 | },
27 | targetPage: function (page) {
28 | window.location.href = app.URL.manageCommentListUrl() + '?page=' + page;
29 | },
30 | nextPage: function () {
31 | window.location.href = app.URL.manageCommentListUrl() + '?page=' + (pageNum+1);
32 | },
33 | lastPage: function () {
34 | window.location.href = app.URL.manageCommentListUrl() + '?page=' + manageCommentBoardPage.data.totalPageNum;
35 | },
36 | subPageMenuInit: function(){
37 | var subPageStr = '