项目建立,文档书写

This commit is contained in:
Himit_ZH 2020-10-26 21:57:25 +08:00
parent c6580bbb76
commit 8bb33f5c6c
256 changed files with 5166 additions and 73 deletions

View File

@ -1,36 +0,0 @@
# HOJ
#### Description
基于前后端分离分布式架构的在线测评平台OJ
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,37 +0,0 @@
# HOJ
#### 介绍
基于前后端分离分布式架构的在线测评平台OJ
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

8
hoj/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

14
hoj/.idea/compiler.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="DataBackup" />
<module name="api" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

14
hoj/.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
hoj/.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

124
hoj/DataBackup/pom.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hoj</artifactId>
<groupId>top.hcode</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>DataBackup</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>top.hcode</groupId>
<artifactId>api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.alibaba.cloud</groupId>-->
<!-- <artifactId>spring-cloud-alibaba-nacos-discovery</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-openfeign</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.crazycake</groupId>
<artifactId>shiro-redis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- hutool工具类-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.3</version>
</dependency>
<!--redis整合-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- jwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!--实体类 web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--热部署工具-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<!--单元测试-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,22 @@
package top.hcode;
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;
/**
* @Author: Himit_ZH
* @Date: 2020/10/22 23:25
* @Description:
*/
//@EnableDiscoveryClient
@SpringBootApplication
//@EnableFeignClients
@EnableAsync //开启异步注解
public class DataBackupApplication {
public static void main(String[] args) {
SpringApplication.run(DataBackupApplication.class,args);
}
}

View File

@ -0,0 +1,20 @@
package top.hcode.common.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author: Himit_ZH
* @Date: 2020/7/20 00:23
* @Description: 登录数据实体类
*/
@Data
public class LoginDto implements Serializable {
@NotBlank(message = "用户名不能为空")
private String username;
@NotBlank(message = "密码不能为空")
private String password;
}

View File

@ -0,0 +1,41 @@
package top.hcode.common.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.lang.Nullable;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author: Himit_ZH
* @Date: 2020/10/24 11:15
* @Description: 注册数据实体类
*/
@Data
@Accessors(chain = true)
public class RegisterDto implements Serializable {
@Nullable
private String uuid;
@NotBlank(message = "用户名不能为空")
private String username;
@NotBlank(message = "密码不能为空")
private String password;
@NotBlank(message = "昵称不能为空")
private String nickname;
@NotBlank(message = "邮箱不能为空")
@Email(message = "邮箱格式错误")
private String email;
@NotBlank(message = "验证码不能为空")
private String code;
@NotBlank(message = "学号不能为空")
private String number;
}

View File

@ -0,0 +1,76 @@
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);
}
}

View File

@ -0,0 +1,57 @@
package top.hcode.common.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommonResult implements Serializable {
public final static Integer STATUS_SUCCESS = 200;
public final static Integer STATUS_FAIL = 400;
public final static Integer STATUS_ERROR = 500;
public final static Integer STATUS_ACCESS_DENIED = 401;
private Integer status; // 状态码
private Object data; // 返回的数据
private String msg; // 自定义信息
public CommonResult(Integer status, Object data, String msg){
this.status = status;
this.data = data;
this.msg = msg;
}
/**
* 成功的结果
* @param data 返回结果
* @param msg 返回信息
*/
public static CommonResult successResponse(Object data, String msg) {
return new CommonResult(CommonResult.STATUS_SUCCESS, data, msg);
}
/**
* 成功的结果
* @param data 返回结果
*/
public CommonResult successResponse(Object data) {
return new CommonResult(CommonResult.STATUS_SUCCESS, data, null);
}
/**
* 失败的结果无异常
* @param msg 返回信息
*/
public static CommonResult errorResponse(String msg) {
return new CommonResult(CommonResult.STATUS_FAIL, null, msg);
}
public static CommonResult errorResponse(String msg,Integer status) {
return new CommonResult(status, null,msg);
}
}

View File

@ -0,0 +1,22 @@
package top.hcode.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 解决跨域问题
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
}
}

View File

@ -0,0 +1,25 @@
package top.hcode.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @Author: Himit_ZH
* @Date: 2020/7/19 21:04
* @Description:
*/
@Configuration
@EnableTransactionManagement
@MapperScan("top.hcode.dao")
public class MybatisPlusConfig {
// 分页插件
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}

View File

@ -0,0 +1,50 @@
package top.hcode.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* @Author: Himit_ZH
* @Date: 2020/10/23 23:47
* @Description:
*/
@Configuration
public class RedisConfig {
// 自己定义了一个 RedisTemplate
@Bean
@SuppressWarnings("all")
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
// 我们为了自己开发方便一般直接使用 <String, Object>
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
template.setConnectionFactory(factory);
// Json序列化配置
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
// String 的序列化
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
// key采用String的序列化方式
template.setKeySerializer(stringRedisSerializer);
// hash的key也采用String的序列化方式
template.setHashKeySerializer(stringRedisSerializer);
// value序列化方式采用jackson
template.setValueSerializer(jackson2JsonRedisSerializer);
// hash的value序列化方式采用jackson
template.setHashValueSerializer(jackson2JsonRedisSerializer);
template.afterPropertiesSet();
return template;
}
}

View File

@ -0,0 +1,98 @@
package top.hcode.config;
/**
* @Author: Himit_ZH
* @Date: 2020/7/19 22:53
* @Description:
*/
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
import org.apache.shiro.mgt.DefaultSubjectDAO;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.mgt.SessionManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.crazycake.shiro.RedisCacheManager;
import org.crazycake.shiro.RedisSessionDAO;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
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 javax.servlet.Filter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* shiro启用注解拦截控制器
*/
@Configuration
public class ShiroConfig {
@Autowired
JwtFilter jwtFilter;
@Bean
public SessionManager sessionManager(RedisSessionDAO redisSessionDAO) {
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
sessionManager.setSessionDAO(redisSessionDAO);
return sessionManager;
}
@Bean
public DefaultWebSecurityManager securityManager(AccountRealm accountRealm,
SessionManager sessionManager,
RedisCacheManager redisCacheManager) {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(accountRealm);
securityManager.setSessionManager(sessionManager);
securityManager.setCacheManager(redisCacheManager);
/*
* 关闭shiro自带的session详情见文档
*/
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
securityManager.setSubjectDAO(subjectDAO);
return securityManager;
}
@Bean
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
Map<String, String> filterMap = new LinkedHashMap<>();
filterMap.put("/**", "jwt"); // 主要通过注解方式校验权限
chainDefinition.addPathDefinitions(filterMap);
return chainDefinition;
}
@Bean("shiroFilterFactoryBean")
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager,
ShiroFilterChainDefinition shiroFilterChainDefinition) {
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
shiroFilter.setSecurityManager(securityManager);
Map<String, Filter> filters = new HashMap<>();
filters.put("jwt", jwtFilter);
shiroFilter.setFilters(filters);
Map<String, String> filterMap = shiroFilterChainDefinition.getFilterChainMap();
shiroFilter.setFilterChainDefinitionMap(filterMap);
return shiroFilter;
}
// 开启注解代理默认好像已经开启可以不要
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean
public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
creator.setProxyTargetClass(true);
return creator;
}
}

View File

@ -0,0 +1,56 @@
package top.hcode.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
/**
* @Author: Himit_ZH
* @Date: 2020/5/29 22:28
* @Description:
*/
@Configuration
@EnableSwagger2 //开启swagger2
public class SwaggerConfig {
@Bean //配置swagger的docket的bean势力
public Docket docket(Environment environment){
//设置要显示的swagger环境
Profiles profiles = Profiles.of("dev","test"); //线下环境
//通过环境判断是否在自己所设定的环境当中
boolean flag = environment.acceptsProfiles(profiles);
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("Himit_ZH") //分组
.enable(flag) //开启
.select()
//RequestHandlerSelectors扫描方式
//any()全部
//none 都不扫描
//path 过滤什么路径
.apis(RequestHandlerSelectors.basePackage("top.hcode"))
.build();
}
//配置swagger信息
private ApiInfo apiInfo(){
//作者信息
Contact contact = new Contact("Himit_ZH", "https://blog.csdn.net/weixin_43853097", "372347736@qq.com");
return new ApiInfo(
"Himit_ZH的swaggerAPI文档",
"网站作者是个大帅哥!",
"v1.0",
"https://blog.csdn.net/weixin_43853097",
contact,
"Apache 2.0",
"http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList());
}
}

View File

@ -0,0 +1,157 @@
package top.hcode.controller;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.mail.MessagingException;
import javax.servlet.http.HttpServletResponse;
/**
* @Author: Himit_ZH
* @Date: 2020/10/23 12:00
* @Description:账户处理控制类负责处理登录请求和注册请求
*/
@RestController
public class AccountController {
@Autowired
private EmailServiceImpl emailService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private UserInfoService userInfoDao;
@Autowired
private UserRoleMapper userRoleDao;
@Autowired
private UserRecordMapper userRecordDao;
@Autowired
private JwtUtils jwtUtils;
/**
* @MethodName getRegisterCode
* @Params * @param null
* @Description 调用邮件服务发送注册流程的6位随机验证码
* @Return
* @Since 2020/10/26
*/
@RequestMapping("/get-register-code")
public CommonResult getRegisterCode(@RequestParam("username") String username, @RequestParam("email") 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(), "验证码已发送至指定邮箱");
}
/**
* @MethodName register
* @Params * @param RegisterDto
* @Description 注册逻辑具体参数请看RegisterDto类
* @Return
* @Since 2020/10/24
*/
@PostMapping("/register")
@Transactional
public CommonResult register(@Validated @RequestBody RegisterDto registerDto) {
if (!redisUtils.hasKey(registerDto.getUsername())) {
return CommonResult.errorResponse("验证码不存在或已过期");
}
if (!redisUtils.get(registerDto.getUsername()).equals(registerDto.getCode())) { //验证码判断
return CommonResult.errorResponse("验证码不正确");
}
String uuid = IdUtil.simpleUUID();
//为新用户设置uuid
registerDto.setUuid(uuid);
//往user_info表插入数据
int result1 = userInfoDao.addUser(registerDto);
//往user_role表插入数据
int result2 = userRoleDao.insert(new UserRole().setRoleId(1002L).setUid(uuid));
//往user_record表插入数据
int result3 = userRecordDao.insert(new UserRecord().setUid(uuid));
if (result1 == 1 && result2 == 1 && result3 == 1) {
return CommonResult.successResponse(null, "注册成功!");
} else {
return CommonResult.errorResponse("注册失败!", CommonResult.STATUS_ERROR); // 插入数据库失败返回500
}
}
/**
* @MethodName login
* @Params * @param LoginDto
* @Description 处理登录逻辑
* @Return CommonResult
* @Since 2020/10/24
*/
@PostMapping("/login")
public CommonResult login(@Validated @RequestBody LoginDto loginDto, HttpServletResponse response) {
QueryWrapper<UserInfo> wrapper = new QueryWrapper<UserInfo>().eq("username", loginDto.getUsername());
UserInfo user = userInfoDao.getOne(wrapper);
Assert.notNull(user, "用户不存在");
if (user.getPassword().equals(SecureUtil.md5(loginDto.getPassword()))) {
return CommonResult.errorResponse("密码不正确");
}
if (user.getStatus() != 0) {
return CommonResult.errorResponse("该账户已被封禁,请联系管理员进行处理。");
}
String jwt = jwtUtils.generateToken(user.getUuid());
response.setHeader("Authorization", jwt); //放到信息头部
response.setHeader("Access-Control-Expose-Headers", "Authorization");
return CommonResult.successResponse(MapUtil.builder()
.put("uid", user.getUuid())
.put("username", user.getUsername())
.put("nickname", user.getNickname())
.put("avatar", user.getAvatar())
.put("email", user.getEmail())
.map(), "登录成功"
);
}
/**
* @MethodName logout
* @Params * @param null
* @Description 退出逻辑将jwt在redis中清除下次需要再次登录
* @Return CommonResult
* @Since 2020/10/24
*/
@GetMapping("/logout")
@RequiresAuthentication
public CommonResult logout() {
SecurityUtils.getSubject().logout();
return CommonResult.successResponse(null, "退出成功");
}
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.Auth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface AuthMapper extends BaseMapper<Auth> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface CommentMapper extends BaseMapper<Comment> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.CommentTag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface CommentTagMapper extends BaseMapper<CommentTag> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ContestAnnouncement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestAnnouncementMapper extends BaseMapper<ContestAnnouncement> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ContestExplanation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestExplanationMapper extends BaseMapper<ContestExplanation> {
}

View File

@ -0,0 +1,16 @@
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> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ContestProblem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestProblemMapper extends BaseMapper<ContestProblem> {
}

View File

@ -0,0 +1,16 @@
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> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ContestRegister;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestRegisterMapper extends BaseMapper<ContestRegister> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ContestScore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestScoreMapper extends BaseMapper<ContestScore> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.JudgeCase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface JudgeCaseMapper extends BaseMapper<JudgeCase> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.Judge;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface JudgeMapper extends BaseMapper<Judge> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.ProblemCount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ProblemCountMapper extends BaseMapper<ProblemCount> {
}

View File

@ -0,0 +1,16 @@
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> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.RoleAuth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface RoleAuthMapper extends BaseMapper<RoleAuth> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface RoleMapper extends BaseMapper<Role> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.dao;
import top.hcode.entity.UserAcproblem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface UserAcproblemMapper extends BaseMapper<UserAcproblem> {
}

View File

@ -0,0 +1,23 @@
package top.hcode.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 com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Mapper
@Repository
public interface UserInfoMapper extends BaseMapper<UserInfo> {
int addUser(RegisterDto registerDto);
}

View File

@ -0,0 +1,20 @@
package top.hcode.dao;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import top.hcode.entity.UserRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Mapper
@Repository
public interface UserRecordMapper extends BaseMapper<UserRecord> {
}

View File

@ -0,0 +1,20 @@
package top.hcode.dao;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import top.hcode.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Mapper
@Repository
public interface UserRoleMapper extends BaseMapper<UserRole> {
}

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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.ContestMapper">
</mapper>

View File

@ -0,0 +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>

View File

@ -0,0 +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.ContestRecordMapper">
</mapper>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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.ProblemMapper">
</mapper>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -0,0 +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>

View File

@ -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.dao.UserInfoMapper">
<insert id="addUser" parameterType="top.hcode.common.dto.RegisterDto">
insert into user_info(uuid,username,password,nickname,email,number) values (
#{uuid}, #{username},#{password},#{nickname},#{email},#{number}
)
</insert>
</mapper>

View File

@ -0,0 +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.UserRecordMapper">
</mapper>

View File

@ -0,0 +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>

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Auth;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface AuthService extends IService<Auth> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Comment;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface CommentService extends IService<Comment> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.CommentTag;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface CommentTagService extends IService<CommentTag> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestAnnouncement;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestAnnouncementService extends IService<ContestAnnouncement> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestExplanation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestExplanationService extends IService<ContestExplanation> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestProblem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestProblemService extends IService<ContestProblem> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestRecordService extends IService<ContestRecord> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestRegister;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestRegisterService extends IService<ContestRegister> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ContestScore;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestScoreService extends IService<ContestScore> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Contest;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ContestService extends IService<Contest> {
}

View File

@ -0,0 +1,7 @@
package top.hcode.service;
import javax.mail.MessagingException;
public interface EmailService {
public void sendCode(String email,String username,String code) throws MessagingException;
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.JudgeCase;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface JudgeCaseService extends IService<JudgeCase> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Judge;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface JudgeService extends IService<Judge> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.ProblemCount;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ProblemCountService extends IService<ProblemCount> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Problem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface ProblemService extends IService<Problem> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.RoleAuth;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface RoleAuthService extends IService<RoleAuth> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.Role;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface RoleService extends IService<Role> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.UserAcproblem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface UserAcproblemService extends IService<UserAcproblem> {
}

View File

@ -0,0 +1,17 @@
package top.hcode.service;
import top.hcode.common.dto.RegisterDto;
import top.hcode.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface UserInfoService extends IService<UserInfo> {
public Integer addUser(RegisterDto registerDto);
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.UserRecord;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface UserRecordService extends IService<UserRecord> {
}

View File

@ -0,0 +1,16 @@
package top.hcode.service;
import top.hcode.entity.UserRole;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
public interface UserRoleService extends IService<UserRole> {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Auth;
import top.hcode.dao.AuthMapper;
import top.hcode.service.AuthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class AuthServiceImpl extends ServiceImpl<AuthMapper, Auth> implements AuthService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Comment;
import top.hcode.dao.CommentMapper;
import top.hcode.service.CommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.CommentTag;
import top.hcode.dao.CommentTagMapper;
import top.hcode.service.CommentTagService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class CommentTagServiceImpl extends ServiceImpl<CommentTagMapper, CommentTag> implements CommentTagService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestAnnouncement;
import top.hcode.dao.ContestAnnouncementMapper;
import top.hcode.service.ContestAnnouncementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestAnnouncementServiceImpl extends ServiceImpl<ContestAnnouncementMapper, ContestAnnouncement> implements ContestAnnouncementService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestExplanation;
import top.hcode.dao.ContestExplanationMapper;
import top.hcode.service.ContestExplanationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestExplanationServiceImpl extends ServiceImpl<ContestExplanationMapper, ContestExplanation> implements ContestExplanationService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestProblem;
import top.hcode.dao.ContestProblemMapper;
import top.hcode.service.ContestProblemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestProblemServiceImpl extends ServiceImpl<ContestProblemMapper, ContestProblem> implements ContestProblemService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestRecord;
import top.hcode.dao.ContestRecordMapper;
import top.hcode.service.ContestRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestRecordServiceImpl extends ServiceImpl<ContestRecordMapper, ContestRecord> implements ContestRecordService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestRegister;
import top.hcode.dao.ContestRegisterMapper;
import top.hcode.service.ContestRegisterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestRegisterServiceImpl extends ServiceImpl<ContestRegisterMapper, ContestRegister> implements ContestRegisterService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ContestScore;
import top.hcode.dao.ContestScoreMapper;
import top.hcode.service.ContestScoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestScoreServiceImpl extends ServiceImpl<ContestScoreMapper, ContestScore> implements ContestScoreService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Contest;
import top.hcode.dao.ContestMapper;
import top.hcode.service.ContestService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ContestServiceImpl extends ServiceImpl<ContestMapper, Contest> implements ContestService {
}

View File

@ -0,0 +1,101 @@
package top.hcode.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import top.hcode.service.EmailService;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.util.Date;
/**
* @Author: Himit_ZH
* @Date: 2020/10/24 13:21
* @Description:
*/
@Service
public class EmailServiceImpl implements EmailService {
@Autowired
JavaMailSender mailSender;
@Override
public void sendCode(String email, String username, String code) throws MessagingException {
DateTime dateTime = DateUtil.offsetMinute(new Date(), 5);
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage,
true);
mimeMessageHelper.setSubject("HOJ的邮件提醒");
mimeMessageHelper.setText("<div style=\"background: white;\n" +
"\t\t width: 100%;\n" +
"\t\t max-width: 800px;\n" +
"\t\t margin: auto auto;\n" +
"\t\t border-radius: 5px;\n" +
"\t\t border:#1bc3fb 1px solid;\n" +
"\t\t overflow: hidden;\n" +
"\t\t -webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);\n" +
"\t\t box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.18);\">\n" +
"\t\t\t\t<header style=\"overflow: hidden;\">\n" +
"\t\t\t\t\t<center>\n" +
"\t\t\t\t\t\t<img style=\"width:100%;HEz-index: 666;\" src=\"https://cdn.jsdelivr.net/gh/HimitZH/CDN/images/HCODE.png\">\n" +
"\t\t\t\t\t</center>\n" +
"\t\t\t\t</header>\n" +
"\t\t\t\t<div style=\"padding: 5px 20px;\">\n" +
"\t\t\t\t\t<p style=\"position: relative;\n" +
"\t\t color: white;\n" +
"\t\t float: left;\n" +
"\t\t z-index: 999;\n" +
"\t\t background: #1bc3fb;\n" +
"\t\t padding: 5px 30px;\n" +
"\t\t margin: -25px auto 0 ;\n" +
"\t\t box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.30)\">\n" +
"\t\t\t\t\t\tDear "+username+"\n" +
"\t\t\t\t\t</p>\n" +
"\t\t\t\t\t<br>\n" +
"\t\t\t\t\t<center>\n" +
"\t\t\t\t\t\t<h3>\n" +
"\t\t\t\t\t\t\t来自 <span style=\"text-decoration: none;color: #FF779A; \">HOJ</span> 邮件提醒\n" +
"\t\t\t\t\t\t</h3>\n" +
"\t\t\t\t\t<p style=\"text-indent:2em; \">\n" +
"\t\t\t\t\t\t您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在<a style=\"text-decoration: none;color: #1bc3fb \" target=\"_blank\" href=\"${POST_URL}\" rel=\"noopener\">&nbsp;HOJ&nbsp;</a>上进行注册。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。\n" +
"\t\t\t\t\t</p>\n" +
"\t\t\t\t\t<div style=\"background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;text-align: center;\">\n" +
"\t\t\t\t\t\t请使用以下验证码完成后续注册流程<br>\n" +
"\t\t\t\t\t\t <span style=\"color: #FF779A;font-weight: bolder;font-size: 25px;\">"+code+"</span><br>\n" +
"\t\t\t\t\t\t 注意:请您在收到邮件5分钟内("+dateTime.toString()+"前)使用,否则该验证码将会失效。\n" +
"\t\t\t\t\t\t</div>\n" +
"\t\t\t\t\t&nbsp; &nbsp;\n" +
"\n" +
"\t\t\t\t\t<br>\n" +
"\t\t\t\t\t<div style=\"text-align: center;\">\n" +
"\t\t\t\t\t\t<a style=\"text-transform: uppercase;\n" +
"\t\t text-decoration: none;\n" +
"\t\t font-size: 14px;\n" +
"\t\t background: #FF779A;\n" +
"\t\t color: #FFFFFF;\n" +
"\t\t padding: 10px;\n" +
"\t\t display: inline-block;\n" +
"\t\t border-radius: 5px;\n" +
"\t\t margin: 10px auto 0; \"\n" +
"\t\t\t\t\t\t target=\"_blank\" href=\"oj.hcode.top\" rel=\"noopener\">HOJ传送门\uD83D\uDEAA</a>\n" +
"\t\t\t\t\t</div>\n" +
"\t\t\t\t\t<p style=\"font-size: 12px;text-align: center;color: #999;\">\n" +
"\t\t\t\t\t\t欢迎常来访问<br>\n" +
"\t\t\t\t\t\t© 2020 <a style=\"text-decoration:none; color:#1bc3fb\" href=\"${SITE_URL}\" rel=\"noopener\" target=\"_blank\">\n" +
"\t\t\t\t\t\t\tHODE-OJ </a>\n" +
"\t\t\t\t\t</p>\n" +
"\t\t\t\t\t<p></p>\n" +
"\t\t\t\t</div>\n" +
"\t\t\t</div>",true);
mimeMessageHelper.setTo(email);
mimeMessageHelper.setFrom("372347736@qq.com");
mailSender.send(mimeMessage);
}
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.JudgeCase;
import top.hcode.dao.JudgeCaseMapper;
import top.hcode.service.JudgeCaseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class JudgeCaseServiceImpl extends ServiceImpl<JudgeCaseMapper, JudgeCase> implements JudgeCaseService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Judge;
import top.hcode.dao.JudgeMapper;
import top.hcode.service.JudgeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements JudgeService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.ProblemCount;
import top.hcode.dao.ProblemCountMapper;
import top.hcode.service.ProblemCountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ProblemCountServiceImpl extends ServiceImpl<ProblemCountMapper, ProblemCount> implements ProblemCountService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Problem;
import top.hcode.dao.ProblemMapper;
import top.hcode.service.ProblemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> implements ProblemService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.RoleAuth;
import top.hcode.dao.RoleAuthMapper;
import top.hcode.service.RoleAuthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class RoleAuthServiceImpl extends ServiceImpl<RoleAuthMapper, RoleAuth> implements RoleAuthService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.Role;
import top.hcode.dao.RoleMapper;
import top.hcode.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.UserAcproblem;
import top.hcode.dao.UserAcproblemMapper;
import top.hcode.service.UserAcproblemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class UserAcproblemServiceImpl extends ServiceImpl<UserAcproblemMapper, UserAcproblem> implements UserAcproblemService {
}

View File

@ -0,0 +1,29 @@
package top.hcode.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import top.hcode.common.dto.RegisterDto;
import top.hcode.entity.UserInfo;
import top.hcode.dao.UserInfoMapper;
import top.hcode.service.UserInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {
@Autowired
private UserInfoMapper userInfoMapper;
@Override
public Integer addUser(RegisterDto registerDto) {
return userInfoMapper.addUser(registerDto);
}
}

View File

@ -0,0 +1,20 @@
package top.hcode.service.impl;
import top.hcode.entity.UserRecord;
import top.hcode.dao.UserRecordMapper;
import top.hcode.service.UserRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Himit_ZH
* @since 2020-10-23
*/
@Service
public class UserRecordServiceImpl extends ServiceImpl<UserRecordMapper, UserRecord> implements UserRecordService {
}

Some files were not shown because too many files have changed in this diff Show More