commit
cd9a330a1b
10
README.md
10
README.md
@ -12,7 +12,7 @@ forest([ˈfôrəst],n.森林)是一款现代化的知识社区项目,使
|
||||
|
||||
## ⚡ 动机
|
||||
|
||||
在 2019 年的某一天,受到 [Hugh](https://rymcu.com/user/Hugh) 的邀请, 构建一个开源嵌入式知识学习交流平台。因此就有了 forest 这个项目。 forest
|
||||
在 2019 年的某一天,受到 [Hugh](https://rymcu.com/user/RYMCU-J) 的邀请, 构建一个开源嵌入式知识学习交流平台。因此就有了 forest 这个项目。 forest
|
||||
在很多方面受到了 [Symphony](https://github.com/88250/symphony) 的启发,并尝试着在 [Symphony](https://github.com/88250/symphony)
|
||||
和 [B3log 思想](https://ld246.com/article/1546941897596) 的基础上进一步探索。
|
||||
|
||||
@ -96,4 +96,10 @@ forest([ˈfôrəst],n.森林)是一款现代化的知识社区项目,使
|
||||
|
||||
## 鸣谢
|
||||
- 感谢 `JetBrains` 对本项目的帮助,为作者提供了开源许可版 `JetBrains` 全家桶
|
||||
![JetBrains](src/main/resources/static/jetbrains.png)
|
||||
|
||||
![JetBrains](src/main/resources/static/jb_beam.svg)
|
||||
|
||||
|
||||
## ⭐ Star 历史
|
||||
|
||||
[![Stargazers over time](https://starchart.cc/rymcu/forest.svg)](https://starchart.cc/rymcu/forest)
|
||||
|
98
pom.xml
98
pom.xml
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
<version>2.7.2</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.rymcu</groupId>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<lucene.version>8.11.1</lucene.version>
|
||||
<lucene.version>8.11.2</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -40,6 +40,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
@ -49,6 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.30</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -74,8 +76,19 @@
|
||||
<groupId>com.vaadin.external.google</groupId>
|
||||
<artifactId>android-json</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>json-smart</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/net.minidev/json-smart -->
|
||||
<dependency>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>json-smart</artifactId>
|
||||
<version>2.4.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
@ -84,43 +97,37 @@
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>4.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<!-- pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.3.0</version>
|
||||
<version>5.3.1</version>
|
||||
</dependency>
|
||||
<!-- fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
<version>2.0.12</version>
|
||||
</dependency>
|
||||
<!-- shiro权限控制框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.7.1</version>
|
||||
</dependency>
|
||||
<!-- shiro-redis -->
|
||||
<dependency>
|
||||
<groupId>org.crazycake</groupId>
|
||||
<artifactId>shiro-redis</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<version>1.9.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
<!--apache相关依赖-->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
@ -151,7 +158,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
<version>1.2.11</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
@ -163,7 +170,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>2.17.1</version>
|
||||
<version>2.18.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
@ -174,7 +181,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.17.1</version>
|
||||
<version>2.18.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -185,11 +192,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.nekohtml</groupId>
|
||||
<artifactId>nekohtml</artifactId>
|
||||
<version>1.9.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
@ -197,26 +199,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jodd</groupId>
|
||||
<artifactId>jodd-http</artifactId>
|
||||
<version>6.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-open</artifactId>
|
||||
<version>4.2.5.B</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>6.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
@ -228,21 +211,6 @@
|
||||
<artifactId>jedis-lock</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.16.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- lucene -->
|
||||
<dependency>
|
||||
@ -273,12 +241,12 @@
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>5.7.20</version>
|
||||
<version>5.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.7.20</version>
|
||||
<version>5.8.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -292,8 +260,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -2,10 +2,12 @@ package com.rymcu.forest;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@EnableAsync
|
||||
@SpringBootApplication
|
||||
public class ForestApplication {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.config;
|
||||
|
||||
import com.alibaba.fastjson.support.spring.FastJsonJsonView;
|
||||
import com.rymcu.forest.core.exception.BusinessException;
|
||||
import com.rymcu.forest.core.exception.ServiceException;
|
||||
import com.rymcu.forest.core.exception.TransactionException;
|
||||
import com.rymcu.forest.core.result.GlobalResult;
|
||||
@ -62,6 +63,9 @@ public class BaseExceptionHandler {
|
||||
} else if (ex instanceof ServletException) {
|
||||
result.setCode(ResultCode.FAIL.getCode());
|
||||
result.setMessage(ex.getMessage());
|
||||
} else if (ex instanceof BusinessException) {
|
||||
result.setCode(ResultCode.FAIL.getCode());
|
||||
result.setMessage(ex.getMessage());
|
||||
} else if (ex instanceof TransactionException) {
|
||||
result.setCode(TransactionCode.InsufficientBalance.getCode());
|
||||
result.setMessage(ex.getMessage());
|
||||
@ -108,6 +112,9 @@ public class BaseExceptionHandler {
|
||||
} else if (ex instanceof ServletException) {
|
||||
attributes.put("code", ResultCode.FAIL.getCode());
|
||||
attributes.put("message", ex.getMessage());
|
||||
} else if (ex instanceof BusinessException) {
|
||||
attributes.put("code", ResultCode.FAIL.getCode());
|
||||
attributes.put("message", ex.getMessage());
|
||||
} else if (ex instanceof TransactionException) {
|
||||
attributes.put("code", TransactionCode.InsufficientBalance.getCode());
|
||||
attributes.put("message", ex.getMessage());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.rymcu.forest.core.constant.ShiroConstants;
|
||||
import com.rymcu.forest.core.exception.CaptchaException;
|
||||
import com.rymcu.forest.entity.Permission;
|
||||
@ -106,7 +107,8 @@ public class BaseShiroRealm extends AuthorizingRealm {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id; // 编号
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id; // 编号
|
||||
private String account; // 登录名
|
||||
private String name; // 姓名
|
||||
private boolean mobileLogin; // 是否手机登录
|
||||
@ -120,7 +122,7 @@ public class BaseShiroRealm extends AuthorizingRealm {
|
||||
this.mobileLogin = mobileLogin;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,11 @@ public class MybatisConfigurer {
|
||||
pageHelper.setProperties(properties);
|
||||
|
||||
//添加插件
|
||||
factory.setPlugins(new Interceptor[]{pageHelper});
|
||||
factory.setPlugins(pageHelper);
|
||||
|
||||
//添加XML目录
|
||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
factory.setMapperLocations(resolver.getResources("classpath:mapper/**/*.xml"));
|
||||
// factory.setTypeHandlersPackage("com.rymcu.forest.util.handlers");
|
||||
return factory.getObject();
|
||||
}
|
||||
|
||||
|
@ -3,14 +3,12 @@ package com.rymcu.forest.config;
|
||||
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.session.mgt.SessionManager;
|
||||
import org.apache.shiro.session.mgt.eis.MemorySessionDAO;
|
||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.crazycake.shiro.RedisCacheManager;
|
||||
import org.crazycake.shiro.RedisManager;
|
||||
import org.crazycake.shiro.RedisSessionDAO;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
@ -116,62 +114,12 @@ public class ShiroConfig implements EnvironmentAware {
|
||||
@Bean
|
||||
public SessionManager sessionManager() {
|
||||
BaseSessionManager sessionManager = new BaseSessionManager();
|
||||
sessionManager.setSessionDAO(redisSessionDAO());
|
||||
sessionManager.setSessionDAO(new MemorySessionDAO());
|
||||
sessionManager.setSessionIdUrlRewritingEnabled(false);
|
||||
sessionManager.setGlobalSessionTimeout(21600000L);
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置shiro redisManager
|
||||
* <p>
|
||||
* 使用的是shiro-redis开源插件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
public RedisManager redisManager() {
|
||||
StringBuffer host = new StringBuffer(env.getProperty("spring.redis.host"));
|
||||
host.append(":").append(env.getProperty("spring.redis.port"));
|
||||
// 设置redis配置信息
|
||||
RedisManager redisManager = new RedisManager();
|
||||
redisManager.setHost(host.toString());
|
||||
redisManager.setPassword(env.getProperty("spring.redis.password"));
|
||||
return redisManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* cacheManager 缓存 redis实现
|
||||
* <p>
|
||||
* 使用的是shiro-redis开源插件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
@Bean
|
||||
public RedisCacheManager cacheManager() {
|
||||
RedisCacheManager redisCacheManager = new RedisCacheManager();
|
||||
redisCacheManager.setRedisManager(redisManager());
|
||||
return redisCacheManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* RedisSessionDAO shiro sessionDao层的实现 通过redis
|
||||
* <p>
|
||||
* 使用的是shiro-redis开源插件
|
||||
*/
|
||||
|
||||
|
||||
@Bean
|
||||
public RedisSessionDAO redisSessionDAO() {
|
||||
RedisSessionDAO redisSessionDAO = new RedisSessionDAO();
|
||||
redisSessionDAO.setRedisManager(redisManager());
|
||||
redisSessionDAO.setExpire(21600);
|
||||
return redisSessionDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启shiro aop注解支持.
|
||||
* 使用代理方式;所以需要开启代码支持;
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
@ -54,7 +55,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*")
|
||||
.allowedOriginPatterns(CorsConfiguration.ALL)
|
||||
.allowCredentials(true)
|
||||
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH");
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.rymcu.forest.core.exception;
|
||||
|
||||
import org.apache.shiro.authc.AccountException;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/25 19:27.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
public class AccountExistsException extends AccountException {
|
||||
private static final long serialVersionUID = 3206734387536223284L;
|
||||
|
||||
public AccountExistsException() {
|
||||
}
|
||||
|
||||
public AccountExistsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AccountExistsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public AccountExistsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.rymcu.forest.core.exception;
|
||||
|
||||
/**
|
||||
* @author KKould
|
||||
*/
|
||||
public class BusinessException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 3206744387536223284L;
|
||||
|
||||
public BusinessException() {
|
||||
}
|
||||
|
||||
public BusinessException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public BusinessException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public BusinessException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.rymcu.forest.core.exception;
|
||||
|
||||
/**
|
||||
* @author KKould
|
||||
*/
|
||||
public class ContentNotExistException extends BusinessException {
|
||||
private static final long serialVersionUID = 3206734387536223284L;
|
||||
|
||||
public ContentNotExistException() {
|
||||
}
|
||||
|
||||
public ContentNotExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ContentNotExistException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ContentNotExistException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ContentNotExistException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.rymcu.forest.core.exception;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/25 19:11.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
public class NicknameOccupyException extends BusinessException {
|
||||
|
||||
private static final long serialVersionUID = 3206744387536223284L;
|
||||
|
||||
public NicknameOccupyException() {
|
||||
}
|
||||
|
||||
public NicknameOccupyException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public NicknameOccupyException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public NicknameOccupyException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public NicknameOccupyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ import com.rymcu.forest.enumerate.TransactionCode;
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public class TransactionException extends Exception {
|
||||
public class TransactionException extends BusinessException {
|
||||
|
||||
private int code;
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.rymcu.forest.core.exception;
|
||||
|
||||
/**
|
||||
* @author KKould
|
||||
*/
|
||||
public class UltraViresException extends BusinessException {
|
||||
|
||||
private static final long serialVersionUID = 3206744387536228284L;
|
||||
|
||||
public UltraViresException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UltraViresException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UltraViresException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public UltraViresException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
protected UltraViresException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -90,7 +90,7 @@ public class VisitAspect {
|
||||
if (StringUtils.isBlank(param) || "undefined".equals(param) || "null".equals(param)) {
|
||||
break;
|
||||
}
|
||||
Integer id = Integer.parseInt(param);
|
||||
Long id = Long.parseLong(param);
|
||||
articleService.incrementArticleViewCount(id);
|
||||
break;
|
||||
default:
|
||||
|
@ -76,7 +76,7 @@ public class AuthorshipAspect {
|
||||
}
|
||||
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
String idArticle;
|
||||
Integer idAuthor = 0;
|
||||
Long idAuthor = 0l;
|
||||
if (isAjax(request)) {
|
||||
Object[] objects = joinPoint.getArgs();
|
||||
JSONObject jsonObject;
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -10,14 +14,19 @@ import java.util.List;
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ArticleDTO {
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
/** 文章标题 */
|
||||
private String articleTitle;
|
||||
/** 文章缩略图 */
|
||||
private String articleThumbnailUrl;
|
||||
/** 文章作者id */
|
||||
private Integer articleAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long articleAuthorId;
|
||||
/** 文章作者 */
|
||||
private String articleAuthorName;
|
||||
/** 文章作者头像 */
|
||||
|
@ -1,18 +1,26 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ArticleTagDTO {
|
||||
|
||||
private Integer idArticleTag;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticleTag;
|
||||
|
||||
private Integer idTag;
|
||||
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
|
||||
private String tagTitle;
|
||||
|
||||
@ -22,5 +30,6 @@ public class ArticleTagDTO {
|
||||
|
||||
private String tagIconPath;
|
||||
|
||||
private Integer tagAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long tagAuthorId;
|
||||
}
|
||||
|
@ -1,14 +1,22 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Author {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String userNickname;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -8,7 +9,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ChangeEmailDTO {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String email;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.rymcu.forest.entity.Notification;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -11,7 +12,8 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class NotificationDTO extends Notification {
|
||||
|
||||
private Integer idNotification;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idNotification;
|
||||
|
||||
private String dataTitle;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -10,11 +11,14 @@ import java.util.List;
|
||||
@Data
|
||||
public class PortfolioArticleDTO {
|
||||
|
||||
private Integer id;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
|
||||
private Integer idPortfolio;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idPortfolio;
|
||||
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
|
||||
private String headImgUrl;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@ -10,11 +11,13 @@ import java.util.Date;
|
||||
@Data
|
||||
public class PortfolioDTO {
|
||||
|
||||
private Integer idPortfolio;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idPortfolio;
|
||||
/** 作品集头像 */
|
||||
private String headImgUrl;
|
||||
/** 作品集作者 */
|
||||
private Integer portfolioAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long portfolioAuthorId;
|
||||
/** 作品集作者 */
|
||||
private String portfolioAuthorName;
|
||||
/** 作品集作者头像 */
|
||||
|
23
src/main/java/com/rymcu/forest/dto/ProductDTO.java
Normal file
23
src/main/java/com/rymcu/forest/dto/ProductDTO.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.rymcu.forest.entity.Product;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created on 2022/6/21 9:38.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.dto
|
||||
*/
|
||||
@Data
|
||||
public class ProductDTO extends Product {
|
||||
/**
|
||||
* 文章内容
|
||||
*/
|
||||
private String productContent;
|
||||
/**
|
||||
* 文章内容html
|
||||
*/
|
||||
private String productContentHtml;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -8,7 +9,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class TokenUser {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String account;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -8,7 +9,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class UpdatePasswordDTO {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String password;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -8,7 +9,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class UserDTO {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String account;
|
||||
|
||||
@ -19,4 +21,6 @@ public class UserDTO {
|
||||
private String nickname;
|
||||
|
||||
private String signature;
|
||||
|
||||
private String bgImgUrl;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -13,7 +14,8 @@ import java.util.Date;
|
||||
@Data
|
||||
public class UserInfoDTO implements Serializable {
|
||||
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String account;
|
||||
|
||||
@ -46,4 +48,6 @@ public class UserInfoDTO implements Serializable {
|
||||
|
||||
private Integer onlineStatus;
|
||||
|
||||
private String bgImgUrl;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto.admin;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -8,7 +9,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class TopicTagDTO {
|
||||
|
||||
private Integer idTopic;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idTopic;
|
||||
|
||||
private Integer idTag;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idTag;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.dto.admin;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -7,7 +8,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class UserRoleDTO {
|
||||
private Integer idUser;
|
||||
|
||||
private Integer idRole;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idRole;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,13 +20,15 @@ public class Article implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
/** 文章标题 */
|
||||
private String articleTitle;
|
||||
/** 文章缩略图 */
|
||||
private String articleThumbnailUrl;
|
||||
/** 文章作者id */
|
||||
private Integer articleAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long articleAuthorId;
|
||||
/** 文章类型 */
|
||||
private String articleType;
|
||||
/** 文章标签 */
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -18,7 +19,8 @@ public class ArticleContent {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
|
||||
private String articleContent;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -21,15 +22,18 @@ public class ArticleThumbsUp implements Serializable, Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idArticleThumbsUp;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticleThumbsUp;
|
||||
/**
|
||||
* 文章表主键
|
||||
*/
|
||||
private Integer idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
/**
|
||||
* 用户表主键
|
||||
*/
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
/**
|
||||
* 点赞时间
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -21,15 +22,17 @@ public class Bank {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idBank;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idBank;
|
||||
/** 银行名称 */
|
||||
private String bankName;
|
||||
/** 银行负责人 */
|
||||
private Integer bankOwner;
|
||||
private Long bankOwner;
|
||||
/** 银行描述 */
|
||||
private String bankDescription;
|
||||
/** 创建人 */
|
||||
private Integer createdBy;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long createdBy;
|
||||
/** 创建时间 */
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdTime;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -21,15 +22,18 @@ public class BankAccount {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idBankAccount;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idBankAccount;
|
||||
/** 所属银行 */
|
||||
private Integer idBank;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idBank;
|
||||
/** 银行账户 */
|
||||
private String bankAccount;
|
||||
/** 账户余额 */
|
||||
private BigDecimal accountBalance;
|
||||
/** 账户所有者 */
|
||||
private Integer accountOwner;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long accountOwner;
|
||||
/** 创建时间 */
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdTime;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,22 +20,26 @@ public class Comment implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idComment;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idComment;
|
||||
/** 评论内容 */
|
||||
@Column(name = "comment_content")
|
||||
private String commentContent;
|
||||
/** 作者 id */
|
||||
@Column(name = "comment_author_id")
|
||||
private Integer commentAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long commentAuthorId;
|
||||
/** 文章 id */
|
||||
@Column(name = "comment_article_id")
|
||||
private Integer commentArticleId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long commentArticleId;
|
||||
/** 锚点 url */
|
||||
@Column(name = "comment_sharp_url")
|
||||
private String commentSharpUrl;
|
||||
/** 父评论 id */
|
||||
@Column(name = "comment_original_comment_id")
|
||||
private Integer commentOriginalCommentId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long commentOriginalCommentId;
|
||||
/** 状态 */
|
||||
@Column(name = "comment_status")
|
||||
private String commentStatus;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
@ -18,11 +19,13 @@ public class CurrencyIssue {
|
||||
/** 主键 */
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer id;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
/** 发行数额 */
|
||||
private BigDecimal issueValue;
|
||||
/** 发行人 */
|
||||
private Integer createdBy;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long createdBy;
|
||||
/** 发行时间 */
|
||||
private Date createdTime;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -21,7 +22,8 @@ public class CurrencyRule implements Serializable, Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idCurrencyRule;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idCurrencyRule;
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -18,13 +19,16 @@ public class Follow implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idFollow;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idFollow;
|
||||
/** 关注者 id */
|
||||
@Column(name = "follower_id")
|
||||
private Integer followerId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long followerId;
|
||||
/** 关注数据 id */
|
||||
@Column(name = "following_id")
|
||||
private Integer followingId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long followingId;
|
||||
/** 0:用户,1:标签,2:帖子收藏,3:帖子关注 */
|
||||
@Column(name = "following_type")
|
||||
private String followingType;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -21,13 +22,15 @@ public class ForestFile {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
@Column(name = "file_size")
|
||||
private long fileSize;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* 文件类型-文件后缀
|
||||
@ -68,7 +71,8 @@ public class ForestFile {
|
||||
* 创建人
|
||||
*/
|
||||
@Column(name = "created_by")
|
||||
private long createdBy;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long createdBy;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -22,7 +23,8 @@ public class LoginRecord implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
/** IP */
|
||||
@Column(name = "login_ip")
|
||||
private String loginIp;
|
||||
@ -43,7 +45,8 @@ public class LoginRecord implements Serializable,Cloneable {
|
||||
private String loginBrowser;
|
||||
/** 用户 id */
|
||||
@Column(name = "id_user")
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
/** 创建时间 */
|
||||
@Column(name = "created_time")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -23,12 +24,14 @@ public class Notification implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idNotification;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idNotification;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Column(name = "id_user")
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
@ -38,7 +41,8 @@ public class Notification implements Serializable,Cloneable {
|
||||
* 数据id
|
||||
*/
|
||||
@Column(name = "data_id")
|
||||
private Integer dataId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long dataId;
|
||||
/**
|
||||
* 数据摘要
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
|
||||
@ -19,7 +20,8 @@ public class Permission implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idPermission;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idPermission;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
@ -15,14 +16,16 @@ public class Portfolio {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idPortfolio;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idPortfolio;
|
||||
/** 作品集头像 */
|
||||
@Column(name = "portfolio_head_img_url")
|
||||
private String headImgUrl;
|
||||
/** 作品集名称 */
|
||||
private String portfolioTitle;
|
||||
/** 作品集作者 */
|
||||
private Integer portfolioAuthorId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long portfolioAuthorId;
|
||||
/** 作品集介绍 */
|
||||
private String portfolioDescription;
|
||||
/** 作品集介绍 Html */
|
||||
|
62
src/main/java/com/rymcu/forest/entity/Product.java
Normal file
62
src/main/java/com/rymcu/forest/entity/Product.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created on 2022/6/13 21:42.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @desc : 产品表
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "forest_product")
|
||||
public class Product implements Serializable, Cloneable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idProduct;
|
||||
/**
|
||||
* 产品名
|
||||
*/
|
||||
private String productTitle;
|
||||
/**
|
||||
* 单价(单位:分)
|
||||
*/
|
||||
private Integer productPrice;
|
||||
/**
|
||||
* 产品主图
|
||||
*/
|
||||
private String productImgUrl;
|
||||
/**
|
||||
* 产品描述
|
||||
*/
|
||||
private String productDescription;
|
||||
/**
|
||||
* 权重;数值越小权限越大;0:无权限
|
||||
*/
|
||||
private Integer weights;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedTime;
|
||||
}
|
44
src/main/java/com/rymcu/forest/entity/ProductContent.java
Normal file
44
src/main/java/com/rymcu/forest/entity/ProductContent.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created on 2022/6/13 21:51.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @desc : 产品详情表
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "forest_product_content")
|
||||
public class ProductContent implements Serializable, Cloneable {
|
||||
/**
|
||||
* 产品表主键
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idProduct;
|
||||
/**
|
||||
* 产品详情原文
|
||||
*/
|
||||
private String productContent;
|
||||
/**
|
||||
* 产品详情;Html
|
||||
*/
|
||||
private String productContentHtml;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedTime;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,7 +20,8 @@ public class Role implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idRole;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idRole;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,7 +20,8 @@ public class SpecialDay implements Serializable,Cloneable{
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idSpecialDay;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idSpecialDay;
|
||||
/** 名称 */
|
||||
private String specialDayName;
|
||||
/** 权重/优先级,小数优秀 */
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
@ -20,7 +21,8 @@ public class Sponsor implements Serializable, Cloneable {
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer id;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
@ -28,11 +30,13 @@ public class Sponsor implements Serializable, Cloneable {
|
||||
/**
|
||||
* 数据主键
|
||||
*/
|
||||
private Integer dataId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long dataId;
|
||||
/**
|
||||
* 赞赏人
|
||||
*/
|
||||
private Integer sponsor;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long sponsor;
|
||||
/**
|
||||
* 赞赏日期
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,7 +20,8 @@ public class Tag implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idTag;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idTag;
|
||||
/** 标签名 */
|
||||
private String tagTitle;
|
||||
/** 标签图标 */
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -19,7 +20,8 @@ public class Topic {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idTopic;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idTopic;
|
||||
/** 专题标题 */
|
||||
private String topicTitle;
|
||||
/** 专题路径 */
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -20,7 +21,8 @@ public class TransactionRecord {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idTransactionRecord;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idTransactionRecord;
|
||||
/** 交易流水号 */
|
||||
private String transactionNo;
|
||||
/** 款项 */
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
@ -21,7 +22,8 @@ public class User implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
/**
|
||||
* 登录账号
|
||||
@ -120,4 +122,10 @@ public class User implements Serializable,Cloneable {
|
||||
@Column(name = "last_online_time")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastOnlineTime;
|
||||
|
||||
/**
|
||||
* 个人中心背景图片
|
||||
* */
|
||||
@Column(name = "bg_img_url")
|
||||
private String bgImgUrl;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Id;
|
||||
@ -13,7 +14,8 @@ import javax.persistence.Table;
|
||||
public class UserExtend {
|
||||
|
||||
@Id
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
private String github;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -22,7 +23,8 @@ public class Visit implements Serializable,Cloneable {
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long id;
|
||||
/** 浏览链接 */
|
||||
@Column(name = "visit_url")
|
||||
private String visitUrl;
|
||||
@ -40,7 +42,8 @@ public class Visit implements Serializable,Cloneable {
|
||||
private String visitDeviceId;
|
||||
/** 浏览者 id */
|
||||
@Column(name = "visit_user_id")
|
||||
private Integer visitUserId;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long visitUserId;
|
||||
/** 上游链接 */
|
||||
@Column(name = "visit_referer_url")
|
||||
private String visitRefererUrl;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -17,7 +18,8 @@ public class WxUser {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idWxUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idWxUser;
|
||||
|
||||
private Boolean subscribe;
|
||||
|
||||
|
26
src/main/java/com/rymcu/forest/handler/AccountHandler.java
Normal file
26
src/main/java/com/rymcu/forest/handler/AccountHandler.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.rymcu.forest.handler;
|
||||
|
||||
import com.rymcu.forest.handler.event.AccountEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/24 14:44.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.handler
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AccountHandler {
|
||||
|
||||
@Async
|
||||
@EventListener
|
||||
public void processAccountLastLoginEvent(AccountEvent accountEvent) {
|
||||
|
||||
}
|
||||
|
||||
}
|
66
src/main/java/com/rymcu/forest/handler/ArticleHandler.java
Normal file
66
src/main/java/com/rymcu/forest/handler/ArticleHandler.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.rymcu.forest.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rymcu.forest.core.constant.NotificationConstant;
|
||||
import com.rymcu.forest.handler.event.ArticleDeleteEvent;
|
||||
import com.rymcu.forest.handler.event.ArticleEvent;
|
||||
import com.rymcu.forest.lucene.service.LuceneService;
|
||||
import com.rymcu.forest.util.NotificationUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/16 20:42.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ArticleHandler {
|
||||
@Resource
|
||||
private LuceneService luceneService;
|
||||
|
||||
@EventListener
|
||||
@Async
|
||||
public void processArticlePostEvent(ArticleEvent articleEvent) throws InterruptedException {
|
||||
Thread.sleep(1000);
|
||||
log.info(String.format("执行文章发布相关事件:[%s]", JSON.toJSONString(articleEvent)));
|
||||
// 发送系统通知
|
||||
if (articleEvent.getNotification()) {
|
||||
NotificationUtils.sendAnnouncement(articleEvent.getIdArticle(), NotificationConstant.Article, articleEvent.getArticleTitle());
|
||||
} else {
|
||||
// 发送关注通知
|
||||
StringBuilder dataSummary = new StringBuilder();
|
||||
if (articleEvent.getIsUpdate()) {
|
||||
dataSummary.append(articleEvent.getNickname()).append("更新了文章: ").append(articleEvent.getArticleTitle());
|
||||
NotificationUtils.sendArticlePush(articleEvent.getIdArticle(), NotificationConstant.UpdateArticle, dataSummary.toString(), articleEvent.getArticleAuthorId());
|
||||
} else {
|
||||
dataSummary.append(articleEvent.getNickname()).append("发布了文章: ").append(articleEvent.getArticleTitle());
|
||||
NotificationUtils.sendArticlePush(articleEvent.getIdArticle(), NotificationConstant.PostArticle, dataSummary.toString(), articleEvent.getArticleAuthorId());
|
||||
}
|
||||
}
|
||||
// 草稿不更新索引
|
||||
if (articleEvent.getIsUpdate()) {
|
||||
log.info("更新文章索引,id={}", articleEvent.getIdArticle());
|
||||
luceneService.updateArticle(articleEvent.getIdArticle());
|
||||
} else {
|
||||
log.info("写入文章索引,id={}", articleEvent.getIdArticle());
|
||||
luceneService.writeArticle(articleEvent.getIdArticle());
|
||||
}
|
||||
log.info("执行完成文章发布相关事件...id={}", articleEvent.getIdArticle());
|
||||
}
|
||||
|
||||
@EventListener
|
||||
@Async
|
||||
public void processArticleDeleteEvent(ArticleDeleteEvent articleDeleteEvent) throws InterruptedException {
|
||||
Thread.sleep(1000);
|
||||
log.info(String.format("执行文章删除相关事件:[%s]", JSON.toJSONString(articleDeleteEvent)));
|
||||
luceneService.deleteArticle(articleDeleteEvent.getIdArticle());
|
||||
log.info("执行完成文章删除相关事件...id={}", articleDeleteEvent.getIdArticle());
|
||||
}
|
||||
}
|
57
src/main/java/com/rymcu/forest/handler/CommentHandler.java
Normal file
57
src/main/java/com/rymcu/forest/handler/CommentHandler.java
Normal file
@ -0,0 +1,57 @@
|
||||
package com.rymcu.forest.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rymcu.forest.core.constant.NotificationConstant;
|
||||
import com.rymcu.forest.entity.Comment;
|
||||
import com.rymcu.forest.handler.event.CommentEvent;
|
||||
import com.rymcu.forest.mapper.CommentMapper;
|
||||
import com.rymcu.forest.util.Html2TextUtil;
|
||||
import com.rymcu.forest.util.NotificationUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/17 7:38.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.handler
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CommentHandler {
|
||||
|
||||
private static final int MAX_PREVIEW = 200;
|
||||
@Resource
|
||||
private CommentMapper commentMapper;
|
||||
|
||||
@Async
|
||||
@EventListener
|
||||
public void processCommentCreatedEvent(CommentEvent commentEvent) throws InterruptedException {
|
||||
log.info(String.format("开始执行评论发布事件:[%s]", JSON.toJSONString(commentEvent)));
|
||||
String commentContent = commentEvent.getContent();
|
||||
Integer length = commentContent.length();
|
||||
if (length > MAX_PREVIEW) {
|
||||
length = 200;
|
||||
}
|
||||
String commentPreviewContent = commentContent.substring(0, length);
|
||||
commentContent = Html2TextUtil.getContent(commentPreviewContent);
|
||||
// 判断是否是回复消息
|
||||
if (commentEvent.getCommentOriginalCommentId() != null && commentEvent.getCommentOriginalCommentId() != 0) {
|
||||
Comment originalComment = commentMapper.selectByPrimaryKey(commentEvent.getCommentOriginalCommentId());
|
||||
// 回复消息时,评论者不是上级评论作者则进行消息通知
|
||||
if (!commentEvent.getCommentAuthorId().equals(originalComment.getCommentAuthorId())) {
|
||||
NotificationUtils.saveNotification(originalComment.getCommentAuthorId(), commentEvent.getIdComment(), NotificationConstant.Comment, commentContent);
|
||||
}
|
||||
} else {
|
||||
// 评论者不是作者本人则进行消息通知
|
||||
if (!commentEvent.getCommentAuthorId().equals(commentEvent.getArticleAuthorId())) {
|
||||
NotificationUtils.saveNotification(commentEvent.getArticleAuthorId(), commentEvent.getIdComment(), NotificationConstant.Comment, commentContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.rymcu.forest.handler.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/24 14:45.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.handler.event
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class AccountEvent {
|
||||
|
||||
private String account;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.rymcu.forest.handler.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/20 18:51.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ArticleDeleteEvent {
|
||||
|
||||
private Long idArticle;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.rymcu.forest.handler.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/16 20:56.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ArticleEvent {
|
||||
|
||||
private Long idArticle;
|
||||
|
||||
private String articleTitle;
|
||||
|
||||
private Boolean isUpdate;
|
||||
|
||||
private Boolean notification;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private Long articleAuthorId;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.rymcu.forest.handler.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created on 2022/8/17 7:43.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.handler.event
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CommentEvent {
|
||||
|
||||
private Long idComment;
|
||||
|
||||
private Long articleAuthorId;
|
||||
|
||||
private Long commentAuthorId;
|
||||
|
||||
private String content;
|
||||
|
||||
private Long commentOriginalCommentId;
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
package com.rymcu.forest.jwt.service;
|
||||
|
||||
|
||||
import com.rymcu.forest.handler.event.AccountEvent;
|
||||
import com.rymcu.forest.jwt.def.JwtConstants;
|
||||
import com.rymcu.forest.jwt.model.TokenModel;
|
||||
import com.rymcu.forest.service.UserService;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -27,7 +28,7 @@ public class RedisTokenManager implements TokenManager {
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
/**
|
||||
* 生成TOKEN
|
||||
@ -62,7 +63,7 @@ public class RedisTokenManager implements TokenManager {
|
||||
String result = redisTemplate.boundValueOps(key.toString()).get();
|
||||
if (StringUtils.isBlank(result)) {
|
||||
// 更新最后在线时间
|
||||
userService.updateLastOnlineTimeByEmail(model.getUsername());
|
||||
applicationEventPublisher.publishEvent(new AccountEvent(model.getUsername()));
|
||||
redisTemplate.boundValueOps(key.toString()).set(LocalDateTime.now().toString(), JwtConstants.LAST_ONLINE_EXPIRES_MINUTE, TimeUnit.MINUTES);
|
||||
}
|
||||
return true;
|
||||
|
@ -99,7 +99,7 @@ public class LuceneSearchController {
|
||||
int endIndex = Math.min(startIndex + rows, total);
|
||||
// 分割子列表
|
||||
List<ArticleLucene> subList = resList.subList(startIndex, endIndex);
|
||||
String[] ids = subList.stream().map(ArticleLucene::getIdArticle).toArray(String[]::new);
|
||||
Long[] ids = subList.stream().map(ArticleLucene::getIdArticle).toArray(Long[]::new);
|
||||
List<ArticleDTO> articleDTOList = luceneService.getArticlesByIds(ids);
|
||||
ArticleDTO temp;
|
||||
// 写入文章关键词信息
|
||||
@ -114,7 +114,7 @@ public class LuceneSearchController {
|
||||
}
|
||||
articles.addAll(articleDTOList);
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo<>(articles);
|
||||
return GlobalResultGenerator.genSuccessResult(Utils.getArticlesGlobalResult(pageInfo));
|
||||
return GlobalResultGenerator.genSuccessResult(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +141,7 @@ public class LuceneSearchController {
|
||||
int endIndex = Math.min(startIndex + rows, total);
|
||||
// 分割子列表
|
||||
List<UserLucene> subList = resList.subList(startIndex, endIndex);
|
||||
Integer[] ids = subList.stream().map(UserLucene::getIdUser).toArray(Integer[]::new);
|
||||
Long[] ids = subList.stream().map(UserLucene::getIdUser).toArray(Long[]::new);
|
||||
List<UserDTO> userDTOList = userLuceneService.getUsersByIds(ids);
|
||||
UserDTO temp;
|
||||
// 写入文章关键词信息
|
||||
@ -156,7 +156,7 @@ public class LuceneSearchController {
|
||||
}
|
||||
users.addAll(userDTOList);
|
||||
PageInfo<UserDTO> pageInfo = new PageInfo<>(users);
|
||||
return GlobalResultGenerator.genSuccessResult(Utils.getUserGlobalResult(pageInfo));
|
||||
return GlobalResultGenerator.genSuccessResult(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,7 +183,7 @@ public class LuceneSearchController {
|
||||
int endIndex = Math.min(startIndex + rows, total);
|
||||
// 分割子列表
|
||||
List<PortfolioLucene> subList = resList.subList(startIndex, endIndex);
|
||||
String[] ids = subList.stream().map(PortfolioLucene::getIdPortfolio).toArray(String[]::new);
|
||||
Long[] ids = subList.stream().map(PortfolioLucene::getIdPortfolio).toArray(Long[]::new);
|
||||
List<PortfolioDTO> portfolioDTOList = portfolioLuceneService.getPortfoliosByIds(ids);
|
||||
PortfolioDTO temp;
|
||||
// 写入文章关键词信息
|
||||
@ -198,6 +198,6 @@ public class LuceneSearchController {
|
||||
}
|
||||
portfolios.addAll(portfolioDTOList);
|
||||
PageInfo<PortfolioDTO> pageInfo = new PageInfo<>(portfolios);
|
||||
return GlobalResultGenerator.genSuccessResult(Utils.getPortfolioGlobalResult(pageInfo));
|
||||
return GlobalResultGenerator.genSuccessResult(pageInfo);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public interface ArticleLuceneMapper {
|
||||
* @param ids 文章id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> getArticlesByIds(@Param("ids") String[] ids);
|
||||
List<ArticleDTO> getArticlesByIds(@Param("ids") Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
@ -38,6 +38,6 @@ public interface ArticleLuceneMapper {
|
||||
* @param id 文章id
|
||||
* @return
|
||||
*/
|
||||
ArticleLucene getById(@Param("id") String id);
|
||||
ArticleLucene getById(@Param("id") Long id);
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public interface PortfolioLuceneMapper {
|
||||
* @param ids 作品集id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioDTO> getPortfoliosByIds(@Param("ids") String[] ids);
|
||||
List<PortfolioDTO> getPortfoliosByIds(@Param("ids") Long[] ids);
|
||||
|
||||
/**
|
||||
* 加载作品集
|
||||
@ -40,5 +40,5 @@ public interface PortfolioLuceneMapper {
|
||||
* @param id 用户id
|
||||
* @return
|
||||
*/
|
||||
PortfolioLucene getById(@Param("id") String id);
|
||||
PortfolioLucene getById(@Param("id") Long id);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public interface UserLuceneMapper {
|
||||
* @param ids 用户id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getUsersByIds(@Param("ids") Integer[] ids);
|
||||
List<UserDTO> getUsersByIds(@Param("ids") Long[] ids);
|
||||
|
||||
/**
|
||||
* 加载 UserLucene
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.lucene.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -20,7 +21,8 @@ import javax.persistence.Id;
|
||||
public class ArticleLucene {
|
||||
|
||||
/** 文章编号 */
|
||||
private String idArticle;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idArticle;
|
||||
|
||||
/** 文章标题 */
|
||||
private String articleTitle;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.lucene.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -18,7 +19,8 @@ import lombok.NoArgsConstructor;
|
||||
public class PortfolioLucene {
|
||||
|
||||
/** 作品集编号 */
|
||||
private String idPortfolio;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idPortfolio;
|
||||
|
||||
/** 作品集名称 */
|
||||
private String portfolioTitle;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.rymcu.forest.lucene.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -22,7 +23,8 @@ import javax.persistence.Column;
|
||||
public class UserLucene {
|
||||
|
||||
/** 用户编号 */
|
||||
private Integer idUser;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private Long idUser;
|
||||
|
||||
/** 昵称 */
|
||||
private String nickname;
|
||||
|
@ -25,7 +25,7 @@ public interface LuceneService {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void writeArticle(String id);
|
||||
void writeArticle(Long id);
|
||||
|
||||
|
||||
/**
|
||||
@ -40,14 +40,14 @@ public interface LuceneService {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void updateArticle(String id);
|
||||
void updateArticle(Long id);
|
||||
|
||||
/**
|
||||
* 删除单个文章索引
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteArticle(String id);
|
||||
void deleteArticle(Long id);
|
||||
|
||||
/**
|
||||
* 关键词搜索
|
||||
@ -71,5 +71,5 @@ public interface LuceneService {
|
||||
* @param ids 文章id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> getArticlesByIds(String[] ids);
|
||||
List<ArticleDTO> getArticlesByIds(Long[] ids);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public interface PortfolioLuceneService {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void writePortfolio(String id);
|
||||
void writePortfolio(Long id);
|
||||
|
||||
/**
|
||||
* 写入单个作品集索引
|
||||
@ -39,14 +39,14 @@ public interface PortfolioLuceneService {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void updatePortfolio(String id);
|
||||
void updatePortfolio(Long id);
|
||||
|
||||
/**
|
||||
* 删除单个作品集索引
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deletePortfolio(String id);
|
||||
void deletePortfolio(Long id);
|
||||
|
||||
/**
|
||||
* 关键词搜索
|
||||
@ -70,5 +70,5 @@ public interface PortfolioLuceneService {
|
||||
* @param ids 作品集id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioDTO> getPortfoliosByIds(String[] ids);
|
||||
List<PortfolioDTO> getPortfoliosByIds(Long[] ids);
|
||||
}
|
||||
|
@ -70,5 +70,5 @@ public interface UserLuceneService {
|
||||
* @param ids 用户id(半角逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getUsersByIds(Integer[] ids);
|
||||
List<UserDTO> getUsersByIds(Long[] ids);
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ package com.rymcu.forest.lucene.service.impl;
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.ArticleTagDTO;
|
||||
import com.rymcu.forest.dto.Author;
|
||||
import com.rymcu.forest.dto.PortfolioArticleDTO;
|
||||
import com.rymcu.forest.entity.ArticleContent;
|
||||
import com.rymcu.forest.entity.User;
|
||||
import com.rymcu.forest.lucene.lucene.ArticleBeanIndex;
|
||||
import com.rymcu.forest.lucene.lucene.IKAnalyzer;
|
||||
@ -67,6 +65,7 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
try {
|
||||
int totalCount = list.size();
|
||||
int perThreadCount = 3000;
|
||||
// 加1避免线程池的参数为0
|
||||
int threadCount = totalCount / perThreadCount + (totalCount % perThreadCount == 0 ? 0 : 1);
|
||||
ExecutorService pool = Executors.newFixedThreadPool(threadCount);
|
||||
CountDownLatch countDownLatch1 = new CountDownLatch(1);
|
||||
@ -96,7 +95,7 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeArticle(String id) {
|
||||
public void writeArticle(Long id) {
|
||||
writeArticle(luceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@ -106,12 +105,12 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateArticle(String id) {
|
||||
public void updateArticle(Long id) {
|
||||
ArticleIndexUtil.updateIndex(luceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteArticle(String id) {
|
||||
public void deleteArticle(Long id) {
|
||||
ArticleIndexUtil.deleteIndex(id);
|
||||
}
|
||||
|
||||
@ -156,12 +155,11 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
float score = hit.score;
|
||||
Document hitDoc = searcher.doc(hit.doc);
|
||||
// 获取到summary
|
||||
String name = hitDoc.get("summary");
|
||||
String summary = hitDoc.get("summary");
|
||||
// 将查询的词和搜索词匹配,匹配到添加前缀和后缀
|
||||
TokenStream tokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "summary", analyzer);
|
||||
TokenStream tokenStream = TokenSources.getTokenStream("summary", searcher.getIndexReader().getTermVectors(id), summary, analyzer, -1);
|
||||
// 传入的第二个参数是查询的值
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, name, false, 10);
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, summary, false, 10);
|
||||
StringBuilder baikeValue = new StringBuilder();
|
||||
for (TextFragment textFragment : frag) {
|
||||
if ((textFragment != null) && (textFragment.getScore() > 0)) {
|
||||
@ -173,8 +171,7 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
|
||||
// 获取到title
|
||||
String title = hitDoc.get("title");
|
||||
TokenStream titleTokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "title", analyzer);
|
||||
TokenStream titleTokenStream = TokenSources.getTokenStream("title", searcher.getIndexReader().getTermVectors(id), title, analyzer, -1);
|
||||
TextFragment[] titleFrag =
|
||||
highlighter.getBestTextFragments(titleTokenStream, title, false, 10);
|
||||
StringBuilder titleValue = new StringBuilder();
|
||||
@ -185,7 +182,7 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
}
|
||||
resList.add(
|
||||
ArticleLucene.builder()
|
||||
.idArticle(hitDoc.get("id"))
|
||||
.idArticle(Long.valueOf(hitDoc.get("id")))
|
||||
.articleTitle(titleValue.toString())
|
||||
.articleContent(baikeValue.toString())
|
||||
.score(String.valueOf(score))
|
||||
@ -209,9 +206,9 @@ public class LuceneServiceImpl implements LuceneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> getArticlesByIds(String[] ids) {
|
||||
public List<ArticleDTO> getArticlesByIds(Long[] ids) {
|
||||
List<ArticleDTO> list = luceneMapper.getArticlesByIds(ids);
|
||||
list.forEach(articleDTO -> genArticle(articleDTO));
|
||||
list.forEach(this::genArticle);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -41,150 +41,150 @@ import java.util.concurrent.Executors;
|
||||
@Service
|
||||
public class PortfolioLuceneServiceImpl implements PortfolioLuceneService {
|
||||
|
||||
@Resource private PortfolioLuceneMapper portfolioLuceneMapper;
|
||||
@Resource
|
||||
private PortfolioLuceneMapper portfolioLuceneMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 将文章的数据解析为一个个关键字词存储到索引文件中
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
@Override
|
||||
public void writePortfolio(List<PortfolioLucene> list) {
|
||||
try {
|
||||
int totalCount = list.size();
|
||||
int perThreadCount = 3000;
|
||||
int threadCount = totalCount / perThreadCount + (totalCount % perThreadCount == 0 ? 0 : 1);
|
||||
ExecutorService pool = Executors.newFixedThreadPool(threadCount);
|
||||
CountDownLatch countDownLatch1 = new CountDownLatch(1);
|
||||
CountDownLatch countDownLatch2 = new CountDownLatch(threadCount);
|
||||
/**
|
||||
* 将文章的数据解析为一个个关键字词存储到索引文件中
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
@Override
|
||||
public void writePortfolio(List<PortfolioLucene> list) {
|
||||
try {
|
||||
int totalCount = list.size();
|
||||
int perThreadCount = 3000;
|
||||
// 加1避免线程池的参数为0
|
||||
int threadCount = totalCount / perThreadCount + (totalCount % perThreadCount == 0 ? 0 : 1);
|
||||
ExecutorService pool = Executors.newFixedThreadPool(threadCount);
|
||||
CountDownLatch countDownLatch1 = new CountDownLatch(1);
|
||||
CountDownLatch countDownLatch2 = new CountDownLatch(threadCount);
|
||||
|
||||
for (int i = 0; i < threadCount; i++) {
|
||||
int start = i * perThreadCount;
|
||||
int end = Math.min((i + 1) * perThreadCount, totalCount);
|
||||
List<PortfolioLucene> subList = list.subList(start, end);
|
||||
Runnable runnable =
|
||||
new PortfolioBeanIndex(LucenePath.PORTFOLIO_PATH, i, countDownLatch1, countDownLatch2, subList);
|
||||
// 子线程交给线程池管理
|
||||
pool.execute(runnable);
|
||||
}
|
||||
countDownLatch1.countDown();
|
||||
System.out.println("开始创建索引");
|
||||
// 等待所有线程都完成
|
||||
countDownLatch2.await();
|
||||
// 线程全部完成工作
|
||||
System.out.println("所有线程都创建索引完毕");
|
||||
// 释放线程池资源
|
||||
pool.shutdown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePortfolio(String id) {
|
||||
writePortfolio(portfolioLuceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePortfolio(PortfolioLucene portfolioLucene) {
|
||||
PortfolioIndexUtil.addIndex(portfolioLucene);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updatePortfolio(String id) {
|
||||
PortfolioIndexUtil.updateIndex(portfolioLuceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePortfolio(String id) {
|
||||
PortfolioIndexUtil.deleteIndex(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioLucene> getAllPortfolioLucene() {
|
||||
return portfolioLuceneMapper.getAllPortfolioLucene();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioDTO> getPortfoliosByIds(String[] ids) {
|
||||
return portfolioLuceneMapper.getPortfoliosByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioLucene> searchPortfolio(String value) {
|
||||
List<PortfolioLucene> resList = new ArrayList<>();
|
||||
ExecutorService service = Executors.newCachedThreadPool();
|
||||
// 定义分词器
|
||||
Analyzer analyzer = new IKAnalyzer();
|
||||
try {
|
||||
IndexSearcher searcher = SearchUtil.getIndexSearcherByParentPath(LucenePath.PORTFOLIO_PATH, service);
|
||||
String[] fields = {"title", "summary"};
|
||||
// 构造Query对象
|
||||
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
|
||||
|
||||
BufferedReader in =
|
||||
new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
String line = value != null ? value : in.readLine();
|
||||
Query query = parser.parse(line);
|
||||
// 最终被分词后添加的前缀和后缀处理器,默认是粗体<B></B>
|
||||
SimpleHTMLFormatter htmlFormatter =
|
||||
new SimpleHTMLFormatter("<font color=" + "\"" + "red" + "\"" + ">", "</font>");
|
||||
// 高亮搜索的词添加到高亮处理器中
|
||||
Highlighter highlighter = new Highlighter(htmlFormatter, new QueryScorer(query));
|
||||
|
||||
// 获取搜索的结果,指定返回document返回的个数
|
||||
// TODO 默认搜索结果为显示第一页,1000 条,可以优化
|
||||
TopDocs results = SearchUtil.getScoreDocsByPerPage(1, 100, searcher, query);
|
||||
ScoreDoc[] hits = results.scoreDocs;
|
||||
|
||||
// 遍历,输出
|
||||
for (ScoreDoc hit : hits) {
|
||||
int id = hit.doc;
|
||||
float score = hit.score;
|
||||
Document hitDoc = searcher.doc(hit.doc);
|
||||
// 获取到summary
|
||||
String summary = hitDoc.get("summary");
|
||||
// 将查询的词和搜索词匹配,匹配到添加前缀和后缀
|
||||
TokenStream tokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "summary", analyzer);
|
||||
// 传入的第二个参数是查询的值
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, summary, false, 10);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (TextFragment textFragment : frag) {
|
||||
if ((textFragment != null) && (textFragment.getScore() > 0)) {
|
||||
// if ((frag[j] != null)) {
|
||||
// 获取 summary 的值
|
||||
sb.append(textFragment.toString());
|
||||
}
|
||||
for (int i = 0; i < threadCount; i++) {
|
||||
int start = i * perThreadCount;
|
||||
int end = Math.min((i + 1) * perThreadCount, totalCount);
|
||||
List<PortfolioLucene> subList = list.subList(start, end);
|
||||
Runnable runnable =
|
||||
new PortfolioBeanIndex(LucenePath.PORTFOLIO_PATH, i, countDownLatch1, countDownLatch2, subList);
|
||||
// 子线程交给线程池管理
|
||||
pool.execute(runnable);
|
||||
}
|
||||
countDownLatch1.countDown();
|
||||
System.out.println("开始创建索引");
|
||||
// 等待所有线程都完成
|
||||
countDownLatch2.await();
|
||||
// 线程全部完成工作
|
||||
System.out.println("所有线程都创建索引完毕");
|
||||
// 释放线程池资源
|
||||
pool.shutdown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 获取到title
|
||||
String title = hitDoc.get("title");
|
||||
TokenStream titleTokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "title", analyzer);
|
||||
TextFragment[] titleFrag =
|
||||
highlighter.getBestTextFragments(titleTokenStream, title, false, 10);
|
||||
StringBuilder titleValue = new StringBuilder();
|
||||
for (int j = 0; j < titleFrag.length; j++) {
|
||||
if ((frag[j] != null)) {
|
||||
titleValue.append(titleFrag[j].toString());
|
||||
}
|
||||
}
|
||||
resList.add(
|
||||
PortfolioLucene.builder()
|
||||
.idPortfolio(hitDoc.get("id"))
|
||||
.portfolioTitle(titleValue.toString())
|
||||
.portfolioDescription(sb.toString())
|
||||
.score(String.valueOf(score))
|
||||
.build());
|
||||
}
|
||||
} catch (IOException | ParseException | InvalidTokenOffsetsException e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
service.shutdownNow();
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePortfolio(Long id) {
|
||||
writePortfolio(portfolioLuceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePortfolio(PortfolioLucene portfolioLucene) {
|
||||
PortfolioIndexUtil.addIndex(portfolioLucene);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updatePortfolio(Long id) {
|
||||
PortfolioIndexUtil.updateIndex(portfolioLuceneMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePortfolio(Long id) {
|
||||
PortfolioIndexUtil.deleteIndex(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioLucene> getAllPortfolioLucene() {
|
||||
return portfolioLuceneMapper.getAllPortfolioLucene();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioDTO> getPortfoliosByIds(Long[] ids) {
|
||||
return portfolioLuceneMapper.getPortfoliosByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PortfolioLucene> searchPortfolio(String value) {
|
||||
List<PortfolioLucene> resList = new ArrayList<>();
|
||||
ExecutorService service = Executors.newCachedThreadPool();
|
||||
// 定义分词器
|
||||
Analyzer analyzer = new IKAnalyzer();
|
||||
try {
|
||||
IndexSearcher searcher = SearchUtil.getIndexSearcherByParentPath(LucenePath.PORTFOLIO_PATH, service);
|
||||
String[] fields = {"title", "summary"};
|
||||
// 构造Query对象
|
||||
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer);
|
||||
|
||||
BufferedReader in =
|
||||
new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
String line = value != null ? value : in.readLine();
|
||||
Query query = parser.parse(line);
|
||||
// 最终被分词后添加的前缀和后缀处理器,默认是粗体<B></B>
|
||||
SimpleHTMLFormatter htmlFormatter =
|
||||
new SimpleHTMLFormatter("<font color=" + "\"" + "red" + "\"" + ">", "</font>");
|
||||
// 高亮搜索的词添加到高亮处理器中
|
||||
Highlighter highlighter = new Highlighter(htmlFormatter, new QueryScorer(query));
|
||||
|
||||
// 获取搜索的结果,指定返回document返回的个数
|
||||
// TODO 默认搜索结果为显示第一页,1000 条,可以优化
|
||||
TopDocs results = SearchUtil.getScoreDocsByPerPage(1, 100, searcher, query);
|
||||
ScoreDoc[] hits = results.scoreDocs;
|
||||
|
||||
// 遍历,输出
|
||||
for (ScoreDoc hit : hits) {
|
||||
int id = hit.doc;
|
||||
float score = hit.score;
|
||||
Document hitDoc = searcher.doc(hit.doc);
|
||||
// 获取到summary
|
||||
String summary = hitDoc.get("summary");
|
||||
// 将查询的词和搜索词匹配,匹配到添加前缀和后缀
|
||||
TokenStream tokenStream = TokenSources.getTokenStream("summary", searcher.getIndexReader().getTermVectors(id), summary, analyzer, -1);
|
||||
// 传入的第二个参数是查询的值
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, summary, false, 10);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (TextFragment textFragment : frag) {
|
||||
if ((textFragment != null) && (textFragment.getScore() > 0)) {
|
||||
// if ((frag[j] != null)) {
|
||||
// 获取 summary 的值
|
||||
sb.append(textFragment);
|
||||
}
|
||||
}
|
||||
// 获取到title
|
||||
String title = hitDoc.get("title");
|
||||
TokenStream titleTokenStream = TokenSources.getTokenStream("title", searcher.getIndexReader().getTermVectors(id), title, analyzer, -1);
|
||||
TextFragment[] titleFrag =
|
||||
highlighter.getBestTextFragments(titleTokenStream, title, false, 10);
|
||||
StringBuilder titleValue = new StringBuilder();
|
||||
for (int j = 0; j < titleFrag.length; j++) {
|
||||
if ((frag[j] != null)) {
|
||||
titleValue.append(titleFrag[j].toString());
|
||||
}
|
||||
}
|
||||
resList.add(
|
||||
PortfolioLucene.builder()
|
||||
.idPortfolio(Long.valueOf(hitDoc.get("id")))
|
||||
.portfolioTitle(titleValue.toString())
|
||||
.portfolioDescription(sb.toString())
|
||||
.score(String.valueOf(score))
|
||||
.build());
|
||||
}
|
||||
} catch (IOException | ParseException | InvalidTokenOffsetsException e) {
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
service.shutdownNow();
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
}
|
||||
|
@ -133,13 +133,13 @@ public class UserLuceneServiceImpl implements UserLuceneService {
|
||||
int id = hit.doc;
|
||||
float score = hit.score;
|
||||
Document hitDoc = searcher.doc(hit.doc);
|
||||
// 获取到summary
|
||||
String name = hitDoc.get("signature");
|
||||
// 获取到 signature
|
||||
String signature = hitDoc.get("signature");
|
||||
// 将查询的词和搜索词匹配,匹配到添加前缀和后缀
|
||||
TokenStream tokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "signature", analyzer);
|
||||
TokenStream tokenStream = TokenSources.getTokenStream("signature", searcher.getIndexReader().getTermVectors(id), signature, analyzer, -1);
|
||||
|
||||
// 传入的第二个参数是查询的值
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, name, false, 10);
|
||||
TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, signature, false, 10);
|
||||
StringBuilder baikeValue = new StringBuilder();
|
||||
for (TextFragment textFragment : frag) {
|
||||
if ((textFragment != null) && (textFragment.getScore() > 0)) {
|
||||
@ -148,12 +148,11 @@ public class UserLuceneServiceImpl implements UserLuceneService {
|
||||
baikeValue.append(textFragment.toString());
|
||||
}
|
||||
}
|
||||
// 获取到title
|
||||
String title = hitDoc.get("nickname");
|
||||
TokenStream titleTokenStream =
|
||||
TokenSources.getAnyTokenStream(searcher.getIndexReader(), id, "nickname", analyzer);
|
||||
// 获取到 nickname
|
||||
String nickname = hitDoc.get("nickname");
|
||||
TokenStream titleTokenStream = TokenSources.getTokenStream("nickname", searcher.getIndexReader().getTermVectors(id), nickname, analyzer, -1);
|
||||
TextFragment[] titleFrag =
|
||||
highlighter.getBestTextFragments(titleTokenStream, title, false, 10);
|
||||
highlighter.getBestTextFragments(titleTokenStream, nickname, false, 10);
|
||||
StringBuilder titleValue = new StringBuilder();
|
||||
for (int j = 0; j < titleFrag.length; j++) {
|
||||
if ((frag[j] != null)) {
|
||||
@ -162,7 +161,7 @@ public class UserLuceneServiceImpl implements UserLuceneService {
|
||||
}
|
||||
resList.add(
|
||||
UserLucene.builder()
|
||||
.idUser(Integer.valueOf(hitDoc.get("id")))
|
||||
.idUser(Long.valueOf(hitDoc.get("id")))
|
||||
.nickname(titleValue.toString())
|
||||
.signature(baikeValue.toString())
|
||||
.score(String.valueOf(score))
|
||||
@ -183,7 +182,7 @@ public class UserLuceneServiceImpl implements UserLuceneService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> getUsersByIds(Integer[] ids) {
|
||||
public List<UserDTO> getUsersByIds(Long[] ids) {
|
||||
return userLuceneMapper.getUsersByIds(ids);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.rymcu.forest.lucene.util;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.rymcu.forest.lucene.model.ArticleLucene;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
@ -12,6 +11,7 @@ import org.apache.lucene.index.Term;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* 文章索引更新工具类
|
||||
@ -20,65 +20,85 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class ArticleIndexUtil {
|
||||
|
||||
/** lucene索引保存目录 */
|
||||
private static final String PATH =
|
||||
System.getProperty("user.dir") + StrUtil.SLASH + LucenePath.ARTICLE_INDEX_PATH;
|
||||
/**
|
||||
* lucene索引保存目录
|
||||
*/
|
||||
private static final String PATH =
|
||||
System.getProperty("user.dir") + LucenePath.ARTICLE_INDEX_PATH;
|
||||
|
||||
/** 删除所有运行中保存的索引 */
|
||||
public static void deleteAllIndex() {
|
||||
if (FileUtil.exist(LucenePath.ARTICLE_INCREMENT_INDEX_PATH)) {
|
||||
FileUtil.del(LucenePath.ARTICLE_INCREMENT_INDEX_PATH);
|
||||
/**
|
||||
* 删除所有运行中保存的索引
|
||||
*/
|
||||
public static void deleteAllIndex() {
|
||||
if (FileUtil.exist(LucenePath.ARTICLE_INCREMENT_INDEX_PATH)) {
|
||||
FileUtil.del(LucenePath.ARTICLE_INCREMENT_INDEX_PATH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addIndex(ArticleLucene t) {
|
||||
creatIndex(t);
|
||||
}
|
||||
|
||||
public static void updateIndex(ArticleLucene t) {
|
||||
deleteIndex(t.getIdArticle());
|
||||
creatIndex(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加或创建单个索引
|
||||
*
|
||||
* @param t
|
||||
* @throws Exception
|
||||
*/
|
||||
private static synchronized void creatIndex(ArticleLucene t) {
|
||||
System.out.println("创建单个索引");
|
||||
IndexWriter writer;
|
||||
try {
|
||||
writer = IndexUtil.getIndexWriter(LucenePath.ARTICLE_INCREMENT_INDEX_PATH, false);
|
||||
Document doc = new Document();
|
||||
doc.add(new StringField("id", t.getIdArticle() + "", Field.Store.YES));
|
||||
doc.add(new TextField("title", t.getArticleTitle(), Field.Store.YES));
|
||||
doc.add(new TextField("summary", t.getArticleContent(), Field.Store.YES));
|
||||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
public static void addIndex(ArticleLucene t) {
|
||||
creatIndex(t);
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除单个索引 */
|
||||
public static synchronized void deleteIndex(String id) {
|
||||
Arrays.stream(FileUtil.ls(PATH))
|
||||
.forEach(
|
||||
each -> {
|
||||
if (each.isDirectory()) {
|
||||
IndexWriter writer;
|
||||
try {
|
||||
writer = IndexUtil.getIndexWriter(each.getAbsolutePath(), false);
|
||||
writer.deleteDocuments(new Term("id", id));
|
||||
writer.forceMergeDeletes(); // 强制删除
|
||||
writer.commit();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void updateIndex(ArticleLucene t) {
|
||||
deleteIndex(t.getIdArticle());
|
||||
creatIndex(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加或创建单个索引
|
||||
*
|
||||
* @param t
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void creatIndex(ArticleLucene t) {
|
||||
System.out.printf("创建单个索引");
|
||||
IndexWriter writer;
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
reentrantLock.lock();
|
||||
try {
|
||||
boolean create = true;
|
||||
if (FileUtil.exist(LucenePath.ARTICLE_INCREMENT_INDEX_PATH)) {
|
||||
create = false;
|
||||
}
|
||||
writer = IndexUtil.getIndexWriter(LucenePath.ARTICLE_INCREMENT_INDEX_PATH, create);
|
||||
Document doc = new Document();
|
||||
doc.add(new StringField("id", t.getIdArticle() + "", Field.Store.YES));
|
||||
doc.add(new TextField("title", t.getArticleTitle(), Field.Store.YES));
|
||||
doc.add(new TextField("summary", t.getArticleContent(), Field.Store.YES));
|
||||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
reentrantLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个索引
|
||||
*/
|
||||
public static void deleteIndex(Long id) {
|
||||
Arrays.stream(FileUtil.ls(PATH))
|
||||
.forEach(
|
||||
each -> {
|
||||
if (each.isDirectory()) {
|
||||
IndexWriter writer;
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
reentrantLock.lock();
|
||||
try {
|
||||
writer = IndexUtil.getIndexWriter(each.getAbsolutePath(), false);
|
||||
writer.deleteDocuments(new Term("id", String.valueOf(id)));
|
||||
writer.forceMerge(1);
|
||||
// 强制删除
|
||||
writer.forceMergeDeletes();
|
||||
writer.commit();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
reentrantLock.unlock();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package com.rymcu.forest.lucene.util;
|
||||
public final class LucenePath {
|
||||
|
||||
/** lucene 目录 */
|
||||
public static final String INDEX_PATH = "lucene/index";
|
||||
public static final String INDEX_PATH = "/lucene/index";
|
||||
|
||||
/** 文章 lucene 目录 */
|
||||
public static final String ARTICLE_INDEX_PATH = INDEX_PATH + "/article";
|
||||
|
@ -63,7 +63,7 @@ public class PortfolioIndexUtil {
|
||||
}
|
||||
|
||||
/** 删除单个索引 */
|
||||
public static synchronized void deleteIndex(String id) {
|
||||
public static synchronized void deleteIndex(Long id) {
|
||||
Arrays.stream(FileUtil.ls(PATH))
|
||||
.forEach(
|
||||
each -> {
|
||||
@ -71,7 +71,7 @@ public class PortfolioIndexUtil {
|
||||
IndexWriter writer;
|
||||
try {
|
||||
writer = IndexUtil.getIndexWriter(each.getAbsolutePath(), false);
|
||||
writer.deleteDocuments(new Term("id", id));
|
||||
writer.deleteDocuments(new Term("id", String.valueOf(id)));
|
||||
writer.forceMergeDeletes(); // 强制删除
|
||||
writer.commit();
|
||||
writer.close();
|
||||
|
@ -30,7 +30,7 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
ArticleDTO selectArticleDTOById(@Param("id") Integer id, @Param("type") int type);
|
||||
ArticleDTO selectArticleDTOById(@Param("id") Long id, @Param("type") int type);
|
||||
|
||||
/**
|
||||
* 保存文章内容
|
||||
@ -39,7 +39,7 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param articleContentHtml
|
||||
* @return
|
||||
*/
|
||||
Integer insertArticleContent(@Param("idArticle") Integer idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
|
||||
Integer insertArticleContent(@Param("idArticle") Long idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
|
||||
|
||||
/**
|
||||
* 更新文章内容
|
||||
@ -48,14 +48,14 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param articleContentHtml
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleContent(@Param("idArticle") Integer idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
|
||||
Integer updateArticleContent(@Param("idArticle") Long idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
|
||||
|
||||
/**
|
||||
* 获取文章正文内容
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
ArticleContent selectArticleContent(@Param("idArticle") Integer idArticle);
|
||||
ArticleContent selectArticleContent(@Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 获取主题下文章列表
|
||||
@ -76,21 +76,21 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectUserArticles(@Param("idUser") Integer idUser);
|
||||
List<ArticleDTO> selectUserArticles(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 删除文章标签
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Integer deleteTagArticle(@Param("id") Integer id);
|
||||
Integer deleteTagArticle(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 获取文章标签列表
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
List<ArticleTagDTO> selectTags(@Param("idArticle") Integer idArticle);
|
||||
List<ArticleTagDTO> selectTags(@Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 更新文章浏览数
|
||||
@ -98,28 +98,28 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param articleViewCount
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleViewCount(@Param("id") Integer id, @Param("articleViewCount") Integer articleViewCount);
|
||||
Integer updateArticleViewCount(@Param("id") Long id, @Param("articleViewCount") Integer articleViewCount);
|
||||
|
||||
/**
|
||||
* 获取草稿列表
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectDrafts(@Param("idUser") Integer idUser);
|
||||
List<ArticleDTO> selectDrafts(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 删除未使用的文章标签
|
||||
* @param idArticleTag
|
||||
* @return
|
||||
*/
|
||||
Integer deleteUnusedArticleTag(@Param("idArticleTag") Integer idArticleTag);
|
||||
Integer deleteUnusedArticleTag(@Param("idArticleTag") Long idArticleTag);
|
||||
|
||||
/**
|
||||
* 查询作品集下文章
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio);
|
||||
List<ArticleDTO> selectArticlesByIdPortfolio(@Param("idPortfolio") Long idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询作品集未绑定文章
|
||||
@ -128,14 +128,14 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectUnbindArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio, @Param("searchText") String searchText, @Param("idUser") Integer idUser);
|
||||
List<ArticleDTO> selectUnbindArticlesByIdPortfolio(@Param("idPortfolio") Long idPortfolio, @Param("searchText") String searchText, @Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 查询文章所属作品集列表
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioArticleDTO> selectPortfolioArticles(@Param("idArticle") Integer idArticle);
|
||||
List<PortfolioArticleDTO> selectPortfolioArticles(@Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 更新文章标签
|
||||
@ -143,21 +143,21 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param tags
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleTags(@Param("idArticle") Integer idArticle, @Param("tags") String tags);
|
||||
Integer updateArticleTags(@Param("idArticle") Long idArticle, @Param("tags") String tags);
|
||||
|
||||
/**
|
||||
* 判断是否有评论
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean existsCommentWithPrimaryKey(@Param("id") Integer id);
|
||||
boolean existsCommentWithPrimaryKey(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 删除关联作品集数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Integer deleteLinkedPortfolioData(@Param("id") Integer id);
|
||||
Integer deleteLinkedPortfolioData(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 更新文章连接及预览内容
|
||||
@ -167,7 +167,7 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param articlePreviewContent
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleLinkAndPreviewContent(@Param("idArticle") Integer idArticle, @Param("articleLink") String articleLink, @Param("articlePermalink") String articlePermalink, @Param("articlePreviewContent") String articlePreviewContent);
|
||||
Integer updateArticleLinkAndPreviewContent(@Param("idArticle") Long idArticle, @Param("articleLink") String articleLink, @Param("articlePermalink") String articlePermalink, @Param("articlePreviewContent") String articlePreviewContent);
|
||||
|
||||
/**
|
||||
* 根据专题主键及当前文章排序号获取专题下文章大纲
|
||||
@ -175,7 +175,7 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param sortNo
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectPortfolioArticlesByIdPortfolioAndSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("sortNo") Integer sortNo);
|
||||
List<ArticleDTO> selectPortfolioArticlesByIdPortfolioAndSortNo(@Param("idPortfolio") Long idPortfolio, @Param("sortNo") Integer sortNo);
|
||||
|
||||
/**
|
||||
* 更新文章优选状态
|
||||
@ -183,13 +183,13 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param articlePerfect
|
||||
* @return
|
||||
*/
|
||||
int updatePerfect(@Param("idArticle") Integer idArticle, @Param("articlePerfect") String articlePerfect);
|
||||
int updatePerfect(@Param("idArticle") Long idArticle, @Param("articlePerfect") String articlePerfect);
|
||||
|
||||
/**
|
||||
* 删除文章关联文章内容表信息
|
||||
* @param idArticle
|
||||
*/
|
||||
void deleteArticleContent(@Param("idArticle") Integer idArticle);
|
||||
void deleteArticleContent(@Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 获取公告
|
||||
|
@ -14,5 +14,5 @@ public interface ArticleThumbsUpMapper extends Mapper<ArticleThumbsUp> {
|
||||
* @param thumbsUpNumber
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleThumbsUpNumber(@Param("idArticle") Integer idArticle, @Param("thumbsUpNumber") Integer thumbsUpNumber);
|
||||
Integer updateArticleThumbsUpNumber(@Param("idArticle") Long idArticle, @Param("thumbsUpNumber") Integer thumbsUpNumber);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public interface BankAccountMapper extends Mapper<BankAccount> {
|
||||
* @param idBank
|
||||
* @return
|
||||
*/
|
||||
BankAccountDTO selectBankAccount(@Param("idBank") Integer idBank);
|
||||
BankAccountDTO selectBankAccount(@Param("idBank") Long idBank);
|
||||
|
||||
/**
|
||||
* 获取当前最大卡号
|
||||
@ -39,4 +39,11 @@ public interface BankAccountMapper extends Mapper<BankAccount> {
|
||||
* @return
|
||||
*/
|
||||
BankAccountDTO selectByBankAccount(@Param("bankAccount") String bankAccount);
|
||||
|
||||
/**
|
||||
* 查询用户个人银行账户信息
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
BankAccountDTO findPersonBankAccountByIdUser(@Param("idUser") Long idUser);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public interface CommentMapper extends Mapper<Comment> {
|
||||
* @param commentSharpUrl
|
||||
* @return
|
||||
*/
|
||||
Integer updateCommentSharpUrl(@Param("idComment") Integer idComment, @Param("commentSharpUrl") String commentSharpUrl);
|
||||
Integer updateCommentSharpUrl(@Param("idComment") Long idComment, @Param("commentSharpUrl") String commentSharpUrl);
|
||||
|
||||
/**
|
||||
* 获取评论列表数据
|
||||
|
@ -18,19 +18,19 @@ public interface FollowMapper extends Mapper<Follow> {
|
||||
* @param followingType
|
||||
* @return
|
||||
*/
|
||||
Boolean isFollow(@Param("followingId") Integer followingId, @Param("followerId") Integer followerId, @Param("followingType") String followingType);
|
||||
Boolean isFollow(@Param("followingId") Integer followingId, @Param("followerId") Long followerId, @Param("followingType") String followingType);
|
||||
|
||||
/**
|
||||
* 查询用户粉丝
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> selectUserFollowersByUser(@Param("idUser") Integer idUser);
|
||||
List<UserDTO> selectUserFollowersByUser(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 查询用户关注用户
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> selectUserFollowingsByUser(@Param("idUser") Integer idUser);
|
||||
List<UserDTO> selectUserFollowingsByUser(@Param("idUser") Long idUser);
|
||||
}
|
||||
|
@ -17,14 +17,14 @@ public interface NotificationMapper extends Mapper<Notification> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<Notification> selectUnreadNotifications(@Param("idUser") Integer idUser);
|
||||
List<Notification> selectUnreadNotifications(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 获取消息数据
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<NotificationDTO> selectNotifications(@Param("idUser") Integer idUser);
|
||||
List<NotificationDTO> selectNotifications(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 获取消息数据
|
||||
@ -33,7 +33,7 @@ public interface NotificationMapper extends Mapper<Notification> {
|
||||
* @param dataType
|
||||
* @return
|
||||
*/
|
||||
Notification selectNotification(@Param("idUser") Integer idUser, @Param("dataId") Integer dataId, @Param("dataType") String dataType);
|
||||
Notification selectNotification(@Param("idUser") Long idUser, @Param("dataId") Long dataId, @Param("dataType") String dataType);
|
||||
|
||||
/**
|
||||
* 创建消息通知
|
||||
@ -43,21 +43,21 @@ public interface NotificationMapper extends Mapper<Notification> {
|
||||
* @param dataSummary
|
||||
* @return
|
||||
*/
|
||||
Integer insertNotification(@Param("idUser") Integer idUser, @Param("dataId") Integer dataId, @Param("dataType") String dataType, @Param("dataSummary") String dataSummary);
|
||||
Integer insertNotification(@Param("idUser") Long idUser, @Param("dataId") Long dataId, @Param("dataType") String dataType, @Param("dataSummary") String dataSummary);
|
||||
|
||||
/**
|
||||
* 标记消息已读
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Integer readNotification(@Param("id") Integer id);
|
||||
Integer readNotification(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 标记所有消息已读
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
Integer readAllNotification(@Param("idUser") Integer idUser);
|
||||
Integer readAllNotification(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 删除相关未读消息
|
||||
@ -65,5 +65,5 @@ public interface NotificationMapper extends Mapper<Notification> {
|
||||
* @param dataType
|
||||
* @return
|
||||
*/
|
||||
Integer deleteUnreadNotification(@Param("dataId") Integer dataId, @Param("dataType") String dataType);
|
||||
Integer deleteUnreadNotification(@Param("dataId") Long dataId, @Param("dataType") String dataType);
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ import java.util.List;
|
||||
|
||||
public interface PermissionMapper extends Mapper<Permission> {
|
||||
|
||||
List<Permission> selectMenuByIdRole(@Param("role") Integer role);
|
||||
List<Permission> selectMenuByIdRole(@Param("role") Long role);
|
||||
}
|
@ -16,7 +16,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<PortfolioDTO> selectUserPortfoliosByIdUser(@Param("idUser") Integer idUser);
|
||||
List<PortfolioDTO> selectUserPortfoliosByIdUser(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 查询作品集
|
||||
@ -24,14 +24,14 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
PortfolioDTO selectPortfolioDTOById(@Param("id") Integer id, @Param("type") Integer type);
|
||||
PortfolioDTO selectPortfolioDTOById(@Param("id") Long id, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 统计作品集下文章数
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountArticleNumber(@Param("idPortfolio") Integer idPortfolio);
|
||||
Integer selectCountArticleNumber(@Param("idPortfolio") Long idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询文章是否已绑定
|
||||
@ -39,7 +39,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio);
|
||||
Integer selectCountPortfolioArticle(@Param("idArticle") Long idArticle, @Param("idPortfolio") Long idPortfolio);
|
||||
|
||||
/**
|
||||
* 插入文章与作品集绑定数据
|
||||
@ -48,14 +48,14 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param maxSortNo
|
||||
* @return
|
||||
*/
|
||||
Integer insertPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio, @Param("maxSortNo") Integer maxSortNo);
|
||||
Integer insertPortfolioArticle(@Param("idArticle") Long idArticle, @Param("idPortfolio") Long idPortfolio, @Param("maxSortNo") Integer maxSortNo);
|
||||
|
||||
/**
|
||||
* 查询作品集下最大排序号
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
Integer selectMaxSortNo(@Param("idPortfolio") Integer idPortfolio);
|
||||
Integer selectMaxSortNo(@Param("idPortfolio") Long idPortfolio);
|
||||
|
||||
/**
|
||||
* 更新文章排序号
|
||||
@ -64,7 +64,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param sortNo
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle, @Param("sortNo") Integer sortNo);
|
||||
Integer updateArticleSortNo(@Param("idPortfolio") Long idPortfolio, @Param("idArticle") Long idArticle, @Param("sortNo") Integer sortNo);
|
||||
|
||||
/**
|
||||
* 取消绑定文章
|
||||
@ -72,7 +72,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Integer unbindArticle(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle);
|
||||
Integer unbindArticle(@Param("idPortfolio") Long idPortfolio, @Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 获取作品集列表数据
|
||||
|
39
src/main/java/com/rymcu/forest/mapper/ProductMapper.java
Normal file
39
src/main/java/com/rymcu/forest/mapper/ProductMapper.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.rymcu.forest.mapper;
|
||||
|
||||
import com.rymcu.forest.core.mapper.Mapper;
|
||||
import com.rymcu.forest.dto.ProductDTO;
|
||||
import com.rymcu.forest.entity.Product;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2022/6/13 21:53.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
*/
|
||||
public interface ProductMapper extends Mapper<Product> {
|
||||
/**
|
||||
* 保存产品详情
|
||||
* @param idProduct
|
||||
* @param productContent
|
||||
* @param productContentHtml
|
||||
* @return
|
||||
*/
|
||||
Integer insertProductContent(@Param("idProduct") Integer idProduct, @Param("productContent") String productContent, @Param("productContentHtml") String productContentHtml);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
* @return
|
||||
*/
|
||||
List<ProductDTO> selectProducts();
|
||||
|
||||
/**
|
||||
* 获取产品详情
|
||||
* @param idProduct
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
ProductDTO selectProductDTOById(@Param("idProduct") Integer idProduct, @Param("type") Integer type);
|
||||
}
|
@ -8,11 +8,11 @@ import java.util.List;
|
||||
|
||||
public interface RoleMapper extends Mapper<Role> {
|
||||
|
||||
List<Role> selectRoleByIdUser(@Param("id") Integer id);
|
||||
List<Role> selectRoleByIdUser(@Param("id") Long id);
|
||||
|
||||
Role selectRoleByInputCode(@Param("inputCode") String inputCode);
|
||||
|
||||
Integer updateStatus(@Param("idRole") Integer idRole, @Param("status") String status);
|
||||
Integer updateStatus(@Param("idRole") Long idRole, @Param("status") String status);
|
||||
|
||||
Integer update(@Param("idRole") Integer idRole, @Param("name") String name, @Param("inputCode") String inputCode, @Param("weights") Integer weights);
|
||||
Integer update(@Param("idRole") Long idRole, @Param("name") String name, @Param("inputCode") String inputCode, @Param("weights") Integer weights);
|
||||
}
|
@ -13,5 +13,5 @@ public interface SponsorMapper extends Mapper<Sponsor> {
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Integer updateArticleSponsorCount(@Param("idArticle") Integer idArticle);
|
||||
Integer updateArticleSponsorCount(@Param("idArticle") Long idArticle);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public interface TagMapper extends Mapper<Tag> {
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||
Integer insertTagArticle(@Param("idTag") Long idTag, @Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 统计标签使用数(文章)
|
||||
@ -26,7 +26,7 @@ public interface TagMapper extends Mapper<Tag> {
|
||||
* @param idArticle
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||
Integer selectCountTagArticleById(@Param("idTag") Long idTag, @Param("idArticle") Long idArticle);
|
||||
|
||||
/**
|
||||
* 获取用户标签数
|
||||
@ -34,7 +34,7 @@ public interface TagMapper extends Mapper<Tag> {
|
||||
* @param idTag
|
||||
* @return
|
||||
*/
|
||||
Integer selectCountUserTagById(@Param("idUser") Integer idUser, @Param("idTag") Integer idTag);
|
||||
Integer selectCountUserTagById(@Param("idUser") Long idUser, @Param("idTag") Long idTag);
|
||||
|
||||
/**
|
||||
* 插入用户标签信息
|
||||
@ -43,7 +43,7 @@ public interface TagMapper extends Mapper<Tag> {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Integer idUser, @Param("type") Integer type);
|
||||
Integer insertUserTag(@Param("idTag") Long idTag, @Param("idUser") Long idUser, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 删除未使用标签
|
||||
@ -61,7 +61,7 @@ public interface TagMapper extends Mapper<Tag> {
|
||||
* @param tagReservation
|
||||
* @return
|
||||
*/
|
||||
Integer update(@Param("idTag") Integer idTag, @Param("tagUri") String tagUri, @Param("tagIconPath") String tagIconPath, @Param("tagStatus") String tagStatus, @Param("tagDescription") String tagDescription, @Param("tagReservation") String tagReservation);
|
||||
Integer update(@Param("idTag") Long idTag, @Param("tagUri") String tagUri, @Param("tagIconPath") String tagIconPath, @Param("tagStatus") String tagStatus, @Param("tagDescription") String tagDescription, @Param("tagReservation") String tagReservation);
|
||||
|
||||
/**
|
||||
* 查询标签列表
|
||||
|
@ -44,21 +44,21 @@ public interface TopicMapper extends Mapper<Topic> {
|
||||
* @param topicDescriptionHtml
|
||||
* @return
|
||||
*/
|
||||
Integer update(@Param("idTopic") Integer idTopic, @Param("topicTitle") String topicTitle, @Param("topicUri") String topicUri, @Param("topicIconPath") String topicIconPath, @Param("topicNva") String topicNva, @Param("topicStatus") String topicStatus, @Param("topicSort") Integer topicSort, @Param("topicDescription") String topicDescription, @Param("topicDescriptionHtml") String topicDescriptionHtml);
|
||||
Integer update(@Param("idTopic") Long idTopic, @Param("topicTitle") String topicTitle, @Param("topicUri") String topicUri, @Param("topicIconPath") String topicIconPath, @Param("topicNva") String topicNva, @Param("topicStatus") String topicStatus, @Param("topicSort") Integer topicSort, @Param("topicDescription") String topicDescription, @Param("topicDescriptionHtml") String topicDescriptionHtml);
|
||||
|
||||
/**
|
||||
* @param idTopic
|
||||
* @param tagTitle
|
||||
* @return
|
||||
*/
|
||||
List<Tag> selectUnbindTagsById(@Param("idTopic") Integer idTopic, @Param("tagTitle") String tagTitle);
|
||||
List<Tag> selectUnbindTagsById(@Param("idTopic") Long idTopic, @Param("tagTitle") String tagTitle);
|
||||
|
||||
Integer insertTopicTag(@Param("idTopic") Integer idTopic, @Param("idTag") Integer idTag);
|
||||
Integer insertTopicTag(@Param("idTopic") Long idTopic, @Param("idTag") Long idTag);
|
||||
|
||||
/**
|
||||
* @param idTopic
|
||||
* @param idTag
|
||||
* @return
|
||||
*/
|
||||
Integer deleteTopicTag(@Param("idTopic") Integer idTopic, @Param("idTag") Integer idTag);
|
||||
Integer deleteTopicTag(@Param("idTopic") Long idTopic, @Param("idTag") Long idTag);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param idRole
|
||||
* @return
|
||||
*/
|
||||
Integer insertUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
||||
Integer insertUserRole(@Param("idUser") Long idUser, @Param("idRole") Long idRole);
|
||||
|
||||
/**
|
||||
* 根据账号获取获取用户信息
|
||||
@ -57,7 +57,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
Integer selectRoleWeightsByUser(@Param("idUser") Integer idUser);
|
||||
Integer selectRoleWeightsByUser(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 更新用户权限
|
||||
@ -65,7 +65,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param idRole
|
||||
* @return
|
||||
*/
|
||||
Integer updateUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
||||
Integer updateUserRole(@Param("idUser") Long idUser, @Param("idRole") Long idRole);
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
@ -73,7 +73,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
Integer updateStatus(@Param("idUser") Integer idUser, @Param("status") String status);
|
||||
Integer updateStatus(@Param("idUser") Long idUser, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 根据昵称获取重名用户数量
|
||||
@ -87,7 +87,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
UserInfoDTO selectUserInfo(@Param("idUser") Integer idUser);
|
||||
UserInfoDTO selectUserInfo(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
@ -99,7 +99,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param sex
|
||||
* @return
|
||||
*/
|
||||
Integer updateUserInfo(@Param("idUser") Integer idUser, @Param("nickname") String nickname, @Param("avatarType") String avatarType, @Param("avatarUrl") String avatarUrl, @Param("signature") String signature, @Param("sex") String sex);
|
||||
Integer updateUserInfo(@Param("idUser") Long idUser, @Param("nickname") String nickname, @Param("avatarType") String avatarType, @Param("avatarUrl") String avatarUrl, @Param("signature") String signature, @Param("sex") String sex);
|
||||
|
||||
/**
|
||||
* 验证昵称是否重复
|
||||
@ -107,20 +107,20 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param nickname
|
||||
* @return
|
||||
*/
|
||||
Integer checkNicknameByIdUser(@Param("idUser") Integer idUser, @Param("nickname") String nickname);
|
||||
Integer checkNicknameByIdUser(@Param("idUser") Long idUser, @Param("nickname") String nickname);
|
||||
/**
|
||||
* 根据用户 ID 获取作者信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Author selectAuthor(@Param("id") Integer id);
|
||||
Author selectAuthor(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 更新用户最后登录时间
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
Integer updateLastLoginTime(@Param("idUser") Integer idUser);
|
||||
Integer updateLastLoginTime(@Param("idUser") Long idUser);
|
||||
|
||||
/**
|
||||
* 更换邮箱
|
||||
@ -128,7 +128,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
Integer updateEmail(@Param("idUser") Integer idUser, @Param("email") String email);
|
||||
Integer updateEmail(@Param("idUser") Long idUser, @Param("email") String email);
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
@ -136,7 +136,7 @@ public interface UserMapper extends Mapper<User> {
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
Integer updatePasswordById(@Param("idUser") Integer idUser, @Param("password") String password);
|
||||
Integer updatePasswordById(@Param("idUser") Long idUser, @Param("password") String password);
|
||||
|
||||
/**
|
||||
* 查询用户数据
|
||||
|
@ -4,12 +4,11 @@ import com.rymcu.forest.core.service.Service;
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.ArticleSearchDTO;
|
||||
import com.rymcu.forest.entity.Article;
|
||||
import com.rymcu.forest.entity.User;
|
||||
import com.rymcu.forest.web.api.exception.BaseApiException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
@ -29,7 +28,7 @@ public interface ArticleService extends Service<Article> {
|
||||
* @param type
|
||||
* @return
|
||||
* */
|
||||
ArticleDTO findArticleDTOById(Integer id, Integer type);
|
||||
ArticleDTO findArticleDTOById(Long id, Integer type);
|
||||
|
||||
/**
|
||||
* 查询主题下文章列表
|
||||
@ -50,17 +49,17 @@ public interface ArticleService extends Service<Article> {
|
||||
* @param idUser
|
||||
* @return
|
||||
* */
|
||||
List<ArticleDTO> findUserArticlesByIdUser(Integer idUser);
|
||||
List<ArticleDTO> findUserArticlesByIdUser(Long idUser);
|
||||
|
||||
/**
|
||||
* 新增/更新文章
|
||||
* @param article
|
||||
* @param request
|
||||
* @param user
|
||||
* @throws UnsupportedEncodingException
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
* */
|
||||
Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException;
|
||||
Long postArticle(ArticleDTO article, User user) throws UnsupportedEncodingException, BaseApiException;
|
||||
|
||||
/**
|
||||
* 删除文章
|
||||
@ -68,13 +67,13 @@ public interface ArticleService extends Service<Article> {
|
||||
* @return
|
||||
* @throws BaseApiException
|
||||
* */
|
||||
Map delete(Integer id) throws BaseApiException;
|
||||
Integer delete(Long id) throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 增量文章浏览数
|
||||
* @param id
|
||||
*/
|
||||
void incrementArticleViewCount(Integer id);
|
||||
void incrementArticleViewCount(Long id);
|
||||
|
||||
/**
|
||||
* 获取分享链接数据
|
||||
@ -82,21 +81,20 @@ public interface ArticleService extends Service<Article> {
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
Map share(Integer id) throws BaseApiException;
|
||||
String share(Integer id) throws BaseApiException;
|
||||
|
||||
/**
|
||||
* 查询草稿文章类别
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> findDrafts() throws BaseApiException;
|
||||
List<ArticleDTO> findDrafts(Long userId);
|
||||
|
||||
/**
|
||||
* 查询作品集下文章
|
||||
* @param idPortfolio
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio);
|
||||
List<ArticleDTO> findArticlesByIdPortfolio(Long idPortfolio);
|
||||
|
||||
/**
|
||||
* 查询作品集下未绑定文章
|
||||
@ -105,17 +103,18 @@ public interface ArticleService extends Service<Article> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser);
|
||||
List<ArticleDTO> selectUnbindArticles(Long idPortfolio, String searchText, Long idUser);
|
||||
|
||||
/**
|
||||
* 更新文章标签
|
||||
* @param idArticle
|
||||
* @param tags
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
* @throws BaseApiException
|
||||
*/
|
||||
Map updateTags(Integer idArticle, String tags) throws UnsupportedEncodingException, BaseApiException;
|
||||
Boolean updateTags(Long idArticle, String tags, Long userId) throws UnsupportedEncodingException, BaseApiException;
|
||||
|
||||
/**
|
||||
* 更新文章优选状态
|
||||
@ -123,7 +122,7 @@ public interface ArticleService extends Service<Article> {
|
||||
* @param articlePerfect
|
||||
* @return
|
||||
*/
|
||||
Map updatePerfect(Integer idArticle, String articlePerfect);
|
||||
Boolean updatePerfect(Long idArticle, String articlePerfect);
|
||||
|
||||
/**
|
||||
* 获取公告列表
|
||||
|
@ -4,17 +4,15 @@ import com.rymcu.forest.core.service.Service;
|
||||
import com.rymcu.forest.entity.ArticleThumbsUp;
|
||||
import com.rymcu.forest.web.api.exception.BaseApiException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
public interface ArticleThumbsUpService extends Service<ArticleThumbsUp> {
|
||||
/**
|
||||
* 点赞
|
||||
*
|
||||
* @param articleThumbsUp
|
||||
* @throws BaseApiException
|
||||
* @return
|
||||
*/
|
||||
Map thumbsUp(ArticleThumbsUp articleThumbsUp) throws BaseApiException;
|
||||
int thumbsUp(ArticleThumbsUp articleThumbsUp);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public interface BankAccountService extends Service<BankAccount> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
BankAccountDTO findBankAccountByIdUser(Integer idUser);
|
||||
BankAccountDTO findBankAccountByIdUser(Long idUser);
|
||||
|
||||
/**
|
||||
* 根据账户查询银行账户信息
|
||||
|
@ -3,11 +3,9 @@ package com.rymcu.forest.service;
|
||||
import com.rymcu.forest.core.service.Service;
|
||||
import com.rymcu.forest.dto.CommentDTO;
|
||||
import com.rymcu.forest.entity.Comment;
|
||||
import com.rymcu.forest.web.api.exception.BaseApiException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
@ -27,7 +25,7 @@ public interface CommentService extends Service<Comment> {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Map postComment(Comment comment, HttpServletRequest request) throws BaseApiException;
|
||||
Comment postComment(Comment comment, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 获取评论列表数据
|
||||
|
@ -42,7 +42,7 @@ public interface FollowService extends Service<Follow> {
|
||||
* @param followingId
|
||||
* @return
|
||||
*/
|
||||
List<Follow> findByFollowingId(String followType, Integer followingId);
|
||||
List<Follow> findByFollowingId(String followType, Long followingId);
|
||||
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ public interface LoginRecordService extends Service<LoginRecord> {
|
||||
* @param idUser
|
||||
* @return
|
||||
*/
|
||||
LoginRecord saveLoginRecord(Integer idUser);
|
||||
LoginRecord saveLoginRecord(Long idUser);
|
||||
|
||||
/**
|
||||
* 获取用户登录记录
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user