部分数据接口模块,完善项目结构
This commit is contained in:
parent
f0aa52f98b
commit
ddfdee6405
440
README.md
440
README.md
|
@ -330,15 +330,15 @@ contest_score表 rating赛制中获得的分数更改记录表
|
|||
contest_record表 比赛记录表
|
||||
|
||||
| 列名 | 实体属性类型 | 键 | 备注 |
|
||||
| ------------ | ------------ | ---- | -------------------------------------- |
|
||||
| ------------ | ------------ | ---- | ------------------------------------------------------------ |
|
||||
| id | long | 主键 | auto_increment |
|
||||
| cid | int | 外键 | 比赛id |
|
||||
| uid | String | 外键 | 用户id |
|
||||
| pid | int | | 题目id |
|
||||
| cpid | int | 外键 | 比赛中的题目顺序id |
|
||||
| submit_id | int | 外键 | 提交id,用于可重判 |
|
||||
| status | String | | 提交结果,0不加罚时,-1加罚时,1表示AC |
|
||||
| time | datetime | | 提交时间 |
|
||||
| status | String | | 提交结果,0表示未AC通过不罚时,1表示AC通过,-1为未AC通过算罚时 |
|
||||
| time | int | | 提交时间,为提交时间减去比赛时间,时间戳 |
|
||||
| gmt_create | datetime | | 创建时间 |
|
||||
| gmt_modified | datetime | | 修改时间 |
|
||||
|
||||
|
@ -409,6 +409,8 @@ comment_tag表 讨论标签表
|
|||
|
||||
# 四、后端数据接口
|
||||
|
||||
|
||||
|
||||
> 后端返回数据的状态码说明
|
||||
|
||||
```
|
||||
|
@ -420,17 +422,19 @@ STATUS_ACCESS_DENIED = 401;// 无权限
|
|||
STATUS_METHOD_NOT_ALLOWED = 405; // 不支持当前请求方法
|
||||
```
|
||||
|
||||
## 1. 注册接口
|
||||
### (一)、用户模块
|
||||
|
||||
### 1.1 请求地址
|
||||
#### 1. 注册接口
|
||||
|
||||
> /register
|
||||
##### 1.1 请求地址
|
||||
|
||||
### 1.2 请求方式
|
||||
> /api/register
|
||||
|
||||
##### 1.2 请求方式
|
||||
|
||||
> POST
|
||||
|
||||
### 1.3 请求参数
|
||||
##### 1.3 请求参数
|
||||
|
||||
> 格式:json
|
||||
|
||||
|
@ -443,27 +447,64 @@ STATUS_METHOD_NOT_ALLOWED = 405; // 不支持当前请求方法
|
|||
| number | String | 学号 | 不能 |
|
||||
| code | String | 验证码 | 不能 |
|
||||
|
||||
### 1.4 返回数据
|
||||
##### 1.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 后台查询数据存储于这 |
|
||||
| data | json | null |
|
||||
| msg | String | 消息 |
|
||||
|
||||
## 2. 注册接口
|
||||
#### 2. 验证码接口
|
||||
|
||||
### 2.1 请求地址
|
||||
##### 2.1 请求地址
|
||||
|
||||
> /login
|
||||
> /api/get-register-code
|
||||
|
||||
### 2.2 请求方式
|
||||
##### 2.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 2.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| -------- | ------------ | ---- | -------- |
|
||||
| username | String | 账号 | 不能 |
|
||||
| email | String | 邮箱 | 不能 |
|
||||
|
||||
##### 2.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ----------------------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | {“username”:...,"email":...,"expire":...} |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| -------- | ------------ | ------------------- |
|
||||
| username | String | 账号 |
|
||||
| email | String | 邮箱 |
|
||||
| expire | int | 验证码有效时长(s) |
|
||||
|
||||
#### 3. 登录接口
|
||||
|
||||
##### 3.1 请求地址
|
||||
|
||||
> /api/login
|
||||
|
||||
##### 3.2 请求方式
|
||||
|
||||
> POST
|
||||
|
||||
### 2.3 请求参数
|
||||
##### 3.3 请求参数
|
||||
|
||||
> 格式:json
|
||||
|
||||
|
@ -472,18 +513,16 @@ STATUS_METHOD_NOT_ALLOWED = 405; // 不支持当前请求方法
|
|||
| username | String | 账号 | 不能 |
|
||||
| password | String | 密码 | 不能 |
|
||||
|
||||
### 2.4 返回数据
|
||||
##### 3.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| ------ | ------------ | ------------------------------------------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 后台查询数据存储于这 |
|
||||
| data | json | {"uid":....,"username":...,"nickname":...,"avatar":...,"email":...} |
|
||||
| msg | String | 消息 |
|
||||
|
||||
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
|
@ -493,3 +532,364 @@ data数据
|
|||
| nickname | String | 昵称 |
|
||||
| avatar | String | 头像地址 |
|
||||
| email | String | 邮箱 |
|
||||
|
||||
#### 4. 登出接口
|
||||
|
||||
> 注:需要登录权限认证,否则报401
|
||||
|
||||
##### 4.1 请求地址
|
||||
|
||||
> /api/logout
|
||||
|
||||
##### 4.2 请求方式
|
||||
|
||||
> POST
|
||||
|
||||
##### 4.3 请求参数
|
||||
|
||||
> 无
|
||||
|
||||
##### 4.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | null |
|
||||
| msg | String | 消息 |
|
||||
|
||||
### (二)、题目模块
|
||||
|
||||
#### 1. 题目列表接口
|
||||
|
||||
##### 1.1 请求地址
|
||||
|
||||
> /api/get-problem-list
|
||||
|
||||
##### 1.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 1.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ----------- | ------------ | ---------------------- | -------- |
|
||||
| limit | String | 每页的题目数 | 能 |
|
||||
| currentPage | int | 页数 | 能 |
|
||||
| searchPid | long | 想搜索题目的id | 能 |
|
||||
| searchTitle | String | 想搜索的题目模糊匹配词 | 能 |
|
||||
|
||||
##### 1.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | --------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 题目信息列表(ProblemVo类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------------------------- | ------------ | -------------------- |
|
||||
| id | long | 题目id |
|
||||
| title | String | 题目标题 |
|
||||
| author | String | 题目作者 |
|
||||
| source | String | 题目来源 |
|
||||
| total | String | 题目总提交数 |
|
||||
| ac/mle/tle/re/pe/ce/wa/se | int | 题目各类提交结果数量 |
|
||||
| score | int | 题目分数,默认为100 |
|
||||
|
||||
|
||||
|
||||
#### 2. 题目详情接口
|
||||
|
||||
##### 2.1 请求地址
|
||||
|
||||
> /api/get-problem-info
|
||||
|
||||
##### 2.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 2.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| pid | long | 题目id | 不能 |
|
||||
|
||||
##### 2.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | -------------------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 题目详细信息(Problem类或看problem表) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
|
||||
|
||||
### (三)、比赛模块
|
||||
|
||||
#### 1. 比赛列表接口
|
||||
|
||||
##### 1.1 请求地址
|
||||
|
||||
> /api/get-contest-list
|
||||
|
||||
##### 1.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 1.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ----------- | ------------ | ------------ | -------- |
|
||||
| limit | String | 每页的比赛数 | 能 |
|
||||
| currentPage | int | 页数 | 能 |
|
||||
|
||||
##### 1.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 比赛列表(ContestVo类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
|
||||
|
||||
#### 2. 比赛详情接口
|
||||
|
||||
##### 2.1 请求地址
|
||||
|
||||
> /api/get-contest-info
|
||||
|
||||
##### 2.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 2.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| cid | long | 比赛id | 不能 |
|
||||
|
||||
##### 2.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | --------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 比赛详细信息(ContestVo类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
|
||||
|
||||
#### 3. 比赛题目接口
|
||||
|
||||
##### 3.1 请求地址
|
||||
|
||||
> /api/get-contest-problem
|
||||
|
||||
##### 3.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 3.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| cid | long | 比赛id | 不能 |
|
||||
|
||||
##### 3.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | -------------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 题目信息列表(ContestProblem类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ----------- | ------------ | ---------------------------------- |
|
||||
| id | long | contest_problem表主键id |
|
||||
| cid | long | 比赛id |
|
||||
| pid | long | 题目id |
|
||||
| cpName | String | 该题目在比赛中的标题,默认为原名字 |
|
||||
| cpNum | String | 该题目在比赛中的顺序id |
|
||||
| gmtCreate | date | 数据创建时间 |
|
||||
| gmtModified | date | 数据最近一次修改时间 |
|
||||
|
||||
#### 4. 比赛排名接口
|
||||
|
||||
##### 4.1 请求地址
|
||||
|
||||
> /api/get-contest-rank
|
||||
|
||||
##### 4.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 4.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| cid | long | 比赛id | 不能 |
|
||||
|
||||
##### 4.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | --------------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 题目信息列表(ContestRecordVo类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| -------- | ------------ | ------------------------------------------------------------ |
|
||||
| uid | String | 用户id |
|
||||
| cid | long | 比赛id |
|
||||
| pid | long | 题目id |
|
||||
| cpid | long | 比赛中的题目顺序id |
|
||||
| username | String | 用户名 |
|
||||
| nickname | String | 昵称 |
|
||||
| submitId | long | 提交id |
|
||||
| status | int | 提交结果,0表示未AC通过不罚时,1表示AC通过,-1为未AC通过算罚时 |
|
||||
| time | date | 提交时间,为提交时间减去比赛时间,时间戳 |
|
||||
|
||||
#### 5. 比赛通知接口
|
||||
|
||||
##### 5.1 请求地址
|
||||
|
||||
> /api/get-contest-announcement
|
||||
|
||||
##### 5.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 5.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| cid | long | 比赛id | 不能 |
|
||||
|
||||
##### 5.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------------------- |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 比赛通知列表(ContestAnnouncement类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------- | ------------ | -------- |
|
||||
| cid | long | 比赛者id |
|
||||
| title | String | 通知标题 |
|
||||
| uid | String | 发布者id |
|
||||
| content | String | 通知内容 |
|
||||
|
||||
#### 6. 比赛通知接口
|
||||
|
||||
##### 6.1 请求地址
|
||||
|
||||
> /api/to-register-contest
|
||||
|
||||
##### 6.2 请求方式
|
||||
|
||||
> POST
|
||||
|
||||
##### 6.3 请求参数
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ------ | ------------ | ------ | -------- |
|
||||
| cid | long | 比赛id | 不能 |
|
||||
| uid | String | 用户id | 不能 |
|
||||
|
||||
##### 6.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | null |
|
||||
| msg | String | 消息 |
|
||||
|
||||
|
||||
|
||||
### (四)、排名模块
|
||||
|
||||
#### 1. 排名列表接口
|
||||
|
||||
##### 1.1 请求地址
|
||||
|
||||
> /api/get-rank-list
|
||||
|
||||
##### 1.2 请求方式
|
||||
|
||||
> GET
|
||||
|
||||
##### 1.3 请求参数
|
||||
|
||||
> 格式:x-www-form-urlencoded
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 | 能否为空 |
|
||||
| ----------- | ------------ | ------------ | -------- |
|
||||
| limit | String | 每页的用户量 | 能 |
|
||||
| currentPage | int | 页数 | 能 |
|
||||
|
||||
##### 1.4 返回数据
|
||||
|
||||
> 格式:json
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ------ | ------------ | ------------------------ |
|
||||
| status | int | 状态码,详情见状态码说明 |
|
||||
| data | json | 排名数据列表(RankVo类) |
|
||||
| msg | String | 消息 |
|
||||
|
||||
data数据
|
||||
|
||||
| 字段名 | 实体属性类型 | 说明 |
|
||||
| ----------- | ------------ | ------------ |
|
||||
| uid | String | 用户id |
|
||||
| username | String | 用户名 |
|
||||
| nickname | String | 消息 |
|
||||
| number | String | 学号 |
|
||||
| total | int | 总做题数 |
|
||||
| submissions | int | 总提交数 |
|
||||
| ac | int | 总通过数 |
|
||||
| Rating | int | cf得分 |
|
||||
| score | int | io制比赛得分 |
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
|
@ -0,0 +1,10 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<Languages>
|
||||
<language minSize="65" name="Java" />
|
||||
</Languages>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,76 +0,0 @@
|
|||
package top.hcode.common.exception;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.ShiroException;
|
||||
import org.apache.shiro.authc.ExpiredCredentialsException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import top.hcode.common.result.CommonResult;
|
||||
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
/**
|
||||
* 处理shiro的异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||
@ExceptionHandler(ShiroException.class)
|
||||
public CommonResult handle401(ShiroException e) {
|
||||
return CommonResult.errorResponse( e.getCause().toString(),CommonResult.STATUS_ACCESS_DENIED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理Assert的异常 断言的异常!
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(value = IllegalArgumentException.class)
|
||||
public CommonResult handler(IllegalArgumentException e) throws IOException {
|
||||
log.error("Assert异常:-------------->{}",e.getMessage());
|
||||
return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Validated 校验错误异常处理
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
public CommonResult handler(MethodArgumentNotValidException e) throws IOException {
|
||||
log.error("实体校验异常:-------------->",e);
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
ObjectError objectError = bindingResult.getAllErrors().stream().findFirst().get();
|
||||
return CommonResult.errorResponse(objectError.getDefaultMessage(),CommonResult.STATUS_FAIL);
|
||||
}
|
||||
/**
|
||||
* 处理运行时出现的异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(value = RuntimeException.class)
|
||||
public CommonResult handler(RuntimeException e) throws IOException {
|
||||
log.error("运行时异常:-------------->",e);
|
||||
return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理邮件发送出现的异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(value = MessagingException.class)
|
||||
public CommonResult handler(MessagingException e) throws Exception {
|
||||
log.error("邮箱系统异常:-------------->",e);
|
||||
return CommonResult.errorResponse(e.getMessage(),CommonResult.STATUS_ERROR);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package top.hcode.dao;
|
||||
|
||||
import top.hcode.entity.Contest;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
public interface ContestMapper extends BaseMapper<Contest> {
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package top.hcode.dao;
|
||||
|
||||
import top.hcode.entity.ContestRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
public interface ContestRecordMapper extends BaseMapper<ContestRecord> {
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package top.hcode.dao;
|
||||
|
||||
import top.hcode.entity.Problem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
public interface ProblemMapper extends BaseMapper<Problem> {
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestRecordMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ProblemMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.UserRecordMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,9 +1,7 @@
|
|||
package top.hcode;
|
||||
package top.hcode.hoj;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
|
@ -0,0 +1,190 @@
|
|||
package top.hcode.hoj.common.exception;
|
||||
|
||||
|
||||
import com.google.protobuf.ServiceException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.ShiroException;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import top.hcode.hoj.common.result.CommonResult;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.ValidationException;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
/**
|
||||
* 401 -UnAuthorized 处理shiro的异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
||||
@ExceptionHandler(ShiroException.class)
|
||||
public CommonResult handle401(ShiroException e) {
|
||||
log.error("shiro异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("对不起,您无权限进行此操作,请先登录进行授权认证", CommonResult.STATUS_ACCESS_DENIED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 处理Assert的异常 断言的异常!
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(value = IllegalArgumentException.class)
|
||||
public CommonResult handler(IllegalArgumentException e) throws IOException {
|
||||
log.error("Assert异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse(e.getMessage(), CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 400 - Bad Request @Validated 校验错误异常处理
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(value = MethodArgumentNotValidException.class)
|
||||
public CommonResult handler(MethodArgumentNotValidException e) throws IOException {
|
||||
log.error("实体校验异常-------------->{}", e);
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
ObjectError objectError = bindingResult.getAllErrors().stream().findFirst().get();
|
||||
return CommonResult.errorResponse(objectError.getDefaultMessage(), CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 处理缺少请求参数
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
public CommonResult handleMissingServletRequestParameterException(
|
||||
MissingServletRequestParameterException e) {
|
||||
log.error("缺少请求参数-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("缺少必要的请求参数:"+e.getMessage(),CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 参数解析失败
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
public CommonResult handleHttpMessageNotReadableException(
|
||||
HttpMessageNotReadableException e) {
|
||||
log.error("参数解析失败-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("解析参数格式失败",CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 参数绑定失败
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(BindException.class)
|
||||
public CommonResult handleBindException(BindException e) {
|
||||
log.error("参数绑定失败-------------->{}", e);
|
||||
BindingResult result = e.getBindingResult();
|
||||
FieldError error = result.getFieldError();
|
||||
String field = error.getField();
|
||||
String code = error.getDefaultMessage();
|
||||
String message = String.format("%s:%s", field, code);
|
||||
return CommonResult.errorResponse("参数绑定失败",CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 参数验证失败
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(ConstraintViolationException.class)
|
||||
public CommonResult handleServiceException(ConstraintViolationException e) {
|
||||
log.error("参数验证失败-------------->{}", e.getMessage());
|
||||
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
|
||||
ConstraintViolation<?> violation = violations.iterator().next();
|
||||
String message = violation.getMessage();
|
||||
return CommonResult.errorResponse("[参数验证失败]parameter:" + message,CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 400 - Bad Request 实体校验失败
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ExceptionHandler(ValidationException.class)
|
||||
public CommonResult handleValidationException(ValidationException e) {
|
||||
log.error("实体校验失败-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("实体校验失败,请求参数不对",CommonResult.STATUS_FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 405 - Method Not Allowed 不支持当前请求方法
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public CommonResult handleHttpRequestMethodNotSupportedException(
|
||||
HttpRequestMethodNotSupportedException e) {
|
||||
log.error("不支持当前请求方法-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("不支持当前请求方法",405);
|
||||
}
|
||||
|
||||
/**
|
||||
* 415 - Unsupported Media Type 不支持当前媒体类型
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
|
||||
@ExceptionHandler(HttpMediaTypeNotSupportedException.class)
|
||||
public CommonResult handleHttpMediaTypeNotSupportedException(Exception e) {
|
||||
log.error("不支持当前媒体类型-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("不支持当前媒体类型",415);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 500 - Internal Server Error 处理邮件发送出现的异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(value = MessagingException.class)
|
||||
public CommonResult handler(MessagingException e) throws Exception {
|
||||
log.error("邮箱系统异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse(e.getMessage(), CommonResult.STATUS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 500 - Internal Server Error 业务逻辑异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(ServiceException.class)
|
||||
public CommonResult handleServiceException(ServiceException e) {
|
||||
log.error("业务逻辑异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("业务逻辑异常:" + e.getMessage(),CommonResult.STATUS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 500 - Internal Server Error 系统通用异常
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(Exception.class)
|
||||
public CommonResult handleException(Exception e) {
|
||||
log.error("系统通用异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("系统通用异常:" + e.getMessage(),CommonResult.STATUS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 500 - Internal Server Error 操作数据库出现异常:名称重复,外键关联
|
||||
*/
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ExceptionHandler(DataIntegrityViolationException.class)
|
||||
public CommonResult handleException(DataIntegrityViolationException e) {
|
||||
log.error("操作数据库出现异常-------------->{}", e.getMessage());
|
||||
return CommonResult.errorResponse("操作数据库出现异常:字段重复、有外键关联等",CommonResult.STATUS_ERROR);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.common.result;
|
||||
package top.hcode.hoj.common.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import java.io.Serializable;
|
|||
public class CommonResult implements Serializable {
|
||||
public final static Integer STATUS_SUCCESS = 200;
|
||||
public final static Integer STATUS_FAIL = 400;
|
||||
public final static Integer STATUS_NOT_FOUND = 404;
|
||||
public final static Integer STATUS_ERROR = 500;
|
||||
public final static Integer STATUS_ACCESS_DENIED = 401;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.config;
|
||||
package top.hcode.hoj.config;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.config;
|
||||
package top.hcode.hoj.config;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("top.hcode.dao")
|
||||
@MapperScan("top.hcode.hoj.dao")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.config;
|
||||
package top.hcode.hoj.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.config;
|
||||
package top.hcode.hoj.config;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
|
@ -22,8 +22,8 @@ import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreato
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import top.hcode.shiro.AccountRealm;
|
||||
import top.hcode.shiro.JwtFilter;
|
||||
import top.hcode.hoj.shiro.AccountRealm;
|
||||
import top.hcode.hoj.shiro.JwtFilter;
|
||||
|
||||
|
||||
import javax.servlet.Filter;
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.config;
|
||||
package top.hcode.hoj.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.controller;
|
||||
package top.hcode.hoj.controller;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
@ -12,18 +12,18 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.hcode.common.dto.LoginDto;
|
||||
import top.hcode.common.dto.RegisterDto;
|
||||
import top.hcode.common.result.CommonResult;
|
||||
import top.hcode.dao.UserRecordMapper;
|
||||
import top.hcode.dao.UserRoleMapper;
|
||||
import top.hcode.entity.UserInfo;
|
||||
import top.hcode.entity.UserRecord;
|
||||
import top.hcode.entity.UserRole;
|
||||
import top.hcode.service.UserInfoService;
|
||||
import top.hcode.service.impl.EmailServiceImpl;
|
||||
import top.hcode.utils.JwtUtils;
|
||||
import top.hcode.utils.RedisUtils;
|
||||
import top.hcode.hoj.pojo.dto.LoginDto;
|
||||
import top.hcode.hoj.pojo.dto.RegisterDto;
|
||||
import top.hcode.hoj.common.result.CommonResult;
|
||||
import top.hcode.hoj.dao.UserRecordMapper;
|
||||
import top.hcode.hoj.dao.UserRoleMapper;
|
||||
import top.hcode.hoj.pojo.entity.UserInfo;
|
||||
import top.hcode.hoj.pojo.entity.UserRecord;
|
||||
import top.hcode.hoj.pojo.entity.UserRole;
|
||||
import top.hcode.hoj.service.UserInfoService;
|
||||
import top.hcode.hoj.service.impl.EmailServiceImpl;
|
||||
import top.hcode.hoj.utils.JwtUtils;
|
||||
import top.hcode.hoj.utils.RedisUtils;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* @Description:账户处理控制类,负责处理登录请求和注册请求
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class AccountController {
|
||||
|
||||
@Autowired
|
||||
|
@ -61,15 +62,15 @@ public class AccountController {
|
|||
* @Return
|
||||
* @Since 2020/10/26
|
||||
*/
|
||||
@RequestMapping("/get-register-code")
|
||||
public CommonResult getRegisterCode(@RequestParam("username") String username, @RequestParam("email") String email) throws MessagingException {
|
||||
@RequestMapping(value = "/get-register-code",method = RequestMethod.GET)
|
||||
public CommonResult getRegisterCode(@RequestParam(value = "username",required = true) String username,
|
||||
@RequestParam(value = "email",required = true) String email) throws MessagingException {
|
||||
String numbers = RandomUtil.randomNumbers(6); // 随机生成6位数字的组合
|
||||
redisUtils.set(username, numbers, 5 * 60);//默认验证码有效5分钟
|
||||
emailService.sendCode(email, username, numbers);
|
||||
return CommonResult.successResponse(MapUtil.builder()
|
||||
.put("username", username)
|
||||
.put("email", email)
|
||||
.put("code", numbers)
|
||||
.put("expire", 5 * 60)
|
||||
.map(), "验证码已发送至指定邮箱");
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package top.hcode.hoj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.hcode.hoj.common.result.CommonResult;
|
||||
import top.hcode.hoj.dao.ContestAnnouncementMapper;
|
||||
import top.hcode.hoj.dao.ContestRegisterMapper;
|
||||
import top.hcode.hoj.pojo.entity.ContestAnnouncement;
|
||||
import top.hcode.hoj.pojo.entity.ContestRegister;
|
||||
import top.hcode.hoj.pojo.vo.ContestRecordVo;
|
||||
import top.hcode.hoj.pojo.vo.ContestVo;
|
||||
import top.hcode.hoj.dao.ContestProblemMapper;
|
||||
import top.hcode.hoj.pojo.entity.ContestProblem;
|
||||
import top.hcode.hoj.service.ContestRecordService;
|
||||
import top.hcode.hoj.service.ContestService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 21:40
|
||||
* @Description: 处理比赛模块的相关数据请求
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class ContestController {
|
||||
|
||||
@Autowired
|
||||
private ContestService contestService;
|
||||
|
||||
@Autowired
|
||||
private ContestRecordService contestRecordService;
|
||||
|
||||
@Autowired
|
||||
private ContestProblemMapper contestProblemMapper;
|
||||
|
||||
@Autowired
|
||||
private ContestAnnouncementMapper contestAnnouncementMapper;
|
||||
|
||||
@Autowired
|
||||
private ContestRegisterMapper contestRegisterMapper;
|
||||
|
||||
/**
|
||||
* @MethodName getContestList
|
||||
* @Params * @param null
|
||||
* @Description 获取比赛列表分页数据
|
||||
* @Return CommonResult
|
||||
* @Since 2020/10/27
|
||||
*/
|
||||
@GetMapping("/get-contest-list")
|
||||
public CommonResult getContestList(@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "currentPage", required = false) Integer currentPage){
|
||||
// 页数,每页题数若为空,设置默认值
|
||||
if (currentPage == null || currentPage < 1) currentPage = 1;
|
||||
|
||||
if (limit == null || limit < 1) limit = 30;
|
||||
|
||||
Page<ContestVo> contestList = contestService.getContestList(limit, currentPage);
|
||||
|
||||
if (contestList.getTotal() == 0) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(contestList, "获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @MethodName getContestInfo
|
||||
* @Params * @param null
|
||||
* @Description 获得指定比赛的详细信息
|
||||
* @Return
|
||||
* @Since 2020/10/28
|
||||
*/
|
||||
@GetMapping("/get-contest-info")
|
||||
public CommonResult getContestInfo(@RequestParam(value = "cid",required = true) Long cid){
|
||||
ContestVo contestInfo = contestService.getContestInfoById(cid);
|
||||
if (contestInfo == null) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(contestInfo, "获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName getContestProblem
|
||||
* @Params * @param null
|
||||
* @Description 获得指定比赛的题目列表
|
||||
* @Return
|
||||
* @Since 2020/10/28
|
||||
*/
|
||||
@GetMapping("/get-contest-problem")
|
||||
public CommonResult getContestProblem(@RequestParam(value = "cid",required = true) Long cid){
|
||||
QueryWrapper<ContestProblem> wrapper = new QueryWrapper<ContestProblem>().eq("cid", cid)
|
||||
.orderByAsc("cp_num");
|
||||
|
||||
List<ContestProblem> contestProblemList = contestProblemMapper.selectList(wrapper);
|
||||
if (contestProblemList.size()==0) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(contestProblemList, "获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName getContestRank
|
||||
* @Params * @param null
|
||||
* @Description 获得比赛做题记录以用来排名
|
||||
* @Return
|
||||
* @Since 2020/10/28
|
||||
*/
|
||||
@GetMapping("/get-contest-rank")
|
||||
public CommonResult getContestRank(@RequestParam(value = "cid",required = true) Long cid){
|
||||
|
||||
QueryWrapper<ContestProblem> wrapper = new QueryWrapper<ContestProblem>().eq("cid", cid).groupBy();
|
||||
|
||||
List<ContestRecordVo> contestRecordList = contestRecordService.getContestRecord(cid);
|
||||
if (contestRecordList.size() == 0) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
|
||||
return CommonResult.successResponse(contestRecordList, "获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName getContestAnnouncement
|
||||
* @Params * @param null
|
||||
* @Description 获得比赛的通知列表
|
||||
* @Return CommonResult
|
||||
* @Since 2020/10/28
|
||||
*/
|
||||
@GetMapping("/get-contest-announcement")
|
||||
public CommonResult getContestAnnouncement(@RequestParam(value = "cid",required = true)Long cid){
|
||||
QueryWrapper<ContestAnnouncement> wrapper = new QueryWrapper<ContestAnnouncement>().eq("cid", cid)
|
||||
.orderByAsc("gmt_create");
|
||||
List<ContestAnnouncement> contestAnnouncementList = contestAnnouncementMapper.selectList(wrapper);
|
||||
if (contestAnnouncementList.size() == 0) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(contestAnnouncementList, "获取成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @MethodName toRegisterContest
|
||||
* @Params * @param null
|
||||
* @Description 注册比赛
|
||||
* @Return
|
||||
* @Since 2020/10/28
|
||||
*/
|
||||
@PostMapping("/to-register-contest")
|
||||
@RequiresAuthentication
|
||||
public CommonResult toRegisterContest(@RequestBody long cid,
|
||||
@RequestBody String uid){
|
||||
QueryWrapper<ContestRegister> wrapper = new QueryWrapper<ContestRegister>().eq("cid", cid)
|
||||
.eq("uid",uid);
|
||||
if (contestRegisterMapper.selectOne(wrapper)!=null){
|
||||
return CommonResult.errorResponse("您已注册过该比赛,请勿重复注册!", CommonResult.STATUS_ACCESS_DENIED);
|
||||
}
|
||||
|
||||
int result = contestRegisterMapper.insert(new ContestRegister().setCid(cid).setUid(uid));
|
||||
|
||||
if (result != 1) {
|
||||
return CommonResult.errorResponse("注册比赛失败,请稍后再试", CommonResult.STATUS_FAIL);
|
||||
} else {
|
||||
return CommonResult.successResponse(null, "注册比赛成功");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package top.hcode.hoj.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 20:52
|
||||
* @Description: 处理代码评判
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class JudgeController {
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package top.hcode.hoj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.hcode.hoj.common.result.CommonResult;
|
||||
import top.hcode.hoj.pojo.vo.ProblemVo;
|
||||
import top.hcode.hoj.pojo.entity.Problem;
|
||||
import top.hcode.hoj.service.ProblemService;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 13:24
|
||||
* @Description: 问题数据控制类,处理题目列表请求,题目内容请求。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class ProblemController {
|
||||
|
||||
@Autowired
|
||||
private ProblemService problemService;
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName getProblemList
|
||||
* @Params * @param null
|
||||
* @Description 获取题目列表分页
|
||||
* @Return CommonResult
|
||||
* @Since 2020/10/27
|
||||
*/
|
||||
@RequestMapping(value = "/get-problem-list", method = RequestMethod.GET)
|
||||
public CommonResult getProblemList(@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "currentPage", required = false) Integer currentPage,
|
||||
@RequestParam(value = "searchPid", required = false) Long searchPid,
|
||||
@RequestParam(value = "searchTitle", required = false) String searchTitle) {
|
||||
// 页数,每页题数若为空,设置默认值
|
||||
if (currentPage == null || currentPage < 1) currentPage = 1;
|
||||
if (limit == null || limit < 1) limit = 15;
|
||||
|
||||
// 设置无传参的空值设定
|
||||
if (searchPid == null) {
|
||||
searchPid = 0L;
|
||||
}
|
||||
|
||||
Page<ProblemVo> problemList = problemService.getProblemList(limit, currentPage, searchPid, searchTitle);
|
||||
|
||||
if (problemList.getTotal() == 0) { // 未查询到一条数据
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(problemList, "获取成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName getProblemInfo
|
||||
* @Params * @param null
|
||||
* @Description 获取指定题目的详情信息
|
||||
* @Return CommonResult
|
||||
* @Since 2020/10/27
|
||||
*/
|
||||
@RequestMapping(value = "/get-problem-info", method = RequestMethod.GET)
|
||||
public CommonResult getProblemInfo(@RequestParam(value = "pid", required = true) Long pid) {
|
||||
QueryWrapper<Problem> wrapper = new QueryWrapper<Problem>().eq("id", pid).eq("auth", 1);
|
||||
Problem problem = problemService.getOne(wrapper);
|
||||
if (problem == null) {
|
||||
return CommonResult.errorResponse("该题号对应的题目不存在", CommonResult.STATUS_NOT_FOUND);
|
||||
}
|
||||
return CommonResult.successResponse(problem, "获取成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package top.hcode.hoj.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.hcode.hoj.common.result.CommonResult;
|
||||
import top.hcode.hoj.pojo.vo.RankVo;
|
||||
import top.hcode.hoj.service.UserRecordService;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 20:53
|
||||
* @Description: 处理排行榜数据
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class RankController {
|
||||
|
||||
@Autowired
|
||||
private UserRecordService userRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* @MethodName get-rank-list
|
||||
* @Params * @param null
|
||||
* @Description 获取排行榜数据
|
||||
* @Return CommonResult
|
||||
* @Since 2020/10/27
|
||||
*/
|
||||
@GetMapping("/get-rank-list")
|
||||
public CommonResult getRankList(@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "currentPage", required = false) Integer currentPage) {
|
||||
|
||||
// 页数,每页题数若为空,设置默认值
|
||||
if (currentPage == null || currentPage < 1) currentPage = 1;
|
||||
if (limit == null || limit < 1) limit = 30;
|
||||
|
||||
Page<RankVo> rankList = userRecordService.getRankList(limit, currentPage);
|
||||
|
||||
if (rankList.getTotal() == 0) {
|
||||
return CommonResult.errorResponse("暂无数据", CommonResult.STATUS_NOT_FOUND);
|
||||
} else {
|
||||
return CommonResult.successResponse(rankList, "获取成功");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.Auth;
|
||||
import top.hcode.hoj.pojo.entity.Auth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.Comment;
|
||||
import top.hcode.hoj.pojo.entity.Comment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.CommentTag;
|
||||
import top.hcode.hoj.pojo.entity.CommentTag;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ContestAnnouncement;
|
||||
import top.hcode.hoj.pojo.entity.ContestAnnouncement;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ContestExplanation;
|
||||
import top.hcode.hoj.pojo.entity.ContestExplanation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -0,0 +1,26 @@
|
|||
package top.hcode.hoj.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.hoj.pojo.vo.ContestVo;
|
||||
import top.hcode.hoj.pojo.entity.Contest;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ContestMapper extends BaseMapper<Contest> {
|
||||
List<ContestVo> getContestList(IPage page);
|
||||
ContestVo getContestInfoById(@Param("cid")long cid);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ContestProblem;
|
||||
import top.hcode.hoj.pojo.entity.ContestProblem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -0,0 +1,24 @@
|
|||
package top.hcode.hoj.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.hoj.pojo.vo.ContestRecordVo;
|
||||
import top.hcode.hoj.pojo.entity.ContestRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ContestRecordMapper extends BaseMapper<ContestRecord> {
|
||||
List<ContestRecordVo> getContestRecord(@Param("cid") long cid);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ContestRegister;
|
||||
import top.hcode.hoj.pojo.entity.ContestRegister;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ContestScore;
|
||||
import top.hcode.hoj.pojo.entity.ContestScore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.JudgeCase;
|
||||
import top.hcode.hoj.pojo.entity.JudgeCase;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.Judge;
|
||||
import top.hcode.hoj.pojo.entity.Judge;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.ProblemCount;
|
||||
import top.hcode.hoj.pojo.entity.ProblemCount;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -0,0 +1,25 @@
|
|||
package top.hcode.hoj.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.hoj.pojo.vo.ProblemVo;
|
||||
import top.hcode.hoj.pojo.entity.Problem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface ProblemMapper extends BaseMapper<Problem> {
|
||||
List<ProblemVo> getProblemList(IPage page, @Param("pid") long pid, @Param("title") String title);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.RoleAuth;
|
||||
import top.hcode.hoj.pojo.entity.RoleAuth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.Role;
|
||||
import top.hcode.hoj.pojo.entity.Role;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import top.hcode.entity.UserAcproblem;
|
||||
import top.hcode.pojo.entity.UserAcproblem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,10 +1,9 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.common.dto.RegisterDto;
|
||||
import top.hcode.entity.UserInfo;
|
||||
import top.hcode.hoj.pojo.dto.RegisterDto;
|
||||
import top.hcode.hoj.pojo.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.entity.UserRecord;
|
||||
import top.hcode.hoj.pojo.vo.RankVo;
|
||||
import top.hcode.hoj.pojo.entity.UserRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
|
@ -16,5 +20,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
@Mapper
|
||||
@Repository
|
||||
public interface UserRecordMapper extends BaseMapper<UserRecord> {
|
||||
|
||||
List<RankVo> getRankList(IPage page);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.dao;
|
||||
package top.hcode.hoj.dao;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import top.hcode.entity.UserRole;
|
||||
import top.hcode.hoj.pojo.entity.UserRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.AuthMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.AuthMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.CommentMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.CommentMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.CommentTagMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.CommentTagMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestAnnouncementMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestAnnouncementMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestExplanationMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestExplanationMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestMapper">
|
||||
<select id="getContestList" resultType="top.hcode.hoj.pojo.vo.ContestVo" useCache="false">
|
||||
select c.id,c.uid,u.nickname,u.username,c.title,c.explain,c.type,c.source,c.auth,c.start_time,c.end_time,c.duration from contest c,user_info u
|
||||
where c.uid = u.uuid
|
||||
order by c.start_time DESC
|
||||
</select>
|
||||
<select id="getContestInfoById" resultType="top.hcode.hoj.pojo.vo.ContestVo" useCache="true">
|
||||
select c.id,c.uid,u.nickname,u.username,c.title,c.explain,c.type,c.source,c.auth,c.start_time,c.end_time,c.duration from contest c,user_info u
|
||||
where c.id = #{cid} and u.uuid = c.uid
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestProblemMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestProblemMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestRecordMapper">
|
||||
<select id="getContestRecord" resultType="top.hcode.hoj.pojo.vo.ContestRecordVo" useCache="false">
|
||||
select cr.uid,cr.cid,u.username,u.nickname,cr.pid,cr.cpid,cr.submit_id,cr.status,time from user_info u,contest_record cr
|
||||
where cr.uid = u.uuid and cr.cid = #{cid}
|
||||
order by cr.uid,cr.cpid ASC
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestRegisterMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestRegisterMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ContestScoreMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ContestScoreMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.JudgeCaseMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.JudgeCaseMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.JudgeMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.JudgeMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.ProblemCountMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.ProblemCountMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.ProblemMapper">
|
||||
<select id="getProblemList" resultType="top.hcode.hoj.pojo.vo.ProblemVo" useCache="false">
|
||||
select p.id,title,author,source,total,ac,mle,tle,re,pe,ce,wa,se,score from problem p,problem_count pc
|
||||
<where>
|
||||
auth = 1 and p.id = pc.pid
|
||||
<if test="pid!=0">
|
||||
AND p.id=#{pid}
|
||||
</if>
|
||||
<if test="title!=null and title!=''">
|
||||
AND title like CONCAT("%",#{title},"%")
|
||||
</if>
|
||||
</where>
|
||||
order by p.id ASC
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.RoleAuthMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.RoleAuthMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.RoleMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.RoleMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.UserAcproblemMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.UserAcproblemMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.UserInfoMapper">
|
||||
<insert id="addUser" parameterType="top.hcode.common.dto.RegisterDto">
|
||||
<mapper namespace="top.hcode.hoj.dao.UserInfoMapper">
|
||||
<insert id="addUser" parameterType="top.hcode.hoj.pojo.dto.RegisterDto">
|
||||
insert into user_info(uuid,username,password,nickname,email,number) values (
|
||||
#{uuid}, #{username},#{password},#{nickname},#{email},#{number}
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.UserRecordMapper">
|
||||
<select id="getRankList" resultType="top.hcode.hoj.pojo.vo.RankVo" useCache="false">
|
||||
select uuid,nickname,username,number,total,ac,submissions,rating,score from user_info u,user_record ur
|
||||
where status = 0 and u.uuid = ur.uid
|
||||
order by score,ac,rating Desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.dao.UserRoleMapper">
|
||||
<mapper namespace="top.hcode.hoj.dao.UserRoleMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.common.dto;
|
||||
package top.hcode.hoj.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.common.dto;
|
||||
package top.hcode.hoj.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
|
@ -0,0 +1,45 @@
|
|||
package top.hcode.hoj.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/28 12:05
|
||||
* @Description:
|
||||
*/
|
||||
@ApiModel(value="用户在比赛的记录", description="")
|
||||
@Data
|
||||
public class ContestRecordVo implements Serializable {
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "比赛id")
|
||||
private Long cid;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "题目id")
|
||||
private Long pid;
|
||||
|
||||
@ApiModelProperty(value = "比赛中的题目顺序id")
|
||||
private Long cpid;
|
||||
|
||||
@ApiModelProperty(value = "提交id,用于可重判")
|
||||
private Long submitId;
|
||||
|
||||
@ApiModelProperty(value = "提交结果,0表示未AC通过,1表示AC通过")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "提交时间,为提交时间减去比赛时间")
|
||||
private long time;
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package top.hcode.hoj.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 21:53
|
||||
* @Description:
|
||||
*/
|
||||
@ApiModel(value="比赛信息", description="")
|
||||
@Data
|
||||
public class ContestVo implements Serializable {
|
||||
|
||||
@TableId(value = "比赛id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "比赛创建者id")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "创建者用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "创建者昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "比赛标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "比赛说明")
|
||||
private String explain;
|
||||
|
||||
@ApiModelProperty(value = "0为acm赛制,1为比分赛制")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "比赛来源,原创为0,克隆赛为比赛id")
|
||||
private Integer source;
|
||||
|
||||
@ApiModelProperty(value = "0为公开赛,1为私有赛(有密码),2为报名赛")
|
||||
private Integer auth;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(value = "比赛时长(分)")
|
||||
private Integer duration;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package top.hcode.hoj.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 14:14
|
||||
* @Description:
|
||||
*/
|
||||
@ApiModel(value="题目列表查询对象ProblemVo", description="")
|
||||
@Data
|
||||
public class ProblemVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "题目id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "题目")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "作者")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "题目来源")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty(value = "该题总提交数")
|
||||
private Integer total;
|
||||
|
||||
@ApiModelProperty(value = "通过提交数")
|
||||
private Integer ac;
|
||||
|
||||
@ApiModelProperty(value = "空间超限提交数")
|
||||
private Integer mle;
|
||||
|
||||
@ApiModelProperty(value = "时间超限提交数")
|
||||
private Integer tle;
|
||||
|
||||
@ApiModelProperty(value = "运行错误提交数")
|
||||
private Integer re;
|
||||
|
||||
@ApiModelProperty(value = "格式错误提交数")
|
||||
private Integer pe;
|
||||
|
||||
@ApiModelProperty(value = "编译错误提交数")
|
||||
private Integer ce;
|
||||
|
||||
@ApiModelProperty(value = "答案错误提交数")
|
||||
private Integer wa;
|
||||
|
||||
@ApiModelProperty(value = "系统错误提交数")
|
||||
private Integer se;
|
||||
|
||||
@ApiModelProperty(value = "题目分数,默认为100")
|
||||
private Integer score;
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package top.hcode.hoj.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: Himit_ZH
|
||||
* @Date: 2020/10/27 21:09
|
||||
* @Description:
|
||||
*/
|
||||
@ApiModel(value="排行榜数据类RankVo", description="")
|
||||
@Data
|
||||
public class RankVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "学号")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(value = "总做题数")
|
||||
private Integer total;
|
||||
|
||||
@ApiModelProperty(value = "总提交数")
|
||||
private Integer submissions;
|
||||
|
||||
@ApiModelProperty(value = "总通过数")
|
||||
private Integer ac;
|
||||
|
||||
@ApiModelProperty(value = "cf得分")
|
||||
@TableField("Rating")
|
||||
private Integer Rating;
|
||||
|
||||
@ApiModelProperty(value = "io制比赛得分")
|
||||
private Integer score;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.Auth;
|
||||
import top.hcode.hoj.pojo.entity.Auth;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.Comment;
|
||||
import top.hcode.hoj.pojo.entity.Comment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.CommentTag;
|
||||
import top.hcode.hoj.pojo.entity.CommentTag;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestAnnouncement;
|
||||
import top.hcode.hoj.pojo.entity.ContestAnnouncement;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestExplanation;
|
||||
import top.hcode.hoj.pojo.entity.ContestExplanation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestProblem;
|
||||
import top.hcode.hoj.pojo.entity.ContestProblem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,8 +1,11 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestRecord;
|
||||
import top.hcode.hoj.pojo.vo.ContestRecordVo;
|
||||
import top.hcode.hoj.pojo.entity.ContestRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
@ -12,5 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @since 2020-10-23
|
||||
*/
|
||||
public interface ContestRecordService extends IService<ContestRecord> {
|
||||
|
||||
List<ContestRecordVo> getContestRecord(long cid);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestRegister;
|
||||
import top.hcode.hoj.pojo.entity.ContestRegister;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ContestScore;
|
||||
import top.hcode.hoj.pojo.entity.ContestScore;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -0,0 +1,19 @@
|
|||
package top.hcode.hoj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import top.hcode.hoj.pojo.vo.ContestVo;
|
||||
import top.hcode.hoj.pojo.entity.Contest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
public interface ContestService extends IService<Contest> {
|
||||
Page<ContestVo> getContestList(int limit, int currentPage);
|
||||
ContestVo getContestInfoById(long cid);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.JudgeCase;
|
||||
import top.hcode.hoj.pojo.entity.JudgeCase;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.Judge;
|
||||
import top.hcode.hoj.pojo.entity.Judge;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.ProblemCount;
|
||||
import top.hcode.hoj.pojo.entity.ProblemCount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -0,0 +1,20 @@
|
|||
package top.hcode.hoj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import top.hcode.hoj.pojo.vo.ProblemVo;
|
||||
import top.hcode.hoj.pojo.entity.Problem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
|
||||
public interface ProblemService extends IService<Problem> {
|
||||
Page<ProblemVo> getProblemList(int limit,int currentPage,long pid,String title);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.RoleAuth;
|
||||
import top.hcode.hoj.pojo.entity.RoleAuth;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.Role;
|
||||
import top.hcode.hoj.pojo.entity.Role;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.UserAcproblem;
|
||||
import top.hcode.pojo.entity.UserAcproblem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,7 +1,7 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.common.dto.RegisterDto;
|
||||
import top.hcode.entity.UserInfo;
|
||||
import top.hcode.hoj.pojo.dto.RegisterDto;
|
||||
import top.hcode.hoj.pojo.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -0,0 +1,20 @@
|
|||
package top.hcode.hoj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import top.hcode.hoj.pojo.vo.RankVo;
|
||||
import top.hcode.hoj.pojo.entity.UserRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
public interface UserRecordService extends IService<UserRecord> {
|
||||
|
||||
Page<RankVo> getRankList(int limit, int currentPage);
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package top.hcode.service;
|
||||
package top.hcode.hoj.service;
|
||||
|
||||
import top.hcode.entity.UserRole;
|
||||
import top.hcode.hoj.pojo.entity.UserRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.Auth;
|
||||
import top.hcode.dao.AuthMapper;
|
||||
import top.hcode.service.AuthService;
|
||||
import top.hcode.hoj.pojo.entity.Auth;
|
||||
import top.hcode.hoj.dao.AuthMapper;
|
||||
import top.hcode.hoj.service.AuthService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.Comment;
|
||||
import top.hcode.dao.CommentMapper;
|
||||
import top.hcode.service.CommentService;
|
||||
import top.hcode.hoj.pojo.entity.Comment;
|
||||
import top.hcode.hoj.dao.CommentMapper;
|
||||
import top.hcode.hoj.service.CommentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.CommentTag;
|
||||
import top.hcode.dao.CommentTagMapper;
|
||||
import top.hcode.service.CommentTagService;
|
||||
import top.hcode.hoj.pojo.entity.CommentTag;
|
||||
import top.hcode.hoj.dao.CommentTagMapper;
|
||||
import top.hcode.hoj.service.CommentTagService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.ContestAnnouncement;
|
||||
import top.hcode.dao.ContestAnnouncementMapper;
|
||||
import top.hcode.service.ContestAnnouncementService;
|
||||
import top.hcode.hoj.pojo.entity.ContestAnnouncement;
|
||||
import top.hcode.hoj.dao.ContestAnnouncementMapper;
|
||||
import top.hcode.hoj.service.ContestAnnouncementService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.ContestExplanation;
|
||||
import top.hcode.dao.ContestExplanationMapper;
|
||||
import top.hcode.service.ContestExplanationService;
|
||||
import top.hcode.hoj.pojo.entity.ContestExplanation;
|
||||
import top.hcode.hoj.dao.ContestExplanationMapper;
|
||||
import top.hcode.hoj.service.ContestExplanationService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package top.hcode.service.impl;
|
||||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import top.hcode.entity.ContestProblem;
|
||||
import top.hcode.dao.ContestProblemMapper;
|
||||
import top.hcode.service.ContestProblemService;
|
||||
import top.hcode.hoj.pojo.entity.ContestProblem;
|
||||
import top.hcode.hoj.dao.ContestProblemMapper;
|
||||
import top.hcode.hoj.service.ContestProblemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package top.hcode.hoj.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import top.hcode.hoj.pojo.vo.ContestRecordVo;
|
||||
import top.hcode.hoj.pojo.entity.ContestRecord;
|
||||
import top.hcode.hoj.dao.ContestRecordMapper;
|
||||
import top.hcode.hoj.service.ContestRecordService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Himit_ZH
|
||||
* @since 2020-10-23
|
||||
*/
|
||||
@Service
|
||||
public class ContestRecordServiceImpl extends ServiceImpl<ContestRecordMapper, ContestRecord> implements ContestRecordService {
|
||||
|
||||
@Autowired
|
||||
private ContestRecordMapper contestRecordMapper;
|
||||
|
||||
@Override
|
||||
public List<ContestRecordVo> getContestRecord(long cid) {
|
||||
return contestRecordMapper.getContestRecord(cid);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue