Merge pull request #114 from ronger-x/master

🎨 update README.md
This commit is contained in:
ronger 2022-11-16 10:16:13 +08:00 committed by GitHub
commit 9874c0c1fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
164 changed files with 5017 additions and 4273 deletions

View File

@ -1,8 +1,10 @@
# forest # forest
![forest](src/main/resources/static/logo_size.jpg) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fforest.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fforest?ref=badge_shield) ![forest](src/main/resources/static/logo_size.jpg)
下一代的知识社区系统,为未来而建 下一代的知识社区系统,为未来而建
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Frymcu%2Fforest.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Frymcu%2Fforest?ref=badge_shield)
## 💡 简介 ## 💡 简介
forest[ˈfôrəst]n.森林)是一款现代化的知识社区项目,使用 SpringBoot + Shiro + MyBatis + JWT + Redis 实现。 forest[ˈfôrəst]n.森林)是一款现代化的知识社区项目,使用 SpringBoot + Shiro + MyBatis + JWT + Redis 实现。
@ -96,6 +98,12 @@ forest[ˈfôrəst]n.森林)是一款现代化的知识社区项目,使
在提功能建议前可以先看一下 [计划表](https://rymcu.com/article/29) ,避免重复提议 在提功能建议前可以先看一下 [计划表](https://rymcu.com/article/29) ,避免重复提议
## 鸣谢 ## 鸣谢
- 感谢以下开发者对 Forest 作出的贡献:
<a href="https://github.com/rymcu/forest/graphs/contributors">
<img src="https://contrib.rocks/image?repo=rymcu/forest&max=1000" />
</a>
- 感谢 `JetBrains` 对本项目的帮助,为作者提供了开源许可版 `JetBrains` 全家桶 - 感谢 `JetBrains` 对本项目的帮助,为作者提供了开源许可版 `JetBrains` 全家桶
![JetBrains](src/main/resources/static/jb_beam.svg) ![JetBrains](src/main/resources/static/jb_beam.svg)

View File

@ -25,7 +25,7 @@ public class AnswerController {
@GetMapping("/today") @GetMapping("/today")
public GlobalResult today() { public GlobalResult today() {
User user = UserUtils.getCurrentUserByToken(); User user = UserUtils.getCurrentUserByToken();
String result = HttpUtils.sendGet(ANSWER_API_URL + "/record/" + user.getIdUser() ); String result = HttpUtils.sendGet(ANSWER_API_URL + "/record/" + user.getIdUser());
return JSONObject.parseObject(result, GlobalResult.class); return JSONObject.parseObject(result, GlobalResult.class);
} }
@ -43,7 +43,7 @@ public class AnswerController {
@GetMapping("/get-answer") @GetMapping("/get-answer")
public GlobalResult getAnswer(Integer idSubjectQuestion) { public GlobalResult getAnswer(Integer idSubjectQuestion) {
String result = HttpUtils.sendGet(ANSWER_API_URL + "/show-answer/" + idSubjectQuestion ); String result = HttpUtils.sendGet(ANSWER_API_URL + "/show-answer/" + idSubjectQuestion);
return JSONObject.parseObject(result, GlobalResult.class); return JSONObject.parseObject(result, GlobalResult.class);
} }
} }

View File

@ -6,7 +6,6 @@ package com.rymcu.forest.auth;
public class JwtConstants { public class JwtConstants {
/** /**
* 上线需要变更 * 上线需要变更
*/ */

View File

@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
/** /**
* 通过Redis存储和验证token的实现类 * 通过Redis存储和验证token的实现类
*
* @author ScienJus * @author ScienJus
* @date 2015/7/31. * @date 2015/7/31.
*/ */

View File

@ -2,6 +2,7 @@ package com.rymcu.forest.auth;
/** /**
* 对token进行操作的接口 * 对token进行操作的接口
*
* @author ScienJus * @author ScienJus
* @date 2015/7/31. * @date 2015/7/31.
*/ */
@ -9,6 +10,7 @@ public interface TokenManager {
/** /**
* 创建一个token关联上指定用户 * 创建一个token关联上指定用户
*
* @param id * @param id
* @return 生成的token * @return 生成的token
*/ */
@ -16,6 +18,7 @@ public interface TokenManager {
/** /**
* 检查token是否有效 * 检查token是否有效
*
* @param model token * @param model token
* @return 是否有效 * @return 是否有效
*/ */
@ -23,6 +26,7 @@ public interface TokenManager {
/** /**
* 从字符串中解析token * 从字符串中解析token
*
* @param token * @param token
* @param account * @param account
* @return * @return
@ -31,6 +35,7 @@ public interface TokenManager {
/** /**
* 清除token * 清除token
*
* @param account 登录用户账号 * @param account 登录用户账号
*/ */
public void deleteToken(String account); public void deleteToken(String account);

View File

@ -4,6 +4,7 @@ import org.apache.shiro.authc.AuthenticationToken;
/** /**
* Token的Model类可以增加字段提高安全性例如时间戳url签名 * Token的Model类可以增加字段提高安全性例如时间戳url签名
*
* @author ScienJus * @author ScienJus
* @date 2015/7/31. * @date 2015/7/31.
*/ */

View File

@ -6,10 +6,8 @@ import com.rymcu.forest.core.exception.ServiceException;
import com.rymcu.forest.core.exception.TransactionException; import com.rymcu.forest.core.exception.TransactionException;
import com.rymcu.forest.core.result.GlobalResult; import com.rymcu.forest.core.result.GlobalResult;
import com.rymcu.forest.core.result.ResultCode; import com.rymcu.forest.core.result.ResultCode;
import com.rymcu.forest.enumerate.TransactionCode;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authc.AccountException; import org.apache.shiro.authc.AccountException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authz.UnauthenticatedException; import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.authz.UnauthorizedException;

View File

@ -17,6 +17,7 @@ import static com.rymcu.forest.core.constant.ProjectConstant.*;
/** /**
* Mybatis & Mapper & PageHelper 配置 * Mybatis & Mapper & PageHelper 配置
*
* @author ronger * @author ronger
*/ */
@Configuration @Configuration

View File

@ -82,7 +82,7 @@ public class ShiroConfig {
* Shiro生命周期处理器 * Shiro生命周期处理器
*/ */
@Bean @Bean
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor(){ public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor(); return new LifecycleBeanPostProcessor();
} }

View File

@ -1,7 +1,9 @@
package com.rymcu.forest.config; package com.rymcu.forest.config;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -40,6 +42,11 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
// SerializerFeature.WriteNullNumberAsZero);//Number null -> 0 // SerializerFeature.WriteNullNumberAsZero);//Number null -> 0
//关闭循环引用 //关闭循环引用
config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect); config.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
// 设置 Long 类型转为 String
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.put(Long.class, ToStringSerializer.instance);
serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
config.setSerializeConfig(serializeConfig);
converter.setFastJsonConfig(config); converter.setFastJsonConfig(config);
converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON)); converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON));
converter.setDefaultCharset(Charset.forName("UTF-8")); converter.setDefaultCharset(Charset.forName("UTF-8"));

View File

@ -14,6 +14,7 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer { public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
/** /**
* 注册stomp端点 * 注册stomp端点
*
* @param registry * @param registry
*/ */
@Override @Override
@ -25,6 +26,7 @@ public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
/** /**
* 配置信息代理 * 配置信息代理
*
* @param registry * @param registry
*/ */
@Override @Override

View File

@ -2,6 +2,7 @@ package com.rymcu.forest.core.constant;
/** /**
* 消息通知类型 * 消息通知类型
*
* @author ronger * @author ronger
*/ */
public class NotificationConstant { public class NotificationConstant {

View File

@ -2,25 +2,44 @@ package com.rymcu.forest.core.constant;
/** /**
* 项目常量 * 项目常量
*
* @author ronger * @author ronger
*/ */
public final class ProjectConstant { public final class ProjectConstant {
/**当前环境*/ /**
* 当前环境
*/
public static final String ENV = "dev"; public static final String ENV = "dev";
/**项目基础包名称,根据自己公司的项目修改*/ /**
* 项目基础包名称根据自己公司的项目修改
*/
public static final String BASE_PACKAGE = "com.rymcu.forest"; public static final String BASE_PACKAGE = "com.rymcu.forest";
/**DTO所在包*/ /**
* DTO所在包
*/
public static final String DTO_PACKAGE = BASE_PACKAGE + ".dto"; public static final String DTO_PACKAGE = BASE_PACKAGE + ".dto";
/**Model所在包*/ /**
* Model所在包
*/
public static final String MODEL_PACKAGE = BASE_PACKAGE + ".entity"; public static final String MODEL_PACKAGE = BASE_PACKAGE + ".entity";
/**Mapper所在包*/ /**
* Mapper所在包
*/
public static final String MAPPER_PACKAGE = BASE_PACKAGE + ".mapper"; public static final String MAPPER_PACKAGE = BASE_PACKAGE + ".mapper";
/**Service所在包*/ /**
* Service所在包
*/
public static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service"; public static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service";
/**ServiceImpl所在包*/ /**
* ServiceImpl所在包
*/
public static final String SERVICE_IMPL_PACKAGE = SERVICE_PACKAGE + ".impl"; public static final String SERVICE_IMPL_PACKAGE = SERVICE_PACKAGE + ".impl";
/**Controller所在包*/ /**
* Controller所在包
*/
public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".web"; public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".web";
/**Mapper插件基础接口的完全限定名*/ /**
* Mapper插件基础接口的完全限定名
*/
public static final String MAPPER_INTERFACE_REFERENCE = BASE_PACKAGE + ".core.mapper.Mapper"; public static final String MAPPER_INTERFACE_REFERENCE = BASE_PACKAGE + ".core.mapper.Mapper";
} }

View File

@ -7,12 +7,10 @@ import org.apache.shiro.authc.AuthenticationException;
* *
* @author ronger * @author ronger
*/ */
public class CaptchaException extends AuthenticationException public class CaptchaException extends AuthenticationException {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public CaptchaException() public CaptchaException() {
{
super("验证码不正确"); super("验证码不正确");
} }
} }

View File

@ -5,6 +5,7 @@ import com.rymcu.forest.core.result.ResultCode;
/** /**
* 服务业务异常如 账号或密码错误 该异常只做INFO级别的日志记录 @see WebMvcConfigurer * 服务业务异常如 账号或密码错误 该异常只做INFO级别的日志记录 @see WebMvcConfigurer
*
* @author ronger * @author ronger
*/ */
public class ServiceException extends RuntimeException { public class ServiceException extends RuntimeException {
@ -13,27 +14,27 @@ public class ServiceException extends RuntimeException {
public ServiceException(ResultCode resultCode) { public ServiceException(ResultCode resultCode) {
super(resultCode.getMessage()); super(resultCode.getMessage());
this.code=resultCode.getCode(); this.code = resultCode.getCode();
} }
public ServiceException(String message, Throwable cause) { public ServiceException(String message, Throwable cause) {
} }
public ServiceException(int code, String message, String extraMessage, Throwable cause){
super(message,cause); public ServiceException(int code, String message, String extraMessage, Throwable cause) {
this.code=code; super(message, cause);
this.extraMessage=extraMessage; this.code = code;
this.extraMessage = extraMessage;
} }
public ServiceException(ResultCode resultCode, String extraMessage) {
public ServiceException(ResultCode resultCode, String extraMessage){ this(resultCode.getCode(), resultCode.getMessage(), extraMessage, null);
this(resultCode.getCode(),resultCode.getMessage(),extraMessage,null);
} }
public ServiceException(String extraMessage){ public ServiceException(String extraMessage) {
this(ResultCode.INVALID_PARAM,extraMessage); this(ResultCode.INVALID_PARAM, extraMessage);
} }

View File

@ -6,6 +6,7 @@ public interface TreeMapper<T> extends Mapper<T> {
/** /**
* 找到所有子节点 * 找到所有子节点
*
* @param entity * @param entity
* @return * @return
*/ */
@ -13,6 +14,7 @@ public interface TreeMapper<T> extends Mapper<T> {
/** /**
* 更新所有父节点字段 * 更新所有父节点字段
*
* @param entity * @param entity
* @return * @return
*/ */

View File

@ -9,6 +9,7 @@ public class GlobalResultGenerator {
/** /**
* normal * normal
*
* @param success * @param success
* @param data * @param data
* @param message * @param message
@ -28,6 +29,7 @@ public class GlobalResultGenerator {
/** /**
* success * success
*
* @param data * @param data
* @param <T> * @param <T>
* @return * @return
@ -39,6 +41,7 @@ public class GlobalResultGenerator {
/** /**
* error message * error message
*
* @param message error message * @param message error message
* @param <T> * @param <T>
* @return * @return
@ -50,6 +53,7 @@ public class GlobalResultGenerator {
/** /**
* error * error
*
* @param error error enum * @param error error enum
* @param <T> * @param <T>
* @return * @return
@ -61,6 +65,7 @@ public class GlobalResultGenerator {
/** /**
* success no message * success no message
*
* @return * @return
*/ */
public static GlobalResult genSuccessResult() { public static GlobalResult genSuccessResult() {
@ -69,6 +74,7 @@ public class GlobalResultGenerator {
/** /**
* success * success
*
* @param <T> * @param <T>
* @return * @return
*/ */

View File

@ -12,7 +12,7 @@ public enum GlobalResultMessage {
private String message; private String message;
GlobalResultMessage(String message){ GlobalResultMessage(String message) {
this.message = message; this.message = message;
} }
} }

View File

@ -20,7 +20,6 @@ import java.util.Objects;
/** /**
* @author ronger * @author ronger
*
*/ */
@Aspect @Aspect
@Component @Component
@ -32,7 +31,9 @@ public class TransactionAspect {
private TransactionRecordService transactionRecordService; private TransactionRecordService transactionRecordService;
@Pointcut("@annotation(com.rymcu.forest.core.service.log.annotation.TransactionLogger)") @Pointcut("@annotation(com.rymcu.forest.core.service.log.annotation.TransactionLogger)")
public void pointCut() {} public void pointCut() {
}
/** /**
* 保存交易操作日志 * 保存交易操作日志
* *
@ -40,7 +41,7 @@ public class TransactionAspect {
* @return 方法执行结果 * @return 方法执行结果
* @throws Throwable 调用出错 * @throws Throwable 调用出错
*/ */
@AfterReturning(value = "pointCut()", returning="obj") @AfterReturning(value = "pointCut()", returning = "obj")
public void save(JoinPoint joinPoint, Object obj) throws Exception { public void save(JoinPoint joinPoint, Object obj) throws Exception {
logger.info("保存交易记录 start ..."); logger.info("保存交易记录 start ...");
/** /**

View File

@ -5,6 +5,7 @@ import java.lang.annotation.RetentionPolicy;
/** /**
* 浏览记录器 * 浏览记录器
*
* @author ronger * @author ronger
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)

View File

@ -61,6 +61,7 @@ public class RedisResult<T> extends BaseDO {
public void setKeyExists(boolean keyExists) { public void setKeyExists(boolean keyExists) {
this.keyExists = keyExists; this.keyExists = keyExists;
} }
public boolean isKeyExists() { public boolean isKeyExists() {
return keyExists; return keyExists;
} }

View File

@ -7,6 +7,7 @@ import java.util.Set;
/** /**
* Redis 服务接口 * Redis 服务接口
*
* @author Jimersy Lee * @author Jimersy Lee
* 2017-09-18 14:58:21 * 2017-09-18 14:58:21
*/ */

View File

@ -547,29 +547,32 @@ public class RedisServiceImpl implements RedisService {
public String put(String cacheName, String key, Object value) { public String put(String cacheName, String key, Object value) {
String result = get(cacheName); String result = get(cacheName);
Map map = new HashMap(); Map map = new HashMap();
if (StringUtils.isNotBlank(result)){ if (StringUtils.isNotBlank(result)) {
map = JSON.parseObject(result, new TypeReference<Map>() {}); map = JSON.parseObject(result, new TypeReference<Map>() {
});
} }
map.put(key,value); map.put(key, value);
return set(cacheName,map); return set(cacheName, map);
} }
@Override @Override
public String put(String cacheName, String key, Object value, int expireTime) { public String put(String cacheName, String key, Object value, int expireTime) {
String result = get(cacheName); String result = get(cacheName);
Map map = new HashMap(); Map map = new HashMap();
if (StringUtils.isNotBlank(result)){ if (StringUtils.isNotBlank(result)) {
map = JSON.parseObject(result, new TypeReference<Map>() {}); map = JSON.parseObject(result, new TypeReference<Map>() {
});
} }
map.put(key,value); map.put(key, value);
return set(cacheName,map,expireTime); return set(cacheName, map, expireTime);
} }
@Override @Override
public Object get(String cacheName, String key){ public Object get(String cacheName, String key) {
String result = get(cacheName); String result = get(cacheName);
if (StringUtils.isNotBlank(result)){ if (StringUtils.isNotBlank(result)) {
Map map = JSON.parseObject(result, new TypeReference<Map>() {}); Map map = JSON.parseObject(result, new TypeReference<Map>() {
});
return map.get(key); return map.get(key);
} }
return null; return null;

View File

@ -5,6 +5,7 @@ import java.lang.annotation.RetentionPolicy;
/** /**
* 安全拦截器 * 安全拦截器
*
* @author ronger * @author ronger
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -18,42 +17,74 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ArticleDTO { public class ArticleDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
/** 文章标题 */ /**
* 文章标题
*/
private String articleTitle; private String articleTitle;
/** 文章缩略图 */ /**
* 文章缩略图
*/
private String articleThumbnailUrl; private String articleThumbnailUrl;
/** 文章作者id */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 文章作者id
*/
private Long articleAuthorId; private Long articleAuthorId;
/** 文章作者 */ /**
* 文章作者
*/
private String articleAuthorName; private String articleAuthorName;
/** 文章作者头像 */ /**
* 文章作者头像
*/
private String articleAuthorAvatarUrl; private String articleAuthorAvatarUrl;
/** 文章类型 */ /**
* 文章类型
*/
private String articleType; private String articleType;
/** 文章标签 */ /**
* 文章标签
*/
private String articleTags; private String articleTags;
/** 浏览总数 */ /**
* 浏览总数
*/
private Integer articleViewCount; private Integer articleViewCount;
/** 预览内容 */ /**
* 预览内容
*/
private String articlePreviewContent; private String articlePreviewContent;
/** 文章内容 */ /**
* 文章内容
*/
private String articleContent; private String articleContent;
/** 文章内容html */ /**
* 文章内容html
*/
private String articleContentHtml; private String articleContentHtml;
/** 评论总数 */ /**
* 评论总数
*/
private Integer articleCommentCount; private Integer articleCommentCount;
/** 过去时长 */ /**
* 过去时长
*/
private String timeAgo; private String timeAgo;
/** 文章永久链接 */ /**
* 文章永久链接
*/
private String articlePermalink; private String articlePermalink;
/** 站内链接 */ /**
* 站内链接
*/
private String articleLink; private String articleLink;
/** 文章状态 */ /**
* 文章状态
*/
private String articleStatus; private String articleStatus;
/** 更新时间 */ /**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime; private Date updatedTime;
@ -64,11 +95,17 @@ public class ArticleDTO {
private List<PortfolioArticleDTO> portfolios; private List<PortfolioArticleDTO> portfolios;
private Integer sortNo; private Integer sortNo;
/** 0:非优选1优选;0 */ /**
* 0:非优选1优选;0
*/
private String articlePerfect; private String articlePerfect;
/** 点赞总数 */ /**
* 点赞总数
*/
private Integer articleThumbsUpCount; private Integer articleThumbsUpCount;
/** 赞赏总数 */ /**
* 赞赏总数
*/
private Integer articleSponsorCount; private Integer articleSponsorCount;
private Boolean canSponsor; private Boolean canSponsor;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -14,12 +14,10 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ArticleTagDTO { public class ArticleTagDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticleTag; private Long idArticleTag;
private Integer idTag; private Integer idTag;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
private String tagTitle; private String tagTitle;
@ -30,6 +28,5 @@ public class ArticleTagDTO {
private String tagIconPath; private String tagIconPath;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long tagAuthorId; private Long tagAuthorId;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -15,7 +15,6 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class Author { public class Author {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String userNickname; private String userNickname;

View File

@ -14,19 +14,33 @@ import java.util.List;
public class BankAccountDTO { public class BankAccountDTO {
private Integer idBankAccount; private Integer idBankAccount;
/** 所属银行 */ /**
* 所属银行
*/
private Integer idBank; private Integer idBank;
/** 所属银行名称 */ /**
* 所属银行名称
*/
private String bankName; private String bankName;
/** 银行账户 */ /**
* 银行账户
*/
private String bankAccount; private String bankAccount;
/** 账户余额 */ /**
* 账户余额
*/
private BigDecimal accountBalance; private BigDecimal accountBalance;
/** 账户所有者 */ /**
* 账户所有者
*/
private Integer accountOwner; private Integer accountOwner;
/** 账户所有者姓名 */ /**
* 账户所有者姓名
*/
private String accountOwnerName; private String accountOwnerName;
/** 创建时间 */ /**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;

View File

@ -7,11 +7,17 @@ import lombok.Data;
*/ */
@Data @Data
public class BankAccountSearchDTO { public class BankAccountSearchDTO {
/** 所属银行名称 */ /**
* 所属银行名称
*/
private String bankName; private String bankName;
/** 银行账户 */ /**
* 银行账户
*/
private String bankAccount; private String bankAccount;
/** 账户所有者姓名 */ /**
* 账户所有者姓名
*/
private String accountOwnerName; private String accountOwnerName;
} }

View File

@ -13,21 +13,37 @@ import java.util.Date;
public class BankDTO { public class BankDTO {
private Integer idBank; private Integer idBank;
/** 银行名称 */ /**
* 银行名称
*/
private String bankName; private String bankName;
/** 银行负责人 */ /**
* 银行负责人
*/
private Integer bankOwner; private Integer bankOwner;
/** 银行负责人 */ /**
* 银行负责人
*/
private String bankOwnerName; private String bankOwnerName;
/** 银行账户 */ /**
* 银行账户
*/
private String bankAccount; private String bankAccount;
/** 账户余额 */ /**
* 账户余额
*/
private BigDecimal accountBalance; private BigDecimal accountBalance;
/** 银行描述 */ /**
* 银行描述
*/
private String bankDescription; private String bankDescription;
/** 创建人 */ /**
* 创建人
*/
private Integer createdBy; private Integer createdBy;
/** 创建时间 */ /**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -9,7 +9,6 @@ import lombok.Data;
@Data @Data
public class ChangeEmailDTO { public class ChangeEmailDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String email; private String email;

View File

@ -11,31 +11,57 @@ import java.util.Date;
@Data @Data
public class CommentDTO { public class CommentDTO {
private Integer idComment; private Integer idComment;
/** 评论内容 */ /**
* 评论内容
*/
private String commentContent; private String commentContent;
/** 作者 id */ /**
* 作者 id
*/
private Integer commentAuthorId; private Integer commentAuthorId;
/** 文章 id */ /**
* 文章 id
*/
private Integer commentArticleId; private Integer commentArticleId;
/** 锚点 url */ /**
* 锚点 url
*/
private String commentSharpUrl; private String commentSharpUrl;
/** 父评论 id */ /**
* 父评论 id
*/
private Integer commentOriginalCommentId; private Integer commentOriginalCommentId;
/** 父评论作者头像 */ /**
* 父评论作者头像
*/
private String commentOriginalAuthorThumbnailURL; private String commentOriginalAuthorThumbnailURL;
/** 父评论作者昵称 */ /**
* 父评论作者昵称
*/
private String commentOriginalAuthorNickname; private String commentOriginalAuthorNickname;
/** 父评论作者昵称 */ /**
* 父评论作者昵称
*/
private String commentOriginalContent; private String commentOriginalContent;
/** 状态 */ /**
* 状态
*/
private String commentStatus; private String commentStatus;
/** 0公开回帖1匿名回帖 */ /**
* 0公开回帖1匿名回帖
*/
private String commentAnonymous; private String commentAnonymous;
/** 回帖计数 */ /**
* 回帖计数
*/
private Integer commentReplyCount; private Integer commentReplyCount;
/** 0所有人可见1仅楼主和自己可见 */ /**
* 0所有人可见1仅楼主和自己可见
*/
private String commentVisible; private String commentVisible;
/** 创建时间 */ /**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rymcu.forest.entity.Notification; import com.rymcu.forest.entity.Notification;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -12,7 +12,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class NotificationDTO extends Notification { public class NotificationDTO extends Notification {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idNotification; private Long idNotification;
private String dataTitle; private String dataTitle;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -11,13 +11,10 @@ import java.util.List;
@Data @Data
public class PortfolioArticleDTO { public class PortfolioArticleDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio; private Long idPortfolio;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
private String headImgUrl; private String headImgUrl;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -11,24 +11,38 @@ import java.util.Date;
@Data @Data
public class PortfolioDTO { public class PortfolioDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio; private Long idPortfolio;
/** 作品集头像 */ /**
* 作品集头像
*/
private String headImgUrl; private String headImgUrl;
/** 作品集作者 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 作品集作者
*/
private Long portfolioAuthorId; private Long portfolioAuthorId;
/** 作品集作者 */ /**
* 作品集作者
*/
private String portfolioAuthorName; private String portfolioAuthorName;
/** 作品集作者头像 */ /**
* 作品集作者头像
*/
private String portfolioAuthorAvatarUrl; private String portfolioAuthorAvatarUrl;
/** 作品集名称 */ /**
* 作品集名称
*/
private String portfolioTitle; private String portfolioTitle;
/** 作品集介绍 */ /**
* 作品集介绍
*/
private String portfolioDescription; private String portfolioDescription;
/** 更新时间 */ /**
* 更新时间
*/
private Date updatedTime; private Date updatedTime;
/** 过去时长 */ /**
* 过去时长
*/
private String timeAgo; private String timeAgo;
private Author portfolioAuthor; private Author portfolioAuthor;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Set; import java.util.Set;
@ -11,7 +11,6 @@ import java.util.Set;
@Data @Data
public class TokenUser { public class TokenUser {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String account; private String account;

View File

@ -13,23 +13,41 @@ import java.util.Date;
public class TransactionRecordDTO { public class TransactionRecordDTO {
private Integer idTransactionRecord; private Integer idTransactionRecord;
/** 交易流水号 */ /**
* 交易流水号
*/
private String transactionNo; private String transactionNo;
/** 款项 */ /**
* 款项
*/
private String funds; private String funds;
/** 交易发起方 */ /**
* 交易发起方
*/
private String formBankAccount; private String formBankAccount;
/** 交易发起方 */ /**
* 交易发起方
*/
private BankAccountDTO formBankAccountInfo; private BankAccountDTO formBankAccountInfo;
/** 交易收款方 */ /**
* 交易收款方
*/
private String toBankAccount; private String toBankAccount;
/** 交易收款方 */ /**
* 交易收款方
*/
private BankAccountDTO toBankAccountInfo; private BankAccountDTO toBankAccountInfo;
/** 交易金额 */ /**
* 交易金额
*/
private BigDecimal money; private BigDecimal money;
/** 交易类型 */ /**
* 交易类型
*/
private String transactionType; private String transactionType;
/** 交易时间 */ /**
* 交易时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date transactionTime; private Date transactionTime;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -9,7 +9,6 @@ import lombok.Data;
@Data @Data
public class UpdatePasswordDTO { public class UpdatePasswordDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String password; private String password;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -9,7 +9,6 @@ import lombok.Data;
@Data @Data
public class UserDTO { public class UserDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String account; private String account;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.dto; package com.rymcu.forest.dto;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -13,7 +12,6 @@ import java.util.Date;
@Data @Data
public class UserInfoDTO implements Serializable { public class UserInfoDTO implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String account; private String account;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto.admin; package com.rymcu.forest.dto.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -9,9 +9,7 @@ import lombok.Data;
@Data @Data
public class TopicTagDTO { public class TopicTagDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idTopic; private Long idTopic;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idTag; private Long idTag;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.dto.admin; package com.rymcu.forest.dto.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -9,9 +9,7 @@ import lombok.Data;
@Data @Data
public class UserRoleDTO { public class UserRoleDTO {
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idRole; private Long idRole;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -15,44 +15,76 @@ import java.util.Date;
*/ */
@Data @Data
@Table(name = "forest_article") @Table(name = "forest_article")
public class Article implements Serializable,Cloneable { public class Article implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
/** 文章标题 */ /**
* 文章标题
*/
private String articleTitle; private String articleTitle;
/** 文章缩略图 */ /**
* 文章缩略图
*/
private String articleThumbnailUrl; private String articleThumbnailUrl;
/** 文章作者id */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 文章作者id
*/
private Long articleAuthorId; private Long articleAuthorId;
/** 文章类型 */ /**
* 文章类型
*/
private String articleType; private String articleType;
/** 文章标签 */ /**
* 文章标签
*/
private String articleTags; private String articleTags;
/** 浏览总数 */ /**
* 浏览总数
*/
private Integer articleViewCount; private Integer articleViewCount;
/** 预览内容 */ /**
* 预览内容
*/
private String articlePreviewContent; private String articlePreviewContent;
/** 评论总数 */ /**
* 评论总数
*/
private Integer articleCommentCount; private Integer articleCommentCount;
/** 0:非优选1优选; */ /**
* 0:非优选1优选;
*/
private String articlePerfect; private String articlePerfect;
/** 文章永久链接 */ /**
* 文章永久链接
*/
private String articlePermalink; private String articlePermalink;
/** 站内链接 */ /**
* 站内链接
*/
private String articleLink; private String articleLink;
/** 创建时间 */ /**
* 创建时间
*/
private Date createdTime; private Date createdTime;
/** 更新时间 */ /**
* 更新时间
*/
private Date updatedTime; private Date updatedTime;
/** 文章状态 */ /**
* 文章状态
*/
private String articleStatus; private String articleStatus;
/** 点赞总数 */ /**
* 点赞总数
*/
private Integer articleThumbsUpCount; private Integer articleThumbsUpCount;
/** 赞赏总数 */ /**
* 赞赏总数
*/
private Integer articleSponsorCount; private Integer articleSponsorCount;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -19,7 +19,6 @@ public class ArticleContent {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
private String articleContent; private String articleContent;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -14,7 +14,7 @@ import java.util.Date;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_article_thumbs_up") @Table(name = "forest_article_thumbs_up")
public class ArticleThumbsUp implements Serializable, Cloneable { public class ArticleThumbsUp implements Serializable, Cloneable {
/** /**
* 主键 * 主键
@ -22,17 +22,14 @@ public class ArticleThumbsUp implements Serializable, Cloneable {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticleThumbsUp; private Long idArticleThumbsUp;
/** /**
* 文章表主键 * 文章表主键
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle; private Long idArticle;
/** /**
* 用户表主键 * 用户表主键
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
/** /**
* 点赞时间 * 点赞时间

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -12,28 +11,39 @@ import java.util.Date;
/** /**
* 银行 * 银行
*
* @author ronger * @author ronger
*/ */
@Table(name = "forest_bank") @Table(name = "forest_bank")
@Data @Data
public class Bank { public class Bank {
/** 主键 */ /**
* 主键
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idBank; private Long idBank;
/** 银行名称 */ /**
* 银行名称
*/
private String bankName; private String bankName;
/** 银行负责人 */ /**
* 银行负责人
*/
private Long bankOwner; private Long bankOwner;
/** 银行描述 */ /**
* 银行描述
*/
private String bankDescription; private String bankDescription;
/** 创建人 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 创建人
*/
private Long createdBy; private Long createdBy;
/** 创建时间 */ /**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -13,30 +12,42 @@ import java.util.Date;
/** /**
* 银行账户 * 银行账户
*
* @author ronger * @author ronger
*/ */
@Table(name = "forest_bank_account") @Table(name = "forest_bank_account")
@Data @Data
public class BankAccount { public class BankAccount {
/** 主键 */ /**
* 主键
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idBankAccount; private Long idBankAccount;
/** 所属银行 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 所属银行
*/
private Long idBank; private Long idBank;
/** 银行账户 */ /**
* 银行账户
*/
private String bankAccount; private String bankAccount;
/** 账户余额 */ /**
* 账户余额
*/
private BigDecimal accountBalance; private BigDecimal accountBalance;
/** 账户所有者 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 账户所有者
*/
private Long accountOwner; private Long accountOwner;
/** 创建时间 */ /**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;
/** 账户类型 */ /**
* 账户类型
*/
private String accountType; private String accountType;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -14,51 +14,73 @@ import java.util.Date;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_comment") @Table(name = "forest_comment")
public class Comment implements Serializable,Cloneable { public class Comment implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idComment; private Long idComment;
/** 评论内容 */ /**
* 评论内容
*/
@Column(name = "comment_content") @Column(name = "comment_content")
private String commentContent; private String commentContent;
/** 作者 id */ /**
* 作者 id
*/
@Column(name = "comment_author_id") @Column(name = "comment_author_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentAuthorId; private Long commentAuthorId;
/** 文章 id */ /**
* 文章 id
*/
@Column(name = "comment_article_id") @Column(name = "comment_article_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentArticleId; private Long commentArticleId;
/** 锚点 url */ /**
* 锚点 url
*/
@Column(name = "comment_sharp_url") @Column(name = "comment_sharp_url")
private String commentSharpUrl; private String commentSharpUrl;
/** 父评论 id */ /**
* 父评论 id
*/
@Column(name = "comment_original_comment_id") @Column(name = "comment_original_comment_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentOriginalCommentId; private Long commentOriginalCommentId;
/** 状态 */ /**
* 状态
*/
@Column(name = "comment_status") @Column(name = "comment_status")
private String commentStatus; private String commentStatus;
/** 评论 IP */ /**
* 评论 IP
*/
@Column(name = "comment_ip") @Column(name = "comment_ip")
private String commentIP; private String commentIP;
/** User-Agent */ /**
* User-Agent
*/
@Column(name = "comment_ua") @Column(name = "comment_ua")
private String commentUA; private String commentUA;
/** 0公开回帖1匿名回帖 */ /**
* 0公开回帖1匿名回帖
*/
@Column(name = "comment_anonymous") @Column(name = "comment_anonymous")
private String commentAnonymous; private String commentAnonymous;
/** 回帖计数 */ /**
* 回帖计数
*/
@Column(name = "comment_reply_count") @Column(name = "comment_reply_count")
private Integer commentReplyCount; private Integer commentReplyCount;
/** 0所有人可见1仅楼主和自己可见 */ /**
* 0所有人可见1仅楼主和自己可见
*/
@Column(name = "comment_visible") @Column(name = "comment_visible")
private String commentVisible; private String commentVisible;
/** 创建时间 */ /**
* 创建时间
*/
@Column(name = "created_time") @Column(name = "created_time")
private Date createdTime; private Date createdTime;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -11,22 +11,29 @@ import java.util.Date;
/** /**
* 货币发行记录 * 货币发行记录
*
* @author ronger * @author ronger
*/ */
@Table(name = "forest_currency_issue") @Table(name = "forest_currency_issue")
@Data @Data
public class CurrencyIssue { public class CurrencyIssue {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
/** 发行数额 */ /**
* 发行数额
*/
private BigDecimal issueValue; private BigDecimal issueValue;
/** 发行人 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 发行人
*/
private Long createdBy; private Long createdBy;
/** 发行时间 */ /**
* 发行时间
*/
private Date createdTime; private Date createdTime;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -13,7 +13,7 @@ import java.math.BigDecimal;
/** /**
* @author ronger * @author ronger
*/ */
@Table(name="forest_currency_rule") @Table(name = "forest_currency_rule")
@Data @Data
public class CurrencyRule implements Serializable, Cloneable { public class CurrencyRule implements Serializable, Cloneable {
/** /**
@ -22,7 +22,6 @@ public class CurrencyRule implements Serializable, Cloneable {
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idCurrencyRule; private Long idCurrencyRule;
/** /**
* 规则名称 * 规则名称

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -13,23 +13,28 @@ import java.io.Serializable;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_follow") @Table(name = "forest_follow")
public class Follow implements Serializable,Cloneable { public class Follow implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idFollow; private Long idFollow;
/** 关注者 id */ /**
* 关注者 id
*/
@Column(name = "follower_id") @Column(name = "follower_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long followerId; private Long followerId;
/** 关注数据 id */ /**
* 关注数据 id
*/
@Column(name = "following_id") @Column(name = "following_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long followingId; private Long followingId;
/** 0用户1标签2帖子收藏3帖子关注 */ /**
* 0用户1标签2帖子收藏3帖子关注
*/
@Column(name = "following_type") @Column(name = "following_type")
private String followingType; private String followingType;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -22,14 +22,12 @@ public class ForestFile {
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
/** /**
* 文件大小 * 文件大小
*/ */
@Column(name = "file_size") @Column(name = "file_size")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long fileSize; private Long fileSize;
/** /**
@ -71,7 +69,6 @@ public class ForestFile {
* 创建人 * 创建人
*/ */
@Column(name = "created_by") @Column(name = "created_by")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long createdBy; private Long createdBy;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -13,41 +12,58 @@ import java.util.Date;
/** /**
* 登录记录表 * 登录记录表
*
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_login_record") @Table(name = "forest_login_record")
public class LoginRecord implements Serializable,Cloneable { public class LoginRecord implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
/** IP */ /**
* IP
*/
@Column(name = "login_ip") @Column(name = "login_ip")
private String loginIp; private String loginIp;
/** User-Agent */ /**
* User-Agent
*/
@Column(name = "login_ua") @Column(name = "login_ua")
private String loginUa; private String loginUa;
/** 城市 */ /**
* 城市
*/
@Column(name = "login_city") @Column(name = "login_city")
private String loginCity; private String loginCity;
/** 设备唯一标识 */ /**
* 设备唯一标识
*/
@Column(name = "login_device_id") @Column(name = "login_device_id")
private String loginDeviceId; private String loginDeviceId;
/** 设备操作系统 */ /**
* 设备操作系统
*/
@Column(name = "login_os") @Column(name = "login_os")
private String loginOS; private String loginOS;
/** 设备浏览器 */ /**
* 设备浏览器
*/
@Column(name = "login_browser") @Column(name = "login_browser")
private String loginBrowser; private String loginBrowser;
/** 用户 id */ /**
* 用户 id
*/
@Column(name = "id_user") @Column(name = "id_user")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
/** 创建时间 */ /**
* 创建时间
*/
@Column(name = "created_time") @Column(name = "created_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -16,21 +15,19 @@ import java.util.Date;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_notification") @Table(name = "forest_notification")
public class Notification implements Serializable,Cloneable { public class Notification implements Serializable, Cloneable {
/** /**
* 主键 * 主键
*/ */
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idNotification; private Long idNotification;
/** /**
* 用户id * 用户id
*/ */
@Column(name = "id_user") @Column(name = "id_user")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
/** /**
* 数据类型 * 数据类型
@ -41,7 +38,6 @@ public class Notification implements Serializable,Cloneable {
* 数据id * 数据id
*/ */
@Column(name = "data_id") @Column(name = "data_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long dataId; private Long dataId;
/** /**
* 数据摘要 * 数据摘要

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import tk.mybatis.mapper.annotation.ColumnType; import tk.mybatis.mapper.annotation.ColumnType;
@ -15,17 +15,16 @@ import java.io.Serializable;
*/ */
@Data @Data
@Table(name = "forest_permission") @Table(name = "forest_permission")
public class Permission implements Serializable,Cloneable { public class Permission implements Serializable, Cloneable {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPermission; private Long idPermission;
/** /**
* 权限标识 * 权限标识
* */ */
@ColumnType(column = "permission_category") @ColumnType(column = "permission_category")
private String permissionCategory; private String permissionCategory;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.*; import javax.persistence.*;
@ -12,27 +12,41 @@ import java.util.Date;
@Data @Data
@Table(name = "forest_portfolio") @Table(name = "forest_portfolio")
public class Portfolio { public class Portfolio {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio; private Long idPortfolio;
/** 作品集头像 */ /**
* 作品集头像
*/
@Column(name = "portfolio_head_img_url") @Column(name = "portfolio_head_img_url")
private String headImgUrl; private String headImgUrl;
/** 作品集名称 */ /**
* 作品集名称
*/
private String portfolioTitle; private String portfolioTitle;
/** 作品集作者 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 作品集作者
*/
private Long portfolioAuthorId; private Long portfolioAuthorId;
/** 作品集介绍 */ /**
* 作品集介绍
*/
private String portfolioDescription; private String portfolioDescription;
/** 作品集介绍 Html */ /**
* 作品集介绍 Html
*/
private String portfolioDescriptionHtml; private String portfolioDescriptionHtml;
/** 创建时间 */ /**
* 创建时间
*/
private Date createdTime; private Date createdTime;
/** 更新时间 */ /**
* 更新时间
*/
private Date updatedTime; private Date updatedTime;
@Transient @Transient
private String headImgType; private String headImgType;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -27,7 +26,6 @@ public class Product implements Serializable, Cloneable {
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idProduct; private Long idProduct;
/** /**
* 产品名 * 产品名

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Table; import javax.persistence.Table;
@ -21,7 +20,6 @@ public class ProductContent implements Serializable, Cloneable {
/** /**
* 产品表主键 * 产品表主键
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idProduct; private Long idProduct;
/** /**
* 产品详情原文 * 产品详情原文

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -16,47 +15,46 @@ import java.util.Date;
*/ */
@Data @Data
@Table(name = "forest_role") @Table(name = "forest_role")
public class Role implements Serializable,Cloneable { public class Role implements Serializable, Cloneable {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idRole; private Long idRole;
/** /**
* 角色名称 * 角色名称
* */ */
@Column(name = "name") @Column(name = "name")
private String name; private String name;
/** /**
* 拼音码 * 拼音码
* */ */
@Column(name = "input_code") @Column(name = "input_code")
private String inputCode; private String inputCode;
/** /**
* 权重 * 权重
* */ */
@Column(name = "weights") @Column(name = "weights")
private Integer weights; private Integer weights;
/** /**
* 状态 * 状态
* */ */
@Column(name = "status") @Column(name = "status")
private String status; private String status;
/** /**
* 创建时间 * 创建时间
* */ */
@Column(name = "created_time") @Column(name = "created_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;
/** /**
* 更新时间 * 更新时间
* */ */
@Column(name = "updated_time") @Column(name = "updated_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime; private Date updatedTime;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -14,33 +14,54 @@ import java.util.Date;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_special_day") @Table(name = "forest_special_day")
public class SpecialDay implements Serializable,Cloneable{ public class SpecialDay implements Serializable, Cloneable {
/** */ /**
*
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idSpecialDay; private Long idSpecialDay;
/** 名称 */ /**
* 名称
*/
private String specialDayName; private String specialDayName;
/** 权重/优先级,小数优秀 */ /**
* 权重/优先级,小数优秀
*/
private Integer weights; private Integer weights;
/** 开始时间 */ /**
* 开始时间
*/
private Date startTime; private Date startTime;
/** 过期时间 */ /**
* 过期时间
*/
private Date expirationTime; private Date expirationTime;
/** 是否重复 */ /**
* 是否重复
*/
private Integer repeat; private Integer repeat;
/** 重复周期 */ /**
* 重复周期
*/
private Integer repeatCycle; private Integer repeatCycle;
/** 0:天1:周2:月3:年 */ /**
* 0:天1:周2:月3:
*/
private Integer repeatCycleUnit; private Integer repeatCycleUnit;
/** 创建时间 */ /**
* 创建时间
*/
private Date createdTime; private Date createdTime;
/** 图片路径 */ /**
* 图片路径
*/
private String imgUrl; private String imgUrl;
/** 执行全局样式 */ /**
* 执行全局样式
*/
private String cssStyle; private String cssStyle;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -14,14 +14,13 @@ import java.util.Date;
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_sponsor") @Table(name = "forest_sponsor")
public class Sponsor implements Serializable, Cloneable { public class Sponsor implements Serializable, Cloneable {
/** /**
* 主键 * 主键
*/ */
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
/** /**
* 数据类型 * 数据类型
@ -30,12 +29,10 @@ public class Sponsor implements Serializable, Cloneable {
/** /**
* 数据主键 * 数据主键
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long dataId; private Long dataId;
/** /**
* 赞赏人 * 赞赏人
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long sponsor; private Long sponsor;
/** /**
* 赞赏日期 * 赞赏日期

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -15,37 +15,64 @@ import java.util.Date;
*/ */
@Data @Data
@Table(name = "forest_tag") @Table(name = "forest_tag")
public class Tag implements Serializable,Cloneable { public class Tag implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idTag; private Long idTag;
/** 标签名 */ /**
* 标签名
*/
private String tagTitle; private String tagTitle;
/** 标签图标 */ /**
* 标签图标
*/
private String tagIconPath; private String tagIconPath;
/** 标签uri */ /**
* 标签uri
*/
private String tagUri; private String tagUri;
/** 描述 */ /**
* 描述
*/
private String tagDescription; private String tagDescription;
/** 浏览量 */ /**
* 浏览量
*/
private Integer tagViewCount; private Integer tagViewCount;
/** 关联文章总数 */ /**
* 关联文章总数
*/
private Integer tagArticleCount; private Integer tagArticleCount;
/** 标签广告 */ /**
* 标签广告
*/
private String tagAd; private String tagAd;
/** 是否显示全站侧边栏广告 */ /**
* 是否显示全站侧边栏广告
*/
private String tagShowSideAd; private String tagShowSideAd;
/** 标签状态 */ /**
* 标签状态
*/
private String tagStatus; private String tagStatus;
/** 创建时间 */ /**
* 创建时间
*/
private Date createdTime; private Date createdTime;
/** 更新时间 */ /**
* 更新时间
*/
private Date updatedTime; private Date updatedTime;
/** 保留标签 */ /**
* 保留标签
*/
private String tagReservation; private String tagReservation;
/** 描述 */ /**
* 描述
*/
private String tagDescriptionHtml; private String tagDescriptionHtml;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -16,35 +16,60 @@ import java.util.Date;
@Table(name = "forest_topic") @Table(name = "forest_topic")
public class Topic { public class Topic {
/** 主键 */ /**
* 主键
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idTopic; private Long idTopic;
/** 专题标题 */ /**
* 专题标题
*/
private String topicTitle; private String topicTitle;
/** 专题路径 */ /**
* 专题路径
*/
private String topicUri; private String topicUri;
/** 专题描述 */ /**
* 专题描述
*/
private String topicDescription; private String topicDescription;
/** 专题类型 */ /**
* 专题类型
*/
private String topicType; private String topicType;
/** 专题序号;10 */ /**
* 专题序号;10
*/
private Integer topicSort; private Integer topicSort;
/** 专题图片路径 */ /**
* 专题图片路径
*/
private String topicIconPath; private String topicIconPath;
/** 0作为导航1不作为导航;0 */ /**
* 0作为导航1不作为导航;0
*/
private String topicNva; private String topicNva;
/** 专题下标签总数;0 */ /**
* 专题下标签总数;0
*/
private Integer topicTagCount; private Integer topicTagCount;
/** 0正常1禁用;0 */ /**
* 0正常1禁用;0
*/
private String topicStatus; private String topicStatus;
/** 创建时间 */ /**
* 创建时间
*/
private Date createdTime; private Date createdTime;
/** 更新时间 */ /**
* 更新时间
*/
private Date updatedTime; private Date updatedTime;
/** 专题描述 Html */ /**
* 专题描述 Html
*/
private String topicDescriptionHtml; private String topicDescriptionHtml;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -12,29 +12,45 @@ import java.util.Date;
/** /**
* 交易记录 * 交易记录
*
* @author ronger * @author ronger
*/ */
@Table(name = "forest_transaction_record") @Table(name = "forest_transaction_record")
@Data @Data
public class TransactionRecord { public class TransactionRecord {
/** 主键 */ /**
* 主键
*/
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idTransactionRecord; private Long idTransactionRecord;
/** 交易流水号 */ /**
* 交易流水号
*/
private String transactionNo; private String transactionNo;
/** 款项 */ /**
* 款项
*/
private String funds; private String funds;
/** 交易发起方 */ /**
* 交易发起方
*/
private String formBankAccount; private String formBankAccount;
/** 交易收款方 */ /**
* 交易收款方
*/
private String toBankAccount; private String toBankAccount;
/** 交易金额 */ /**
* 交易金额
*/
private BigDecimal money; private BigDecimal money;
/** 交易类型 */ /**
* 交易类型
*/
private String transactionType; private String transactionType;
/** 交易时间 */ /**
* 交易时间
*/
private Date transactionTime; private Date transactionTime;
} }

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.JdbcType;
import tk.mybatis.mapper.annotation.ColumnType; import tk.mybatis.mapper.annotation.ColumnType;
@ -18,114 +17,113 @@ import java.util.Date;
*/ */
@Table(name = "forest_user") @Table(name = "forest_user")
@Data @Data
public class User implements Serializable,Cloneable { public class User implements Serializable, Cloneable {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
/** /**
* 登录账号 * 登录账号
* */ */
@Column(name = "account") @Column(name = "account")
private String account; private String account;
/** /**
* 密码 * 密码
* */ */
@Column(name = "password") @Column(name = "password")
@JSONField(serialize=false) @JSONField(serialize = false)
private String password; private String password;
/** /**
* 昵称 * 昵称
* */ */
@Column(name = "nickname") @Column(name = "nickname")
private String nickname; private String nickname;
/** /**
* 真实姓名 * 真实姓名
* */ */
@Column(name = "real_name") @Column(name = "real_name")
private String realName; private String realName;
/** /**
* 性别 1:男性 2:女性 * 性别 1:男性 2:女性
* */ */
@Column(name = "sex") @Column(name = "sex")
private String sex; private String sex;
/** /**
* 头像文件类型 * 头像文件类型
* */ */
@Column(name = "avatar_type") @Column(name = "avatar_type")
private String avatarType; private String avatarType;
/** /**
* 头像路径 * 头像路径
* */ */
@Column(name = "avatar_url") @Column(name = "avatar_url")
private String avatarUrl; private String avatarUrl;
/** /**
* 邮箱地址 * 邮箱地址
* */ */
@ColumnType(column = "email", @ColumnType(column = "email",
jdbcType = JdbcType.VARCHAR) jdbcType = JdbcType.VARCHAR)
private String email; private String email;
/** /**
* 手机号码 * 手机号码
* */ */
@ColumnType(column = "phone", @ColumnType(column = "phone",
jdbcType = JdbcType.VARCHAR) jdbcType = JdbcType.VARCHAR)
private String phone; private String phone;
/** /**
* 签名 * 签名
* */ */
@ColumnType(column = "signature", @ColumnType(column = "signature",
jdbcType = JdbcType.VARCHAR) jdbcType = JdbcType.VARCHAR)
private String signature; private String signature;
/** /**
* 状态 * 状态
* */ */
@Column(name = "status") @Column(name = "status")
private String status; private String status;
/** /**
* 最后登录时间 * 最后登录时间
* */ */
@Column(name = "last_login_time") @Column(name = "last_login_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginTime; private Date lastLoginTime;
/** /**
* 创建时间 * 创建时间
* */ */
@Column(name = "created_time") @Column(name = "created_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;
/** /**
* 更新时间 * 更新时间
* */ */
@Column(name = "updated_time") @Column(name = "updated_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime; private Date updatedTime;
/** /**
* 最后在线时间 * 最后在线时间
* */ */
@Column(name = "last_online_time") @Column(name = "last_online_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date lastOnlineTime; private Date lastOnlineTime;
/** /**
* 个人中心背景图片 * 个人中心背景图片
* */ */
@Column(name = "bg_img_url") @Column(name = "bg_img_url")
private String bgImgUrl; private String bgImgUrl;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Id; import javax.persistence.Id;
@ -14,7 +14,6 @@ import javax.persistence.Table;
public class UserExtend { public class UserExtend {
@Id @Id
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser; private Long idUser;
private String github; private String github;

View File

@ -1,7 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -13,45 +12,64 @@ import java.util.Date;
/** /**
* 浏览表 * 浏览表
*
* @author ronger * @author ronger
*/ */
@Data @Data
@Table(name="forest_visit") @Table(name = "forest_visit")
public class Visit implements Serializable,Cloneable { public class Visit implements Serializable, Cloneable {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@Column(name = "id") @Column(name = "id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; private Long id;
/** 浏览链接 */ /**
* 浏览链接
*/
@Column(name = "visit_url") @Column(name = "visit_url")
private String visitUrl; private String visitUrl;
/** IP */ /**
* IP
*/
@Column(name = "visit_ip") @Column(name = "visit_ip")
private String visitIp; private String visitIp;
/** User-Agent */ /**
* User-Agent
*/
@Column(name = "visit_ua") @Column(name = "visit_ua")
private String visitUa; private String visitUa;
/** 城市 */ /**
* 城市
*/
@Column(name = "visit_city") @Column(name = "visit_city")
private String visitCity; private String visitCity;
/** 设备唯一标识 */ /**
* 设备唯一标识
*/
@Column(name = "visit_device_id") @Column(name = "visit_device_id")
private String visitDeviceId; private String visitDeviceId;
/** 浏览者 id */ /**
* 浏览者 id
*/
@Column(name = "visit_user_id") @Column(name = "visit_user_id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long visitUserId; private Long visitUserId;
/** 上游链接 */ /**
* 上游链接
*/
@Column(name = "visit_referer_url") @Column(name = "visit_referer_url")
private String visitRefererUrl; private String visitRefererUrl;
/** 创建时间 */ /**
* 创建时间
*/
@Column(name = "created_time") @Column(name = "created_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime; private Date createdTime;
/** 过期时间 */ /**
* 过期时间
*/
@Column(name = "expired_time") @Column(name = "expired_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date expiredTime; private Date expiredTime;

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.entity; package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
@ -18,7 +18,6 @@ public class WxUser {
@Id @Id
@Column(name = "id") @Column(name = "id")
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idWxUser; private Long idWxUser;
private Boolean subscribe; private Boolean subscribe;

View File

@ -24,7 +24,8 @@ import java.util.Map;
@RequestMapping("/api/v1/lucene/dic") @RequestMapping("/api/v1/lucene/dic")
public class UserDicController { public class UserDicController {
@Resource private UserDicService dicService; @Resource
private UserDicService dicService;
@GetMapping("/getAll") @GetMapping("/getAll")
public GlobalResult getAll( public GlobalResult getAll(

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.cfg; package com.rymcu.forest.lucene.cfg;

View File

@ -24,22 +24,36 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** Configuration 默认实现 2012-5-8 */ /**
* Configuration 默认实现 2012-5-8
*/
@Component @Component
public class DefaultConfig implements Configuration { public class DefaultConfig implements Configuration {
/** 分词器默认字典路径 */ /**
* 分词器默认字典路径
*/
private static final String PATH_DIC_MAIN = "lucene/main2012.dic"; private static final String PATH_DIC_MAIN = "lucene/main2012.dic";
/** 题词字典路径 */ /**
* 题词字典路径
*/
private static final String PATH_DIC_QUANTIFIER = "lucene/quantifier.dic"; private static final String PATH_DIC_QUANTIFIER = "lucene/quantifier.dic";
/** 用户自定义字典路径 */ /**
* 用户自定义字典路径
*/
private static final String PATH_USER_DIC = private static final String PATH_USER_DIC =
System.getProperty("user.dir") + "/lucene/userDic/userDic.dic"; System.getProperty("user.dir") + "/lucene/userDic/userDic.dic";
/** 配置属性——扩展字典 */ /**
* 配置属性扩展字典
*/
private String extDic = "lucene/ext.dic;" + PATH_USER_DIC; private String extDic = "lucene/ext.dic;" + PATH_USER_DIC;
/** 配置属性——扩展停止词典 */ /**
* 配置属性扩展停止词典
*/
private String extStopword = "lucene/stopword.dic"; private String extStopword = "lucene/stopword.dic";
/** 是否使用smart方式分词 */ /**
* 是否使用smart方式分词
*/
private boolean useSmart; private boolean useSmart;
/** /**

View File

@ -26,32 +26,58 @@ import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.util.*; import java.util.*;
/** 分词器上下文状态 */ /**
* 分词器上下文状态
*/
class AnalyzeContext { class AnalyzeContext {
/** 默认缓冲区大小 */ /**
* 默认缓冲区大小
*/
private static final int BUFF_SIZE = 4096; private static final int BUFF_SIZE = 4096;
/** 缓冲区耗尽的临界值 */ /**
* 缓冲区耗尽的临界值
*/
private static final int BUFF_EXHAUST_CRITICAL = 100; private static final int BUFF_EXHAUST_CRITICAL = 100;
/** 字符窜读取缓冲 */ /**
* 字符窜读取缓冲
*/
private char[] segmentBuff; private char[] segmentBuff;
/** 字符类型数组 */ /**
* 字符类型数组
*/
private int[] charTypes; private int[] charTypes;
/** 记录Reader内已分析的字串总长度 在分多段分析词元时该变量累计当前的segmentBuff相对于reader起始位置的位移 */ /**
* 记录Reader内已分析的字串总长度 在分多段分析词元时该变量累计当前的segmentBuff相对于reader起始位置的位移
*/
private int buffOffset; private int buffOffset;
/** 当前缓冲区位置指针 */ /**
* 当前缓冲区位置指针
*/
private int cursor; private int cursor;
/** 最近一次读入的,可处理的字串长度 */ /**
* 最近一次读入的,可处理的字串长度
*/
private int available; private int available;
/** 子分词器锁, 该集合非空说明有子分词器在占用segmentBuff */ /**
* 子分词器锁 该集合非空说明有子分词器在占用segmentBuff
*/
private final Set<String> buffLocker; private final Set<String> buffLocker;
/** 原始分词结果集合,未经歧义处理 */ /**
* 原始分词结果集合未经歧义处理
*/
private QuickSortSet orgLexemes; private QuickSortSet orgLexemes;
/** LexemePath位置索引表 */ /**
* LexemePath位置索引表
*/
private final Map<Integer, LexemePath> pathMap; private final Map<Integer, LexemePath> pathMap;
/** 最终分词结果集 */ /**
* 最终分词结果集
*/
private final LinkedList<Lexeme> results; private final LinkedList<Lexeme> results;
/** 分词器配置项 */ /**
* 分词器配置项
*/
private final Configuration cfg; private final Configuration cfg;
public AnalyzeContext(Configuration cfg) { public AnalyzeContext(Configuration cfg) {
@ -113,14 +139,18 @@ class AnalyzeContext {
return readCount; return readCount;
} }
/** 初始化buff指针处理第一个字符 */ /**
* 初始化buff指针处理第一个字符
*/
void initCursor() { void initCursor() {
this.cursor = 0; this.cursor = 0;
this.segmentBuff[this.cursor] = CharacterUtil.regularize(this.segmentBuff[this.cursor]); this.segmentBuff[this.cursor] = CharacterUtil.regularize(this.segmentBuff[this.cursor]);
this.charTypes[this.cursor] = CharacterUtil.identifyCharType(this.segmentBuff[this.cursor]); this.charTypes[this.cursor] = CharacterUtil.identifyCharType(this.segmentBuff[this.cursor]);
} }
/** 指针+1 成功返回 true 指针已经到了buff尾部不能前进返回false 并处理当前字符 */ /**
* 指针+1 成功返回 true 指针已经到了buff尾部不能前进返回false 并处理当前字符
*/
boolean moveCursor() { boolean moveCursor() {
if (this.cursor < this.available - 1) { if (this.cursor < this.available - 1) {
this.cursor++; this.cursor++;
@ -184,7 +214,9 @@ class AnalyzeContext {
&& !this.isBufferLocked(); && !this.isBufferLocked();
} }
/** 累计当前的segmentBuff相对于reader起始位置的位移 */ /**
* 累计当前的segmentBuff相对于reader起始位置的位移
*/
void markBufferOffset() { void markBufferOffset() {
this.buffOffset += this.cursor; this.buffOffset += this.cursor;
} }
@ -298,7 +330,9 @@ class AnalyzeContext {
return result; return result;
} }
/** 重置分词上下文状态 */ /**
* 重置分词上下文状态
*/
void reset() { void reset() {
this.buffLocker.clear(); this.buffLocker.clear();
this.orgLexemes = new QuickSortSet(); this.orgLexemes = new QuickSortSet();
@ -311,7 +345,9 @@ class AnalyzeContext {
this.pathMap.clear(); this.pathMap.clear();
} }
/** 组合词元 */ /**
* 组合词元
*/
private void compound(Lexeme result) { private void compound(Lexeme result) {
if (!this.cfg.useSmart()) { if (!this.cfg.useSmart()) {
return; return;

View File

@ -25,12 +25,18 @@ import com.rymcu.forest.lucene.dic.Hit;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/** 中文-日韩文子分词器 */ /**
* 中文-日韩文子分词器
*/
class CJKSegmenter implements ISegmenter { class CJKSegmenter implements ISegmenter {
/** 子分词器标签 */ /**
* 子分词器标签
*/
static final String SEGMENTER_NAME = "CJK_SEGMENTER"; static final String SEGMENTER_NAME = "CJK_SEGMENTER";
/** 待处理的分词hit队列 */ /**
* 待处理的分词hit队列
*/
private List<Hit> tmpHits; private List<Hit> tmpHits;
CJKSegmenter() { CJKSegmenter() {

View File

@ -27,13 +27,19 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
/** 中文数量词子分词器 */ /**
* 中文数量词子分词器
*/
class CN_QuantifierSegmenter implements ISegmenter { class CN_QuantifierSegmenter implements ISegmenter {
/** 子分词器标签 */ /**
* 子分词器标签
*/
static final String SEGMENTER_NAME = "QUAN_SEGMENTER"; static final String SEGMENTER_NAME = "QUAN_SEGMENTER";
/** 中文数词 */ /**
* 中文数词
*/
private static String Chn_Num = "一二两三四五六七八九十零壹贰叁肆伍陆柒捌玖拾百千万亿拾佰仟萬億兆卅廿"; private static String Chn_Num = "一二两三四五六七八九十零壹贰叁肆伍陆柒捌玖拾百千万亿拾佰仟萬億兆卅廿";
private static Set<Character> ChnNumberChars = new HashSet<>(); private static Set<Character> ChnNumberChars = new HashSet<>();
@ -45,12 +51,18 @@ class CN_QuantifierSegmenter implements ISegmenter {
} }
} }
/** 词元的开始位置, 同时作为子分词器状态标识 当start > -1 时,标识当前的分词器正在处理字符 */ /**
* 词元的开始位置 同时作为子分词器状态标识 当start > -1 标识当前的分词器正在处理字符
*/
private int nStart; private int nStart;
/** 记录词元结束位置 end记录的是在词元中最后一个出现的合理的数词结束 */ /**
* 记录词元结束位置 end记录的是在词元中最后一个出现的合理的数词结束
*/
private int nEnd; private int nEnd;
/** 待处理的量词hit队列 */ /**
* 待处理的量词hit队列
*/
private final List<Hit> countHits; private final List<Hit> countHits;
CN_QuantifierSegmenter() { CN_QuantifierSegmenter() {
@ -59,7 +71,9 @@ class CN_QuantifierSegmenter implements ISegmenter {
this.countHits = new LinkedList<Hit>(); this.countHits = new LinkedList<Hit>();
} }
/** 分词 */ /**
* 分词
*/
@Override @Override
public void analyze(AnalyzeContext context) { public void analyze(AnalyzeContext context) {
// 处理中文数词 // 处理中文数词
@ -75,7 +89,9 @@ class CN_QuantifierSegmenter implements ISegmenter {
} }
} }
/** 重置子分词器状态 */ /**
* 重置子分词器状态
*/
@Override @Override
public void reset() { public void reset() {
nStart = -1; nStart = -1;
@ -83,7 +99,9 @@ class CN_QuantifierSegmenter implements ISegmenter {
countHits.clear(); countHits.clear();
} }
/** 处理数词 */ /**
* 处理数词
*/
private void processCNumber(AnalyzeContext context) { private void processCNumber(AnalyzeContext context) {
if (nStart == -1 && nEnd == -1) { // 初始状态 if (nStart == -1 && nEnd == -1) { // 初始状态
if (CharacterUtil.CHAR_CHINESE == context.getCurrentCharType() if (CharacterUtil.CHAR_CHINESE == context.getCurrentCharType()

View File

@ -21,7 +21,9 @@
*/ */
package com.rymcu.forest.lucene.core; package com.rymcu.forest.lucene.core;
/** 字符集识别工具类 */ /**
* 字符集识别工具类
*/
class CharacterUtil { class CharacterUtil {
public static final int CHAR_USELESS = 0; public static final int CHAR_USELESS = 0;

View File

@ -22,10 +22,13 @@ package com.rymcu.forest.lucene.core;
import java.util.Stack; import java.util.Stack;
import java.util.TreeSet; import java.util.TreeSet;
/** IK分词歧义裁决器 */ /**
* IK分词歧义裁决器
*/
class IKArbitrator { class IKArbitrator {
IKArbitrator() {} IKArbitrator() {
}
/** /**
* 分词歧义处理 * 分词歧义处理

View File

@ -28,18 +28,30 @@ import java.io.Reader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** IK分词器主类 */ /**
* IK分词器主类
*/
public final class IKSegmenter { public final class IKSegmenter {
/** 字符窜reader */ /**
* 字符窜reader
*/
private Reader input; private Reader input;
/** 分词器配置项 */ /**
* 分词器配置项
*/
private Configuration cfg; private Configuration cfg;
/** 分词器上下文 */ /**
* 分词器上下文
*/
private AnalyzeContext context; private AnalyzeContext context;
/** 分词处理器列表 */ /**
* 分词处理器列表
*/
private List<ISegmenter> segmenters; private List<ISegmenter> segmenters;
/** 分词歧义裁决器 */ /**
* 分词歧义裁决器
*/
private IKArbitrator arbitrator; private IKArbitrator arbitrator;
/** /**
@ -68,7 +80,9 @@ public final class IKSegmenter {
this.init(); this.init();
} }
/** 初始化 */ /**
* 初始化
*/
private void init() { private void init() {
// 初始化词典单例 // 初始化词典单例
Dictionary.initial(this.cfg); Dictionary.initial(this.cfg);

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.core; package com.rymcu.forest.lucene.core;

View File

@ -21,26 +21,46 @@ package com.rymcu.forest.lucene.core;
import java.util.Arrays; import java.util.Arrays;
/** 英文字符及阿拉伯数字子分词器 */ /**
* 英文字符及阿拉伯数字子分词器
*/
class LetterSegmenter implements ISegmenter { class LetterSegmenter implements ISegmenter {
/** 子分词器标签 */ /**
* 子分词器标签
*/
static final String SEGMENTER_NAME = "LETTER_SEGMENTER"; static final String SEGMENTER_NAME = "LETTER_SEGMENTER";
/** 链接符号 */ /**
private static final char[] Letter_Connector = new char[] {'#', '&', '+', '-', '.', '@', '_'}; * 链接符号
/** 数字符号 */ */
private static final char[] Num_Connector = new char[] {',', '.'}; private static final char[] Letter_Connector = new char[]{'#', '&', '+', '-', '.', '@', '_'};
/** 词元的开始位置, 同时作为子分词器状态标识 当start > -1 时,标识当前的分词器正在处理字符 */ /**
* 数字符号
*/
private static final char[] Num_Connector = new char[]{',', '.'};
/**
* 词元的开始位置 同时作为子分词器状态标识 当start > -1 标识当前的分词器正在处理字符
*/
private int start; private int start;
/** 记录词元结束位置 end记录的是在词元中最后一个出现的Letter但非Sign_Connector的字符的位置 */ /**
* 记录词元结束位置 end记录的是在词元中最后一个出现的Letter但非Sign_Connector的字符的位置
*/
private int end; private int end;
/** 字母起始位置 */ /**
* 字母起始位置
*/
private int englishStart; private int englishStart;
/** 字母结束位置 */ /**
* 字母结束位置
*/
private int englishEnd; private int englishEnd;
/** 阿拉伯数字起始位置 */ /**
* 阿拉伯数字起始位置
*/
private int arabicStart; private int arabicStart;
/** 阿拉伯数字结束位置 */ /**
* 阿拉伯数字结束位置
*/
private int arabicEnd; private int arabicEnd;
LetterSegmenter() { LetterSegmenter() {

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.core; package com.rymcu.forest.lucene.core;

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.core; package com.rymcu.forest.lucene.core;

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.core; package com.rymcu.forest.lucene.core;

View File

@ -1,27 +1,25 @@
/** /**
*
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.dic; package com.rymcu.forest.lucene.dic;

View File

@ -28,21 +28,35 @@ import java.nio.charset.StandardCharsets;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
/** 词典管理类,单例模式 */ /**
* 词典管理类,单例模式
*/
public class Dictionary { public class Dictionary {
/** 词典单例 */ /**
* 词典单例
*/
private static Dictionary singleton; private static Dictionary singleton;
/** 主词典对象 */ /**
* 主词典对象
*/
private DictSegment _MainDict; private DictSegment _MainDict;
/** 停止词词典 */ /**
* 停止词词典
*/
private DictSegment _StopWordDict; private DictSegment _StopWordDict;
/** 量词词典 */ /**
* 量词词典
*/
private DictSegment _QuantifierDict; private DictSegment _QuantifierDict;
/** 用户自定义词典路径 */ /**
* 用户自定义词典路径
*/
private static final String PATH_USER_DIC = private static final String PATH_USER_DIC =
System.getProperty("user.dir") + "/lucene/userDic/userDic.dic"; System.getProperty("user.dir") + "/lucene/userDic/userDic.dic";
/** 配置对象 */ /**
* 配置对象
*/
private final Configuration cfg; private final Configuration cfg;
private Dictionary(Configuration cfg) { private Dictionary(Configuration cfg) {
@ -169,7 +183,9 @@ public class Dictionary {
return singleton._StopWordDict.match(charArray, begin, length).isMatch(); return singleton._StopWordDict.match(charArray, begin, length).isMatch();
} }
/** 加载主词典及扩展词典 */ /**
* 加载主词典及扩展词典
*/
private void loadMainDict() { private void loadMainDict() {
// 建立一个主词典实例 // 建立一个主词典实例
_MainDict = new DictSegment((char) 0); _MainDict = new DictSegment((char) 0);
@ -194,7 +210,9 @@ public class Dictionary {
this.loadExtDict(); this.loadExtDict();
} }
/** 加载用户配置的扩展词典到主词库表 */ /**
* 加载用户配置的扩展词典到主词库表
*/
private void loadExtDict() { private void loadExtDict() {
// 加载扩展词典配置 // 加载扩展词典配置
List<String> extDictFiles = cfg.getExtDictionary(); List<String> extDictFiles = cfg.getExtDictionary();
@ -238,7 +256,9 @@ public class Dictionary {
} }
} }
/** 加载用户扩展的停止词词典 */ /**
* 加载用户扩展的停止词词典
*/
private void loadStopWordDict() { private void loadStopWordDict() {
// 建立一个主词典实例 // 建立一个主词典实例
_StopWordDict = new DictSegment((char) 0); _StopWordDict = new DictSegment((char) 0);
@ -278,7 +298,9 @@ public class Dictionary {
} }
} }
/** 加载量词词典 */ /**
* 加载量词词典
*/
private void loadQuantifierDict() { private void loadQuantifierDict() {
// 建立一个量词典实例 // 建立一个量词典实例
_QuantifierDict = new DictSegment((char) 0); _QuantifierDict = new DictSegment((char) 0);
@ -310,7 +332,9 @@ public class Dictionary {
} }
} }
/** 加载用户配置的自定义扩展词典到主词库表 */ /**
* 加载用户配置的自定义扩展词典到主词库表
*/
public void updateUserDict() { public void updateUserDict() {
// 加载扩展词典配置 // 加载扩展词典配置
InputStream is; InputStream is;

View File

@ -1,27 +1,25 @@
/** /**
*
* IK 中文分词 版本 5.0 * IK 中文分词 版本 5.0
* IK Analyzer release 5.0 * IK Analyzer release 5.0
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.dic; package com.rymcu.forest.lucene.dic;

View File

@ -16,17 +16,27 @@ import java.util.concurrent.CountDownLatch;
* @date 2021/2/2 14:14 * @date 2021/2/2 14:14
*/ */
public abstract class BaseIndex<T> implements Runnable { public abstract class BaseIndex<T> implements Runnable {
/** 父级索引路径 */ /**
* 父级索引路径
*/
private String parentIndexPath; private String parentIndexPath;
/** 索引编写器 */ /**
* 索引编写器
*/
private IndexWriter writer; private IndexWriter writer;
private int subIndex; private int subIndex;
/** 主线程 */ /**
* 主线程
*/
private final CountDownLatch countDownLatch1; private final CountDownLatch countDownLatch1;
/** 工作线程 */ /**
* 工作线程
*/
private final CountDownLatch countDownLatch2; private final CountDownLatch countDownLatch2;
/** 对象列表 */ /**
* 对象列表
*/
private List<T> list; private List<T> list;
public BaseIndex(String parentIndexPath, int subIndex) { public BaseIndex(String parentIndexPath, int subIndex) {
@ -106,6 +116,7 @@ public abstract class BaseIndex<T> implements Runnable {
* @throws ParseException * @throws ParseException
*/ */
public abstract void indexDoc(IndexWriter writer, T t) throws Exception; public abstract void indexDoc(IndexWriter writer, T t) throws Exception;
/** /**
* 批量索引创建 * 批量索引创建
* *

View File

@ -1,26 +1,25 @@
/** /**
* IK 中文分词 版本 5.0.1 * IK 中文分词 版本 5.0.1
* IK Analyzer release 5.0.1 * IK Analyzer release 5.0.1
* * <p>
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0 * The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with * (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* * <p>
* 源代码由林良益(linliangyi2005@gmail.com)提供 * 源代码由林良益(linliangyi2005@gmail.com)提供
* 版权声明 2012乌龙茶工作室 * 版权声明 2012乌龙茶工作室
* provided by Linliangyi and copyright 2012 by Oolong studio * provided by Linliangyi and copyright 2012 by Oolong studio
*
*/ */
package com.rymcu.forest.lucene.lucene; package com.rymcu.forest.lucene.lucene;

View File

@ -55,6 +55,7 @@ public final class IKTokenizer extends Tokenizer {
/** /**
* Lucene 6.0 Tokenizer适配器类构造函数 * Lucene 6.0 Tokenizer适配器类构造函数
*
* @param useSmart * @param useSmart
*/ */
public IKTokenizer(boolean useSmart) { public IKTokenizer(boolean useSmart) {
@ -70,6 +71,7 @@ public final class IKTokenizer extends Tokenizer {
/** /**
* lucene 6.0 新增 * lucene 6.0 新增
* 方便创建 工厂类 * 方便创建 工厂类
*
* @param factory * @param factory
* @param useSmart * @param useSmart
*/ */

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.lucene.model; package com.rymcu.forest.lucene.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -18,16 +18,23 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class ArticleLucene { public class ArticleLucene {
/** 文章编号 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 文章编号
*/
private Long idArticle; private Long idArticle;
/** 文章标题 */ /**
* 文章标题
*/
private String articleTitle; private String articleTitle;
/** 文章内容 */ /**
* 文章内容
*/
private String articleContent; private String articleContent;
/** 相关度评分 */ /**
* 相关度评分
*/
private String score; private String score;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.lucene.model; package com.rymcu.forest.lucene.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -18,16 +18,23 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class PortfolioLucene { public class PortfolioLucene {
/** 作品集编号 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 作品集编号
*/
private Long idPortfolio; private Long idPortfolio;
/** 作品集名称 */ /**
* 作品集名称
*/
private String portfolioTitle; private String portfolioTitle;
/** 作品集介绍 */ /**
* 作品集介绍
*/
private String portfolioDescription; private String portfolioDescription;
/** 相关度评分 */ /**
* 相关度评分
*/
private String score; private String score;
} }

View File

@ -15,11 +15,15 @@ import javax.persistence.Table;
@Data @Data
@Table(name = "forest_lucene_user_dic") @Table(name = "forest_lucene_user_dic")
public class UserDic { public class UserDic {
/** 主键 */ /**
* 主键
*/
@Id @Id
@GeneratedValue(generator = "JDBC") @GeneratedValue(generator = "JDBC")
private Integer id; private Integer id;
/** 字典 */ /**
* 字典
*/
private String dic; private String dic;
} }

View File

@ -1,6 +1,6 @@
package com.rymcu.forest.lucene.model; package com.rymcu.forest.lucene.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -18,16 +18,23 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
public class UserLucene { public class UserLucene {
/** 用户编号 */ /**
@JsonFormat(shape = JsonFormat.Shape.STRING) * 用户编号
*/
private Long idUser; private Long idUser;
/** 昵称 */ /**
* 昵称
*/
private String nickname; private String nickname;
/** 签名 */ /**
* 签名
*/
private String signature; private String signature;
/** 相关度评分 */ /**
* 相关度评分
*/
private String score; private String score;
} }

View File

@ -50,7 +50,6 @@ public interface UserDicService {
/** /**
* 写入字典至内存 * 写入字典至内存
*
*/ */
void writeUserDic() throws FileNotFoundException; void writeUserDic() throws FileNotFoundException;
} }

View File

@ -20,7 +20,8 @@ import java.util.List;
@Service @Service
public class UserDicServiceImpl implements UserDicService { public class UserDicServiceImpl implements UserDicService {
@Resource private UserDicMapper userDicMapper; @Resource
private UserDicMapper userDicMapper;
@Override @Override
public List<String> getAllDic() { public List<String> getAllDic() {

View File

@ -41,7 +41,8 @@ import java.util.concurrent.Executors;
@Service @Service
public class UserLuceneServiceImpl implements UserLuceneService { public class UserLuceneServiceImpl implements UserLuceneService {
@Resource private UserLuceneMapper userLuceneMapper; @Resource
private UserLuceneMapper userLuceneMapper;
/** /**

View File

@ -22,12 +22,13 @@ import java.nio.file.Paths;
public class IndexUtil { public class IndexUtil {
/** /**
* 创建索引写入器 * 创建索引写入器
*
* @param indexPath * @param indexPath
* @param create * @param create
* @return * @return
* @throws IOException * @throws IOException
*/ */
public static IndexWriter getIndexWriter(String indexPath,boolean create) throws IOException{ public static IndexWriter getIndexWriter(String indexPath, boolean create) throws IOException {
Directory dir = FSDirectory.open(Paths.get(indexPath)); Directory dir = FSDirectory.open(Paths.get(indexPath));
Analyzer analyzer = new IKAnalyzer(); Analyzer analyzer = new IKAnalyzer();
IndexWriterConfig iwc = new IndexWriterConfig(analyzer); IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
@ -40,9 +41,9 @@ public class IndexUtil {
//值较小有利于追加索引的速度 //值较小有利于追加索引的速度
//值较大,适合批量建立索引和更快的搜索 //值较大,适合批量建立索引和更快的搜索
mergePolicy.setMaxMergeDocs(5000); mergePolicy.setMaxMergeDocs(5000);
if (create){ if (create) {
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE); iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
}else { } else {
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
} }
return new IndexWriter(dir, iwc); return new IndexWriter(dir, iwc);

View File

@ -7,27 +7,41 @@ package com.rymcu.forest.lucene.util;
*/ */
public final class LucenePath { public final class LucenePath {
/** lucene 目录 */ /**
* lucene 目录
*/
public static final String INDEX_PATH = "/lucene/index"; public static final String INDEX_PATH = "/lucene/index";
/** 文章 lucene 目录 */ /**
* 文章 lucene 目录
*/
public static final String ARTICLE_INDEX_PATH = INDEX_PATH + "/article"; public static final String ARTICLE_INDEX_PATH = INDEX_PATH + "/article";
/** 文章增量 lucene 目录 */ /**
* 文章增量 lucene 目录
*/
public static final String ARTICLE_INCREMENT_INDEX_PATH = public static final String ARTICLE_INCREMENT_INDEX_PATH =
System.getProperty("user.dir") + ARTICLE_INDEX_PATH + "/index777"; System.getProperty("user.dir") + ARTICLE_INDEX_PATH + "/index777";
/** 用户 lucene 目录 */ /**
* 用户 lucene 目录
*/
public static final String USER_PATH = INDEX_PATH + "/user"; public static final String USER_PATH = INDEX_PATH + "/user";
/** 用户增量 lucene 目录 */ /**
* 用户增量 lucene 目录
*/
public static final String USER_INCREMENT_INDEX_PATH = public static final String USER_INCREMENT_INDEX_PATH =
System.getProperty("user.dir") + USER_PATH + "/index777"; System.getProperty("user.dir") + USER_PATH + "/index777";
/** 作品集 lucene 目录 */ /**
* 作品集 lucene 目录
*/
public static final String PORTFOLIO_PATH = INDEX_PATH + "/portfolio"; public static final String PORTFOLIO_PATH = INDEX_PATH + "/portfolio";
/** 作品集增量 lucene 目录 */ /**
* 作品集增量 lucene 目录
*/
public static final String PORTFOLIO_INCREMENT_INDEX_PATH = public static final String PORTFOLIO_INCREMENT_INDEX_PATH =
System.getProperty("user.dir") + PORTFOLIO_PATH + "/index777"; System.getProperty("user.dir") + PORTFOLIO_PATH + "/index777";
} }

View File

@ -20,11 +20,15 @@ import java.util.Arrays;
*/ */
public class PortfolioIndexUtil { public class PortfolioIndexUtil {
/** lucene索引保存目录 */ /**
* lucene索引保存目录
*/
private static final String PATH = private static final String PATH =
System.getProperty("user.dir") + StrUtil.SLASH + LucenePath.PORTFOLIO_PATH; System.getProperty("user.dir") + StrUtil.SLASH + LucenePath.PORTFOLIO_PATH;
/** 删除所有运行中保存的索引 */ /**
* 删除所有运行中保存的索引
*/
public static void deleteAllIndex() { public static void deleteAllIndex() {
if (FileUtil.exist(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH)) { if (FileUtil.exist(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH)) {
FileUtil.del(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH); FileUtil.del(LucenePath.PORTFOLIO_INCREMENT_INDEX_PATH);
@ -62,7 +66,9 @@ public class PortfolioIndexUtil {
} }
} }
/** 删除单个索引 */ /**
* 删除单个索引
*/
public static synchronized void deleteIndex(Long id) { public static synchronized void deleteIndex(Long id) {
Arrays.stream(FileUtil.ls(PATH)) Arrays.stream(FileUtil.ls(PATH))
.forEach( .forEach(

View File

@ -47,6 +47,7 @@ public class SearchUtil {
} }
return new IndexSearcher(reader, service); return new IndexSearcher(reader, service);
} }
/** /**
* 根据索引路径获取IndexReader * 根据索引路径获取IndexReader
* *
@ -57,6 +58,7 @@ public class SearchUtil {
public static DirectoryReader getIndexReader(String indexPath) throws IOException { public static DirectoryReader getIndexReader(String indexPath) throws IOException {
return DirectoryReader.open(FSDirectory.open(Paths.get(indexPath))); return DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
} }
/** /**
* 根据索引路径获取IndexSearcher * 根据索引路径获取IndexSearcher
* *
@ -98,6 +100,7 @@ public class SearchUtil {
throws IOException { throws IOException {
return searcher.doc(docID); return searcher.doc(docID);
} }
/** /**
* 根据IndexSearcher和docID * 根据IndexSearcher和docID
* *
@ -145,6 +148,7 @@ public class SearchUtil {
TopDocs docs = searcher.search(query, getMaxDocId(searcher)); TopDocs docs = searcher.search(query, getMaxDocId(searcher));
return docs; return docs;
} }
/** /**
* 统计document的数量,此方法等同于matchAllDocsQuery查询 * 统计document的数量,此方法等同于matchAllDocsQuery查询
* *

View File

@ -17,6 +17,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取文章列表 * 获取文章列表
*
* @param searchText * @param searchText
* @param tag * @param tag
* @param topicUri * @param topicUri
@ -26,6 +27,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 根据文章 ID 查询文章 * 根据文章 ID 查询文章
*
* @param id * @param id
* @param type * @param type
* @return * @return
@ -34,6 +36,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 保存文章内容 * 保存文章内容
*
* @param idArticle * @param idArticle
* @param articleContent * @param articleContent
* @param articleContentHtml * @param articleContentHtml
@ -43,6 +46,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 更新文章内容 * 更新文章内容
*
* @param idArticle * @param idArticle
* @param articleContent * @param articleContent
* @param articleContentHtml * @param articleContentHtml
@ -52,6 +56,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取文章正文内容 * 获取文章正文内容
*
* @param idArticle * @param idArticle
* @return * @return
*/ */
@ -59,6 +64,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取主题下文章列表 * 获取主题下文章列表
*
* @param topicName * @param topicName
* @return * @return
*/ */
@ -66,6 +72,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取标签下文章列表 * 获取标签下文章列表
*
* @param tagName * @param tagName
* @return * @return
*/ */
@ -73,6 +80,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取用户文章列表 * 获取用户文章列表
*
* @param idUser * @param idUser
* @return * @return
*/ */
@ -80,6 +88,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 删除文章标签 * 删除文章标签
*
* @param id * @param id
* @return * @return
*/ */
@ -87,6 +96,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取文章标签列表 * 获取文章标签列表
*
* @param idArticle * @param idArticle
* @return * @return
*/ */
@ -94,6 +104,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 更新文章浏览数 * 更新文章浏览数
*
* @param id * @param id
* @param articleViewCount * @param articleViewCount
* @return * @return
@ -102,6 +113,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 获取草稿列表 * 获取草稿列表
*
* @param idUser * @param idUser
* @return * @return
*/ */
@ -109,6 +121,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 删除未使用的文章标签 * 删除未使用的文章标签
*
* @param idArticleTag * @param idArticleTag
* @return * @return
*/ */
@ -116,6 +129,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 查询作品集下文章 * 查询作品集下文章
*
* @param idPortfolio * @param idPortfolio
* @return * @return
*/ */
@ -123,6 +137,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 查询作品集未绑定文章 * 查询作品集未绑定文章
*
* @param idPortfolio * @param idPortfolio
* @param searchText * @param searchText
* @param idUser * @param idUser
@ -132,6 +147,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 查询文章所属作品集列表 * 查询文章所属作品集列表
*
* @param idArticle * @param idArticle
* @return * @return
*/ */
@ -139,6 +155,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 更新文章标签 * 更新文章标签
*
* @param idArticle * @param idArticle
* @param tags * @param tags
* @return * @return
@ -147,6 +164,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 判断是否有评论 * 判断是否有评论
*
* @param id * @param id
* @return * @return
*/ */
@ -154,6 +172,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 删除关联作品集数据 * 删除关联作品集数据
*
* @param id * @param id
* @return * @return
*/ */
@ -161,6 +180,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 更新文章连接及预览内容 * 更新文章连接及预览内容
*
* @param idArticle * @param idArticle
* @param articleLink * @param articleLink
* @param articlePermalink * @param articlePermalink
@ -171,6 +191,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 根据专题主键及当前文章排序号获取专题下文章大纲 * 根据专题主键及当前文章排序号获取专题下文章大纲
*
* @param idPortfolio * @param idPortfolio
* @param sortNo * @param sortNo
* @return * @return
@ -179,6 +200,7 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 更新文章优选状态 * 更新文章优选状态
*
* @param idArticle * @param idArticle
* @param articlePerfect * @param articlePerfect
* @return * @return
@ -187,12 +209,14 @@ public interface ArticleMapper extends Mapper<Article> {
/** /**
* 删除文章关联文章内容表信息 * 删除文章关联文章内容表信息
*
* @param idArticle * @param idArticle
*/ */
void deleteArticleContent(@Param("idArticle") Long idArticle); void deleteArticleContent(@Param("idArticle") Long idArticle);
/** /**
* 获取公告 * 获取公告
*
* @return * @return
*/ */
List<ArticleDTO> selectAnnouncements(); List<ArticleDTO> selectAnnouncements();

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