注释完善

This commit is contained in:
暮光:城中城
2021-11-24 23:28:49 +08:00
parent aae8a9994a
commit 4408525b45
144 changed files with 923 additions and 854 deletions

View File

@@ -3,11 +3,9 @@ package com.zyplayer.doc.data.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInterceptor;
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
import com.zyplayer.doc.data.utils.DruidDataSourceUtil;
import org.apache.ibatis.plugin.Interceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@@ -17,10 +15,12 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.Properties;
/**
* mybatis plus数据库配置
*
* @author 暮光:城中城
* @since 2019-02-16
*/
@Configuration
public class MybatisPlusConfig {

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.config.security;
import java.util.Set;
/**
* 登录用户信息
*
* @author 暮光:城中城
* @since 2018-12-02
*/
public class DocUserDetails {
private Long userId;
private String username;

View File

@@ -7,12 +7,13 @@ import java.util.Set;
/**
* 用户工具类
*
* @author 暮光:城中城
* @since 2019年05月25日
*/
public class DocUserUtil {
private static ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>();
private static ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>();
private static final ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>();
private static final ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>();
public static void setAccessToken(String accessToken) {
DocUserUtil.ACCESS_TOKEN.set(accessToken);

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.repository.manage.param;
import java.util.List;
/**
* 文档搜索参数
*
* @author 暮光:城中城
* @since 2019-07-10
*/
public class SearchByEsParam {
private Long spaceId;
private String keywords;

View File

@@ -2,6 +2,7 @@ package com.zyplayer.doc.data.repository.manage.param;
/**
* 表关系请求参数
*
* @author 暮光:城中城
* @since 2021-06-07
*/

View File

@@ -2,6 +2,12 @@ package com.zyplayer.doc.data.repository.manage.vo;
import java.util.Date;
/**
* 最新文档信息
*
* @author 暮光:城中城
* @since 2019-06-14
*/
public class SpaceNewsVo {
private String space;
private Long spaceId;

View File

@@ -4,6 +4,7 @@ import java.util.List;
/**
* 表关系结构
*
* @author 暮光:城中城
* @since 2021-06-07
*/

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts;
/**
* 授权信息静态类
*
* @author 暮光:城中城
* @since 2019-08-22
*/
public class DocAuthConst {
public static final String DB = "DB_";
public static final String WIKI = "WIKI_";

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts;
/**
* 系统类型枚举
*
* @author 暮光:城中城
* @since 2020-06-26
*/
public enum UserMsgSysType {
// 系统类型 1=manage 2=wiki 3=db
MANAGE(1), WIKI(2), DB(2),

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts;
/**
* 用户消息类型
*
* @author 暮光:城中城
* @since 2020-06-26
*/
public enum UserMsgType {
// 消息类型 1=普通文本消息 2=wiki文档创建 3=wiki文档删除 4=wiki文档编辑 5=wiki文档权限修改
// 6=wiki文档评论 7=wiki文档删除评论 8=wiki文档上传附件 9=wiki文档修改了父级 10=wiki文档点赞 11=wiki文档附件删除

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.repository.support.consts;
/**
* 用户自定义配置的key
*
* @author 暮光:城中城
* @since 2021-02-09
*/
public class UserSettingConst {
public static final String WIKI_ONLY_SHOW_FAVORITE = "wiki_only_show_favorite";
}

View File

@@ -7,6 +7,12 @@ import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.Collections;
/**
* 代码生成器
*
* @author 暮光:城中城
* @since 2019-02-26
*/
public class CodeGenerator {
public static void main(String[] args) {

View File

@@ -20,15 +20,21 @@ import java.util.List;
import java.util.Locale;
import java.util.Properties;
/**
* 日志拦截
*
* @author 暮光:城中城
* @since 2019-02-26
*/
@Intercepts({
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
})
public class SqlLogInterceptor implements Interceptor {
private static final Logger LOGGER = LoggerFactory.getLogger(SqlLogInterceptor.class);
@Override
public Object intercept(Invocation invocation) throws Throwable {
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
@@ -44,7 +50,7 @@ public class SqlLogInterceptor implements Interceptor {
// 执行结果
return invocation.proceed();
}
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
@@ -53,11 +59,11 @@ public class SqlLogInterceptor implements Interceptor {
return target;
}
}
@Override
public void setProperties(Properties properties) {
}
private String getParameterValue(Object obj) {
String value = null;
if (obj instanceof String) {
@@ -75,7 +81,7 @@ public class SqlLogInterceptor implements Interceptor {
}
return value;
}
public String getSqlString(Configuration configuration, BoundSql boundSql) {
Object parameterObject = boundSql.getParameterObject();
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
@@ -104,15 +110,16 @@ public class SqlLogInterceptor implements Interceptor {
}
return sqlSb.toString();
}
/**
* 替换?占位符
* @author 暮光:城中城
* @since 2018年10月27日
*
* @param sql
* @param fromIndex
* @param replaceStr
* @return
* @author 暮光:城中城
* @since 2018年10月27日
*/
private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
int index = sql.indexOf("?", fromIndex);

View File

@@ -1,5 +1,11 @@
package com.zyplayer.doc.data.utils;
/**
* 缓存前缀
*
* @author 暮光:城中城
* @since 2019-08-27
*/
public class CachePrefix {
public static final String WIKI_LOCK_PAGE = "WIKI_LOCK_PAGE_";
public static final String DB_EDITOR_DATA_CACHE = "DB_EDITOR_DATA_CACHE_";

View File

@@ -53,6 +53,7 @@ public class CacheUtil {
/**
* 放入缓存默认12小时按最后一次访问的12小时
*
* @param key
* @param value
*/
@@ -62,6 +63,7 @@ public class CacheUtil {
/**
* 放入缓存,有访问则继续有效
*
* @param key
* @param value
* @param seconds 缓存时长 秒
@@ -75,6 +77,7 @@ public class CacheUtil {
/**
* 删除缓存
*
* @param key
*/
public static void remove(String key) {
@@ -86,6 +89,7 @@ public class CacheUtil {
/**
* 获取缓存
*
* @param key
*/
@SuppressWarnings("unchecked")
@@ -102,7 +106,9 @@ public class CacheUtil {
}
private static class CacheData {
/**缓存时长 秒*/
/**
* 缓存时长 秒
*/
private Long seconds;
private Long lastVisitTime;
private Object data;

View File

@@ -7,6 +7,12 @@ import com.zyplayer.doc.core.exception.ConfirmException;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
/**
* Druid连接池工具类
*
* @author 暮光:城中城
* @since 2020-04-08
*/
public class DruidDataSourceUtil {
private static AtomicLong nameId = new AtomicLong(0);

View File

@@ -4,6 +4,12 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 线程池工具类
*
* @author 暮光:城中城
* @since 2019-10-06
*/
public class ThreadPoolUtil {
private static final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(20, 100, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>());