Compare commits
157 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93e6575a18 | ||
|
|
c4ccaa20ca | ||
|
|
abc24b424f | ||
|
|
9c29f4c8fd | ||
|
|
6f38aed1ae | ||
|
|
38e1f28305 | ||
|
|
04f36bf3ad | ||
|
|
63f6b80b79 | ||
|
|
cbaee753cb | ||
|
|
607a97b51b | ||
|
|
6c2141e8b8 | ||
|
|
f5e45b776b | ||
|
|
ec9674441f | ||
|
|
48e4a73ea9 | ||
|
|
76b18edc87 | ||
|
|
1f7cd7ad6c | ||
|
|
f0920be5a5 | ||
|
|
b62b521129 | ||
|
|
7f9e2c790b | ||
|
|
93f859bcbe | ||
|
|
4d6b09d640 | ||
|
|
2c11dbdcf0 | ||
|
|
26b700fde3 | ||
|
|
f9173925ab | ||
|
|
883540488b | ||
|
|
fadf52cec8 | ||
|
|
116e04e3bf | ||
|
|
9d7149aa04 | ||
|
|
fc02414519 | ||
|
|
417132d25c | ||
|
|
fb5438e1ec | ||
|
|
25036fb197 | ||
|
|
5084b4ce6a | ||
|
|
bf2bf47f53 | ||
|
|
cfb954854f | ||
|
|
f03c8a03ac | ||
|
|
7aa1108270 | ||
|
|
a081443c91 | ||
|
|
9a50db6b5d | ||
|
|
02a56bc6b5 | ||
|
|
1b706019cd | ||
|
|
67c6ffc877 | ||
|
|
6c1f4e123a | ||
|
|
e3ed105f49 | ||
|
|
0214934b1f | ||
|
|
dc4d1e1c65 | ||
|
|
a147d389da | ||
|
|
95ffa30c12 | ||
|
|
17c123003f | ||
|
|
817ae4d3fc | ||
|
|
0a31c4ee4b | ||
|
|
1babdb56ec | ||
|
|
4096def6b3 | ||
|
|
440123aed2 | ||
|
|
bdc8e7a959 | ||
|
|
242ca36a7a | ||
|
|
49c1929746 | ||
|
|
9d6ab9e159 | ||
|
|
eb7112b956 | ||
|
|
f144e77035 | ||
|
|
968bbb5f5a | ||
|
|
65dd754580 | ||
|
|
1f57b0d478 | ||
|
|
23d4dc5ec3 | ||
|
|
031ea4f199 | ||
|
|
29586f35d7 | ||
|
|
f83c27882f | ||
|
|
fbd6ef5f83 | ||
|
|
89b32304bd | ||
|
|
0f9f909d73 | ||
|
|
994ced47bc | ||
|
|
40f594f1ff | ||
|
|
8a94b6e426 | ||
|
|
f975e23cd8 | ||
|
|
dc93ea4395 | ||
|
|
c1adc111a1 | ||
|
|
5fffa51171 | ||
|
|
a61b100768 | ||
|
|
494149fad2 | ||
|
|
f9d53da7fe | ||
|
|
605c97347d | ||
|
|
96d081fdae | ||
|
|
49189587ce | ||
|
|
48f81dc547 | ||
|
|
7f4f3fd432 | ||
|
|
f5249f39e1 | ||
|
|
c3b3b60d93 | ||
|
|
25b4089a8f | ||
|
|
13e390535d | ||
|
|
d406b52d6a | ||
|
|
aaa267a6c4 | ||
|
|
98e4f771f0 | ||
|
|
7c8ab60c6d | ||
|
|
ad739a87e0 | ||
|
|
3bb18069ad | ||
|
|
a6c1360593 | ||
|
|
0e0f512571 | ||
|
|
0606099b2a | ||
|
|
6196238867 | ||
|
|
7caebe9eaf | ||
|
|
165d282beb | ||
|
|
4b1c234384 | ||
|
|
5cf08506ef | ||
|
|
e518957f16 | ||
|
|
f5e6a5998d | ||
|
|
ff91320ec8 | ||
|
|
b498a513dc | ||
|
|
42ed560750 | ||
|
|
5096d242fd | ||
|
|
b037af447f | ||
|
|
7bf66f3916 | ||
|
|
90ce37ec35 | ||
|
|
2cb6e39eb5 | ||
|
|
5ca5feb9e8 | ||
|
|
840f6b457b | ||
|
|
05142096f7 | ||
|
|
5f7177848b | ||
|
|
73a88fb7d1 | ||
|
|
c37586d596 | ||
|
|
3c29cac2d7 | ||
|
|
7d8fa1ff82 | ||
|
|
7357058694 | ||
|
|
6f30ef0f49 | ||
|
|
ed8242535d | ||
|
|
b14e2c5989 | ||
|
|
b930103058 | ||
|
|
c995d3a600 | ||
|
|
81435c790a | ||
|
|
aba46ff3d5 | ||
|
|
e5f4499fa3 | ||
|
|
caf866ded5 | ||
|
|
7c3b04462a | ||
|
|
567a50d075 | ||
|
|
c2968dc8d5 | ||
|
|
7f78d77235 | ||
|
|
1f4008667c | ||
|
|
584afec6d2 | ||
|
|
be452f68b9 | ||
|
|
2b8c190964 | ||
|
|
b5a08d080c | ||
|
|
4d51b48429 | ||
|
|
4a7541d7e7 | ||
|
|
705308938e | ||
|
|
6c936d46b4 | ||
|
|
e42ad1b3eb | ||
|
|
a01cba771c | ||
|
|
62b6a17c21 | ||
|
|
cca2effbd2 | ||
|
|
92ca7fcd4e | ||
|
|
619aa2e950 | ||
|
|
e11629f77f | ||
|
|
fb0d78ea7a | ||
|
|
e96418e346 | ||
|
|
15cfa7e2d1 | ||
|
|
620c7d02e8 | ||
|
|
496bb0d106 | ||
|
|
c8ac59e59a |
76
README.md
76
README.md
@@ -1,7 +1,13 @@
|
||||
# zyplayer-doc
|
||||
|
||||
#### 项目介绍
|
||||
定位为所有文档的管理项目,swagger文档、数据库文档....等,提供一整套的解决方案,欢迎有想法的一起来写
|
||||
定位为所有文档的管理项目,swagger文档、dubbo文档、数据库文档、wiki、ElasticSearch文档....等,提供一整套的解决方案,为开发者服务,欢迎有想法的一起来写,给个Star鼓励下呗!(您的一个Star是快速迭代的动力源泉!)
|
||||
欢迎加群讨论,QQ群号:466363173
|
||||
|
||||
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/zyplayer-doc-manage/) 需登录 账号:zyplayer 密码:123456 (未运行dubbo服务,不能体验dubbo文档调试)
|
||||
|
||||
各模块的详细使用文档地址,部署必看:
|
||||
[http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb](http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb)
|
||||
|
||||
#### 软件架构
|
||||
##### 一、zyplayer-doc-core 一些核心、公用的类
|
||||
@@ -10,28 +16,38 @@
|
||||
> 原[zyplayer-doc-db](https://gitee.com/zyplayer/zyplayer-doc-db),具有数据库文档的查看、管理、导出等功能
|
||||
|
||||
##### 三、zyplayer-doc-manage 可以单独部署的文档管理后台
|
||||
> 后端使用spring-boot、mybatis-plus、springfox-swagger等框架,前端使用[zui](http://zui.sexy/)、[Vue](https://cn.vuejs.org/)等框架
|
||||
> 后端使用spring-boot、mybatis-plus、springfox-swagger等框架,前端使用[zui](http://zui.sexy/)、[Vue](https://cn.vuejs.org/)、[element-ui](http://element-cn.eleme.io)等框架
|
||||
|
||||
> 已集成三套优秀swagger文档前端:[zyplayer-doc-swagger](https://gitee.com/zyplayer/zyplayer-doc)、[swagger-bootstrap-ui](https://gitee.com/xiaoym/swagger-bootstrap-ui)、[springfox-swagger-ui](https://github.com/springfox/springfox/tree/master/springfox-swagger-ui)
|
||||
|
||||
> 已集成[zyplayer-doc-db](https://gitee.com/zyplayer/zyplayer-doc)数据库文档
|
||||
> 已集成本项目内的各子模块,可直接使用
|
||||
|
||||
##### 四、zyplayer-doc-swagger 原[swagger-mg-ui](https://gitee.com/zyplayer/swagger-mg-ui),swagger的UI及整套解决方案
|
||||
> 具有 后端存储、代理请求、模拟返回、所有文档管理 等一系列原创功能,不止UI
|
||||
|
||||
##### 五、zyplayer-doc-dubbo 将dubbo的文档在线化管理
|
||||
> 支持zookeeper、nacos的注册中心文档获取,支持在线调试接口
|
||||
|
||||
##### 六、zyplayer-doc-wiki wiki文档工具
|
||||
> 支持文档创建、展示,文件上传、下载,空间隔离,开放文档访问等
|
||||
|
||||
##### 七、zyplayer-doc-grpc grpc文档工具
|
||||
> 用比较变态的方式实现了grpc的文档和在线调试功能,通过http的方式来请求grpc的接口
|
||||
|
||||
> 默认未开启此功能,如需使用需要在zyplayer-doc-manage项目中开启@EnableDocGrpc注解
|
||||
|
||||
##### 八、zyplayer-doc-es ElasticSearch文档工具
|
||||
> 支持ElasticSearch的文档查看和执行DSL查询的功能
|
||||
|
||||
#### 运行方式
|
||||
|
||||
1. 创建数据库:zyplayer_doc_manage,执行脚本:[zyplayer_doc_manage.sql](https://gitee.com/zyplayer/zyplayer-doc/blob/master/zyplayer-doc-manage/src/main/resources/sql/zyplayer_doc_manage.sql)
|
||||
1. 创建数据库:zyplayer_doc_manage,执行脚本:[zyplayer_doc_manage.1.0.4.sql](https://gitee.com/zyplayer/zyplayer-doc/blob/master/zyplayer-doc-manage/src/main/resources/sql/zyplayer_doc_manage.1.0.4.sql)
|
||||
|
||||
2. 修改zyplayer-doc-manage项目的application.yml配置文件里面的数据库账号密码
|
||||
|
||||
3. 启动zyplayer-doc-manage项目,访问地址:
|
||||
http://127.0.0.1:8082/zyplayer-doc-manage/statics/manage/home.html
|
||||
未登录会进入登录页面,登陆后自动跳回,默认账号:zyplayer 密码:123456
|
||||
> 项目页面全是静态的html,如果使用idea启动,有可能访问不了静态页面,需要在这里配置下工作目录,然后重新启动即可
|
||||

|
||||
3. 启动zyplayer-doc-manage项目,访问地址:http://127.0.0.1:8083/zyplayer-doc-manage/
|
||||
|
||||
#### 功能介绍
|
||||
#### 模块介绍
|
||||
|
||||
##### 一、zyplayer-doc-swagger
|
||||
1. 在 `zyplayer-doc-swagger`->`文档管理`->`文档地址管理` 页可以管理`任意地址`的文档,在集成的三套UI中都可以直接查看和调试这里配置的文档,不用对UI做任何调整,只要标准的UI集成进来也可以直接用
|
||||
@@ -55,33 +71,25 @@ http://127.0.0.1:8082/zyplayer-doc-manage/statics/manage/home.html
|
||||
|
||||
2. 支持多数据源,在`zyplayer-doc-manage` -> `application.yml` -> `zyplayer.doc.db.dbConfigList` 处配置多个数据库连接即可
|
||||
|
||||
##### 三、zyplayer-doc-manage
|
||||
##### 三、zyplayer-doc-dubbo
|
||||
1. `zyplayer-doc-manage` -> `application.yml` -> `zyplayer.dubbo.zookeeper.url` 配置zookeeper地址
|
||||
|
||||
2. `zyplayer-doc-manage` -> `application.yml` -> `zyplayer.dubbo.nacos.url` 配置nacos服务地址
|
||||
|
||||
3. 默认找zookeeper,未配置再找nacos的配置
|
||||
|
||||
4. 支持文档查找、文档编辑、在线调试接口
|
||||
|
||||
5. 自动获取参数列表需要指定的类存在,所以请在 pom.xml -> dependencies 最后加上服务所在的包,后端才能通过Class.forName("xx");来找到参数列表,减少录入成本
|
||||
|
||||
6. 数组或List参数,调试参数录入格式例:[1,2] ,后端通过JSON工具转成指定类型,有不支持的类型时欢迎反馈
|
||||
|
||||
##### 四、zyplayer-doc-manage
|
||||
1. 整合了上面两个功能到此项目,较少熟悉成本,`git clone`下来即可运行
|
||||
|
||||
2. 具有简单的`权限管理`、`人员管理`功能(还没想好具体怎么控制,没需求)
|
||||
2. 具有简单的`权限管理`、`人员管理`功能
|
||||
|
||||
3. 使用最新的一些技术框架,很简单,初学者拿来学习也是很不错的
|
||||
|
||||
#### 界面展示
|
||||
权限和用户管理:
|
||||

|
||||
数据库文档:
|
||||

|
||||
增加文档处:
|
||||

|
||||
使用springfox-swagger-ui访问增加的文档:
|
||||

|
||||
文档展示:
|
||||

|
||||
在线调试:
|
||||

|
||||
模拟返回:
|
||||

|
||||
文档配置:
|
||||

|
||||
全局参数管理:
|
||||

|
||||
|
||||
|
||||
|
||||
更多详细的使用部署文档:http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb
|
||||
|
||||
|
||||
37
pom.xml
37
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.4</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>zyplayer-doc</name>
|
||||
@@ -15,38 +15,19 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<elasticsearch.version>7.2.0</elasticsearch.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<modules>
|
||||
<module>zyplayer-doc-db</module>
|
||||
<module>zyplayer-doc-manage</module>
|
||||
<module>zyplayer-doc-swagger</module>
|
||||
<module>zyplayer-doc-core</module>
|
||||
<module>zyplayer-doc-dubbo</module>
|
||||
<module>zyplayer-doc-wiki</module>
|
||||
<module>zyplayer-doc-data</module>
|
||||
<module>zyplayer-doc-grpc</module>
|
||||
<module>zyplayer-doc-other</module>
|
||||
<module>zyplayer-doc-es</module>
|
||||
</modules>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
11
upgrade.properties
Normal file
11
upgrade.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
# 本文件用于已部署好的系统检测自己是否需要升级使用,怕有人担心安全一类的问题,所以不提供服务器接口来做
|
||||
lastVersion=1.0.4
|
||||
upgradeContent=1、swagger文档支持给文档地址重命名,下拉时方便查看;\
|
||||
2、swagger文档去掉“文档地址管理”页管理,统一改为“详细地址管理”;\
|
||||
3、数据库文档增加权限控制,分为:库表查看权,注释修改权,SQL执行权;\
|
||||
4、数据库文档增加SQL执行器,可直接执行SQL;\
|
||||
5、数据库文档表信息增加表的状态信息展示;\
|
||||
6、缓存及其他细节优化;
|
||||
upgradeUrl=https://gitee.com/zyplayer/zyplayer-doc/releases
|
||||
nextStep=1、ElasticSearch文档优化
|
||||
|
||||
9
zyplayer-doc-core/README.md
Normal file
9
zyplayer-doc-core/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# zyplayer-doc-core
|
||||
|
||||
#### 项目介绍
|
||||
整个项目的公用模块
|
||||
|
||||
模块的详细使用文档地址,部署必看:
|
||||
|
||||
http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.4</version>
|
||||
<name>zyplayer-doc-core</name>
|
||||
|
||||
<url>http://maven.apache.org</url>
|
||||
@@ -18,9 +14,33 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<pagehelper.version>4.1.6</pagehelper.version>
|
||||
<springfox.swagger.version>2.9.2</springfox.swagger.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox.swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>${pagehelper.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.zyplayer.doc.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AuthMan {
|
||||
String[] value() default {};
|
||||
String authUrl() default "common/authfailed";
|
||||
boolean all() default false;
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文档返回数据格式
|
||||
*
|
||||
@@ -27,13 +26,21 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
@ApiModelProperty(value = "返回值说明")
|
||||
private String errMsg;
|
||||
@ApiModelProperty(value = "返回数据")
|
||||
private T data;
|
||||
private Object data;
|
||||
@ApiModelProperty(value = "总数")
|
||||
private Long total;
|
||||
@ApiModelProperty(value = "当前页数")
|
||||
private Integer pageNum;
|
||||
@ApiModelProperty(value = "每页条数")
|
||||
private Integer pageSize;
|
||||
@ApiModelProperty(value = "总页数")
|
||||
private Integer totalPage;
|
||||
|
||||
public DocResponseJson() {
|
||||
this.errCode = 200;
|
||||
}
|
||||
|
||||
public DocResponseJson(T data) {
|
||||
public DocResponseJson(Object data) {
|
||||
this.setData(data);
|
||||
this.errCode = 200;
|
||||
}
|
||||
@@ -44,7 +51,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public DocResponseJson(int errCode, String errMsg, T data) {
|
||||
public DocResponseJson(int errCode, String errMsg, Object data) {
|
||||
super();
|
||||
this.setData(data);
|
||||
this.errCode = errCode;
|
||||
@@ -71,13 +78,56 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Integer getTotalPage() {
|
||||
return totalPage;
|
||||
}
|
||||
|
||||
public void setTotalPage(Integer totalPage) {
|
||||
this.totalPage = totalPage;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
|
||||
public void setData(Object data) {
|
||||
if (null != data) {
|
||||
if (data instanceof PageInfo) {
|
||||
PageInfo<?> pageInfo = (PageInfo<?>) data;
|
||||
this.data = pageInfo.getList();
|
||||
this.total = pageInfo.getTotal();
|
||||
this.pageNum = pageInfo.getPageNum();
|
||||
this.pageSize = pageInfo.getPageSize();
|
||||
this.totalPage = pageInfo.getPages();
|
||||
} else {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,16 +151,16 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
public static <T> DocResponseJson<T> error(String errMsg) {
|
||||
return new DocResponseJson<T>(500, errMsg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功的返回方法
|
||||
*
|
||||
* 失败
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> ok() {
|
||||
return new DocResponseJson<T>();
|
||||
public static <T> DocResponseJson<T> failure(int errCode, String errMsg) {
|
||||
return new DocResponseJson<T>(errCode, errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,11 +170,22 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> ok(T data) {
|
||||
public static <T> DocResponseJson<T> ok() {
|
||||
return new DocResponseJson<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功的返回方法
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> ok(Object data) {
|
||||
if (data == null) {
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
DocResponseJson<T> responseJson = new DocResponseJson<T>();
|
||||
DocResponseJson<T> responseJson = new DocResponseJson<>();
|
||||
responseJson.setData(data);
|
||||
return responseJson;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
public class HttpConst {
|
||||
|
||||
/** 每页显示条数 **/
|
||||
public static final int PAGE_NUMBER = 50;
|
||||
/** 默认当前页 **/
|
||||
public static final int CURRENT_PAGE = 1;
|
||||
|
||||
/** 图片验证码 **/
|
||||
public static final String SESSION_VERIFY_CODE = "SESSION_VERIFY_CODE";
|
||||
/** 邮箱验证码 **/
|
||||
public static final String SESSION_EMAIL_CODE = "SESSION_EMAIL_CODE";
|
||||
/** 请求失败的原因 **/
|
||||
public static final String SESSION_FAIL_REASON = "SESSION_FAIL_REASON";
|
||||
/** operator */
|
||||
public static final String OPERATOR = "OPERATOR";
|
||||
|
||||
/** 分页-总条数 */
|
||||
public static final String PAGE_TOTAL = "PAGE_TOTAL";
|
||||
/** 分页-当前页数 */
|
||||
public static final String PAGE_NOWPAGE = "PAGE_NOWPAGE";
|
||||
/** 分页-总页数 */
|
||||
public static final String PAGE_PAGECOUNT = "PAGE_PAGECOUNT";
|
||||
/** 分页-每页多少条 */
|
||||
public static final String PAGE_SIZE = "PAGE_SIZE";
|
||||
|
||||
/** 会话连接 */
|
||||
public static final String ACCESS_TOKEN = "accessToken";
|
||||
/** 存在于ThreadLocal的http request */
|
||||
public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST";
|
||||
/** 存在于ThreadLocal的HTTP_SESSION */
|
||||
public static final String HTTP_SESSION = "HTTP_SESSION";
|
||||
|
||||
/** 存于operator中权限的缓存头 **/
|
||||
public static final String AUTH_CACHE_HEAD = "AUTH_CACHE_HEAD_";
|
||||
/** 存于operator中的用户信息 **/
|
||||
public static final String CACHE_OPERATOR_USER_INFO = "USER_INFO";
|
||||
/** 存于operator中的城市信息 **/
|
||||
public static final String CACHE_OPERATOR_CITY_ID = "CITY_ID";
|
||||
/** 存于operator中的token绑定的访问信息,使得换一台电脑不能使用此token **/
|
||||
public static final String CACHE_OPERATOR_ACCESS_TOKEN_VALIDATE = "ACCESS_TOKEN_VALIDATE";
|
||||
/** 存于operator中的token信息 **/
|
||||
public static final String CACHE_OPERATOR_ACCESS_TOKEN = "accessToken";
|
||||
/** 存于operator中的微信sessionKey信息 **/
|
||||
public static final String CACHE_OPERATOR_SESSION_KEY = "sessionKey";
|
||||
|
||||
// 新版本使用的错误码
|
||||
/** 成功 **/
|
||||
public static final int SUCCESS = 200;
|
||||
/** 提示性状态 需要客户端配合展示 **/
|
||||
public static final int CONFIRM_CODE = 300;
|
||||
/** accessToken非法或过期,需要重新登录 **/
|
||||
public static final int TOKEN_TIMEOUT = 400;
|
||||
/** 业务接口缺少参数,errMsg会返回错误信息 **/
|
||||
public static final int MISSING_PARAMETER = 401;
|
||||
/** API 未授权 **/
|
||||
public static final int UNAUTHORIZED = 402;
|
||||
/** 接口调用频率超限 **/
|
||||
public static final int CALL_FREQUENCY_GAUGE = 403;
|
||||
/** 微信未扫码登录异常 **/
|
||||
public static final int WX_NOT_LOGIN = 404;
|
||||
/** 请升级至新版使用此功能 **/
|
||||
public static final int NEED_UPGRADE = 405;
|
||||
/** 服务器端未知错误 **/
|
||||
public static final int OTHER_FAIL = 500;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* 字符串操作类
|
||||
*/
|
||||
public final class StringUtil {
|
||||
|
||||
/**
|
||||
* 获取错误信息
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
*/
|
||||
public static String getException(Throwable e) {
|
||||
StringWriter sw = null;
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
sw = new StringWriter();
|
||||
pw = new PrintWriter(sw);
|
||||
e.printStackTrace(pw);
|
||||
pw.flush();
|
||||
sw.flush();
|
||||
return sw.toString();
|
||||
} finally {
|
||||
if (sw != null) {
|
||||
try {
|
||||
sw.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (pw != null) {
|
||||
try {
|
||||
pw.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class ThreadLocalUtil {
|
||||
private static ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
|
||||
|
||||
public static void setHttpServletRequest(HttpServletRequest request) {
|
||||
ThreadLocalUtil.request.set(request);
|
||||
}
|
||||
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ThreadLocalUtil.request.get();
|
||||
}
|
||||
|
||||
public static void clean() {
|
||||
ThreadLocalUtil.request.remove();
|
||||
}
|
||||
|
||||
}
|
||||
9
zyplayer-doc-data/README.md
Normal file
9
zyplayer-doc-data/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# zyplayer-doc-data
|
||||
|
||||
#### 项目介绍
|
||||
整个项目的数据核心,操作数据库、登录拦截、权限拦截等
|
||||
|
||||
模块的详细使用文档地址,部署必看:
|
||||
|
||||
http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb
|
||||
|
||||
115
zyplayer-doc-data/pom.xml
Normal file
115
zyplayer-doc-data/pom.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
<version>1.0.4</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.6.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<mybatis.plus.boot.starter.version>3.0.6</mybatis.plus.boot.starter.version>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<velocity.engine.core.version>2.0</velocity.engine.core.version>
|
||||
<dozer.core.version>6.1.0</dozer.core.version>
|
||||
<alibaba.druid.version>1.1.9</alibaba.druid.version>
|
||||
<zyplayer.doc.version>1.0.4</zyplayer.doc.version>
|
||||
<elasticsearch.version>7.2.0</elasticsearch.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jta-atomikos</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.47</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis.plus.boot.starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${alibaba.druid.version}</version>
|
||||
</dependency>
|
||||
<!-- json -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.dozermapper</groupId>
|
||||
<artifactId>dozer-core</artifactId>
|
||||
<version>${dozer.core.version}</version>
|
||||
</dependency>
|
||||
<!-- 在线文档解析页面 -->
|
||||
<!--zyplayer-doc-core-->
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<!-- velocity 模板引擎, 默认 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>${velocity.engine.core.version}</version>
|
||||
</dependency>
|
||||
<!-- freemarker 模板引擎 -->
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
<!-- 整合spring security -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
</dependency>
|
||||
<!--elasticsearch-->
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zyplayer.doc.data.aspect;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.core.util.ThreadLocalUtil;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.utils.BeanUtil;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class AuthAspect {
|
||||
|
||||
@Around(value = "@annotation(com.zyplayer.doc.core.annotation.AuthMan) || @within(com.zyplayer.doc.core.annotation.AuthMan)")
|
||||
public Object authController(ProceedingJoinPoint pjp) throws Throwable {
|
||||
AuthMan authMan = BeanUtil.getAnnotation(pjp, AuthMan.class);
|
||||
ResponseBody responseBody = BeanUtil.getAnnotation(pjp, ResponseBody.class);
|
||||
RestController restController = BeanUtil.getAnnotation(pjp, RestController.class);
|
||||
boolean isResponseBody = (restController != null || responseBody != null);
|
||||
|
||||
Class<?> returnType = ((MethodSignature) pjp.getSignature()).getMethod().getReturnType();
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
String reason = "你访问的内容需要登录,请登录后再试";
|
||||
if (isResponseBody) {
|
||||
return DocResponseJson.failure(HttpConst.TOKEN_TIMEOUT, reason);
|
||||
} else if (returnType.isAssignableFrom(ModelAndView.class)) {
|
||||
HttpServletRequest request = ThreadLocalUtil.getHttpServletRequest();
|
||||
StringBuffer requestURL = request.getRequestURL();
|
||||
String requestURLStr = URLEncoder.encode(requestURL.toString(), "utf-8");
|
||||
return new ModelAndView("redirect:#/user/login?redirect=" + requestURLStr);
|
||||
} else if (returnType.isAssignableFrom(Map.class)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
}
|
||||
// 判断权限是否足够
|
||||
boolean haveAuth = DocUserUtil.haveAuth(authMan.value());
|
||||
if (haveAuth) {
|
||||
return pjp.proceed();
|
||||
}
|
||||
String reasonStr = "没有操作权限,请联系管理员";
|
||||
if (isResponseBody) {
|
||||
Method method = ((MethodSignature) pjp.getSignature()).getMethod();
|
||||
if (method.getReturnType().equals(ResponseJson.class)) {
|
||||
return DocResponseJson.warn(reasonStr);
|
||||
} else {
|
||||
try {
|
||||
return Class.forName(method.getReturnType().getName()).newInstance();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return authMan.authUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.zyplayer.doc.data.config;
|
||||
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 登录和跨域拦截器
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年05月25日
|
||||
*/
|
||||
@Component
|
||||
public class DocLoginOriginInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Value("${zyplayer.doc.manage.originDomainRegex:''}")
|
||||
private String originDomainRegex;
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception arg3) {
|
||||
// 清理用户信息
|
||||
DocUserUtil.clean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object haddler, ModelAndView modelAndView) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录请求信息
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) {
|
||||
// 指定域名可跨域访问
|
||||
if (StringUtils.isNotBlank(originDomainRegex)) {
|
||||
String origin = request.getHeader("Origin");
|
||||
if (StringUtils.isNotBlank(origin) && origin.toLowerCase().matches(originDomainRegex)) {
|
||||
response.setHeader("Access-Control-Allow-Origin", origin); // 允许访问的域
|
||||
response.setHeader("Access-Control-Allow-Methods", "HEAD,GET,POST,PUT,DELETE");// 允许GET、POST的外域请求
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true"); // 允许请求带cookie到服务器
|
||||
response.setContentType("application/json; charset=utf-8"); // 设定JSON格式标准输出、及编码
|
||||
}
|
||||
}
|
||||
// 清理用户信息
|
||||
DocUserUtil.clean();
|
||||
// 设置token
|
||||
String accessToken = getCookieValueByRequest(request, HttpConst.ACCESS_TOKEN);
|
||||
DocUserUtil.setAccessToken(accessToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cookie
|
||||
*
|
||||
* @param request
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Cookie getCookieByRequest(HttpServletRequest request, String name) {
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return null;
|
||||
}
|
||||
Cookie[] cookies = request.getCookies();
|
||||
for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
|
||||
Cookie cookie = cookies[i];
|
||||
if (name.equals(cookie.getName())) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cookie值
|
||||
*
|
||||
* @param request
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getCookieValueByRequest(HttpServletRequest request, String name) {
|
||||
Cookie cookie = getCookieByRequest(request, name);
|
||||
return cookie == null ? null : cookie.getValue();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.zyplayer.doc.manage.framework.config;
|
||||
package com.zyplayer.doc.data.config;
|
||||
|
||||
import com.atomikos.icatch.jta.UserTransactionImp;
|
||||
import com.atomikos.icatch.jta.UserTransactionManager;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.zyplayer.doc.manage.repository.support.interceptor.SqlLogInterceptor;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -27,60 +28,72 @@ import java.util.Properties;
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
|
||||
/**
|
||||
* sql日志
|
||||
**/
|
||||
private static final SqlLogInterceptor SQL_LOG_INTERCEPTOR;
|
||||
|
||||
/**
|
||||
* MYSQL 分页
|
||||
**/
|
||||
private static final PageHelper MYSQL_PAGE_HELPER;
|
||||
|
||||
static {
|
||||
SQL_LOG_INTERCEPTOR = new SqlLogInterceptor();
|
||||
Properties properties = new Properties();
|
||||
SQL_LOG_INTERCEPTOR.setProperties(properties);
|
||||
{
|
||||
MYSQL_PAGE_HELPER = new PageHelper();
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("dialect", "mysql");
|
||||
MYSQL_PAGE_HELPER.setProperties(properties);
|
||||
}
|
||||
{
|
||||
SQL_LOG_INTERCEPTOR = new SqlLogInterceptor();
|
||||
Properties properties = new Properties();
|
||||
SQL_LOG_INTERCEPTOR.setProperties(properties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分布式事务配置
|
||||
*/
|
||||
@Configuration
|
||||
static class JTATransactionManagerConfig {
|
||||
|
||||
|
||||
@Bean(name = "userTransaction")
|
||||
public UserTransaction userTransaction() throws Throwable {
|
||||
UserTransactionImp userTransactionImp = new UserTransactionImp();
|
||||
userTransactionImp.setTransactionTimeout(300);
|
||||
return userTransactionImp;
|
||||
}
|
||||
|
||||
|
||||
@Bean(name = "atomikosTransactionManager")
|
||||
public TransactionManager atomikosTransactionManager() {
|
||||
UserTransactionManager userTransactionManager = new UserTransactionManager();
|
||||
userTransactionManager.setForceShutdown(true);
|
||||
return userTransactionManager;
|
||||
}
|
||||
|
||||
|
||||
@Bean(name = "transactionManager")
|
||||
public PlatformTransactionManager transactionManager() throws Throwable {
|
||||
UserTransaction userTransaction = userTransaction();
|
||||
TransactionManager atomikosTransactionManager = atomikosTransactionManager();
|
||||
|
||||
|
||||
JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(userTransaction, atomikosTransactionManager);
|
||||
jtaTransactionManager.setAllowCustomIsolationLevels(true);
|
||||
jtaTransactionManager.setGlobalRollbackOnParticipationFailure(true);
|
||||
jtaTransactionManager.setDefaultTimeout(30);
|
||||
|
||||
|
||||
return jtaTransactionManager;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据库配置
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(value = "com.zyplayer.doc.manage.repository.manage.mapper", sqlSessionFactoryRef = "manageSqlSessionFactory")
|
||||
@MapperScan(value = "com.zyplayer.doc.data.repository.manage.mapper", sqlSessionFactoryRef = "manageSqlSessionFactory")
|
||||
static class ManageMybatisDbConfig {
|
||||
|
||||
|
||||
@Value("${zyplayer.doc.manage.datasource.driverClassName}")
|
||||
private String driverClassName;
|
||||
@Value("${zyplayer.doc.manage.datasource.url}")
|
||||
@@ -89,7 +102,7 @@ public class MybatisPlusConfig {
|
||||
private String username;
|
||||
@Value("${zyplayer.doc.manage.datasource.password}")
|
||||
private String password;
|
||||
|
||||
|
||||
@Bean(name = "manageDatasource")
|
||||
public DataSource manageDatasource() {
|
||||
Properties xaProperties = new Properties();
|
||||
@@ -101,7 +114,7 @@ public class MybatisPlusConfig {
|
||||
xaProperties.setProperty("testOnBorrow", "true");
|
||||
xaProperties.setProperty("testWhileIdle", "true");
|
||||
xaProperties.setProperty("validationQuery", "select 'x'");
|
||||
|
||||
|
||||
AtomikosDataSourceBean xaDataSource = new AtomikosDataSourceBean();
|
||||
xaDataSource.setXaProperties(xaProperties);
|
||||
xaDataSource.setXaDataSourceClassName("com.alibaba.druid.pool.xa.DruidXADataSource");
|
||||
@@ -111,19 +124,19 @@ public class MybatisPlusConfig {
|
||||
xaDataSource.setMaxLifetime(60);
|
||||
return xaDataSource;
|
||||
}
|
||||
|
||||
|
||||
@Bean(name = "manageSqlSessionFactory")
|
||||
public MybatisSqlSessionFactoryBean manageSqlSessionFactory() throws Exception {
|
||||
MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
|
||||
sqlSessionFactoryBean.setDataSource(manageDatasource());
|
||||
sqlSessionFactoryBean.setPlugins(new Interceptor[]{SQL_LOG_INTERCEPTOR});
|
||||
|
||||
sqlSessionFactoryBean.setPlugins(new Interceptor[]{SQL_LOG_INTERCEPTOR, MYSQL_PAGE_HELPER});
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/manage/*Mapper.xml"));
|
||||
return sqlSessionFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public PerformanceInterceptor performanceInterceptor() {
|
||||
PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
|
||||
@@ -133,9 +146,9 @@ public class MybatisPlusConfig {
|
||||
performanceInterceptor.setFormat(true);
|
||||
return performanceInterceptor;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class DocUserDetails {
|
||||
private Long userId;
|
||||
private String username;
|
||||
private String password;
|
||||
private boolean enabled;
|
||||
private Set<String> authorities;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Set<String> getAuthorities() {
|
||||
return authorities;
|
||||
}
|
||||
|
||||
public void setAuthorities(Set<String> authorities) {
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
public DocUserDetails(Long userId, String username) {
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public DocUserDetails(Long userId, String username, String password, boolean enabled) {
|
||||
super();
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public DocUserDetails(Long userId, String username, String password, boolean enabled, Set<String> authorities) {
|
||||
super();
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.enabled = enabled;
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DocUserDetails{" +
|
||||
"userId=" + userId +
|
||||
", username='" + username + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", enabled=" + enabled +
|
||||
", authorities=" + authorities +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import com.zyplayer.doc.data.utils.CacheUtil;
|
||||
|
||||
/**
|
||||
* 用户工具类
|
||||
* @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<>();
|
||||
|
||||
public static void setAccessToken(String accessToken) {
|
||||
DocUserUtil.ACCESS_TOKEN.set(accessToken);
|
||||
}
|
||||
|
||||
public static boolean haveCustomAuth(String authName, String suffix) {
|
||||
return haveAuth(authName + suffix);
|
||||
}
|
||||
|
||||
public static boolean haveAuth(String... authNames) {
|
||||
DocUserDetails currentUser = getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
return false;
|
||||
}
|
||||
for (String authName : authNames) {
|
||||
if (!currentUser.getAuthorities().contains(authName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
public static DocUserDetails getCurrentUser() {
|
||||
DocUserDetails docUser = DOC_USER_DETAILS.get();
|
||||
if (docUser == null) {
|
||||
docUser = CacheUtil.get(ACCESS_TOKEN.get());
|
||||
if (docUser != null) {
|
||||
DOC_USER_DETAILS.set(docUser);
|
||||
}
|
||||
}
|
||||
return docUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前用户
|
||||
*/
|
||||
public static void setCurrentUser(String accessToken, DocUserDetails docUser) {
|
||||
DOC_USER_DETAILS.set(docUser);
|
||||
CacheUtil.put(accessToken, docUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
public static void logout() {
|
||||
CacheUtil.remove(ACCESS_TOKEN.get());
|
||||
}
|
||||
|
||||
public static void clean() {
|
||||
DocUserUtil.DOC_USER_DETAILS.remove();
|
||||
DocUserUtil.ACCESS_TOKEN.remove();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-04
|
||||
*/
|
||||
public class DbDatasource implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源驱动类
|
||||
*/
|
||||
private String driverClassName;
|
||||
|
||||
/**
|
||||
* 数据源地址
|
||||
*/
|
||||
private String sourceUrl;
|
||||
|
||||
/**
|
||||
* 数据源用户名
|
||||
*/
|
||||
private String sourceName;
|
||||
|
||||
/**
|
||||
* 数据源密码
|
||||
*/
|
||||
private String sourcePassword;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
/**
|
||||
* 数据源名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getDriverClassName() {
|
||||
return driverClassName;
|
||||
}
|
||||
|
||||
public void setDriverClassName(String driverClassName) {
|
||||
this.driverClassName = driverClassName;
|
||||
}
|
||||
public String getSourceUrl() {
|
||||
return sourceUrl;
|
||||
}
|
||||
|
||||
public void setSourceUrl(String sourceUrl) {
|
||||
this.sourceUrl = sourceUrl;
|
||||
}
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
public String getSourcePassword() {
|
||||
return sourcePassword;
|
||||
}
|
||||
|
||||
public void setSourcePassword(String sourcePassword) {
|
||||
this.sourcePassword = sourcePassword;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DbDatasource{" +
|
||||
"id=" + id +
|
||||
", driverClassName=" + driverClassName +
|
||||
", sourceUrl=" + sourceUrl +
|
||||
", sourceName=" + sourceName +
|
||||
", sourcePassword=" + sourcePassword +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public class DbFavorite implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private Long datasourceId;
|
||||
|
||||
/**
|
||||
* 收藏标题
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 收藏内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DbFavorite{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", content=" + content +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Long getDatasourceId() {
|
||||
return datasourceId;
|
||||
}
|
||||
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public class DbHistory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private Long datasourceId;
|
||||
|
||||
/**
|
||||
* sql内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DbHistory{" +
|
||||
"id=" + id +
|
||||
", content=" + content +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Long getDatasourceId() {
|
||||
return datasourceId;
|
||||
}
|
||||
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-27
|
||||
*/
|
||||
public class EsDatasource implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 地址和端口
|
||||
*/
|
||||
private String hostPort;
|
||||
|
||||
/**
|
||||
* scheme,http或其他
|
||||
*/
|
||||
private String scheme;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getHostPort() {
|
||||
return hostPort;
|
||||
}
|
||||
|
||||
public void setHostPort(String hostPort) {
|
||||
this.hostPort = hostPort;
|
||||
}
|
||||
public String getScheme() {
|
||||
return scheme;
|
||||
}
|
||||
|
||||
public void setScheme(String scheme) {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EsDatasource{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", hostPort=" + hostPort +
|
||||
", scheme=" + scheme +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
@@ -7,11 +7,11 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* 用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-05
|
||||
* @since 2019-05-31
|
||||
*/
|
||||
public class UserAuth implements Serializable {
|
||||
|
||||
@@ -58,6 +58,11 @@ public class UserAuth implements Serializable {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 自定义权限结尾
|
||||
*/
|
||||
private String authCustomSuffix;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -114,6 +119,13 @@ public class UserAuth implements Serializable {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public String getAuthCustomSuffix() {
|
||||
return authCustomSuffix;
|
||||
}
|
||||
|
||||
public void setAuthCustomSuffix(String authCustomSuffix) {
|
||||
this.authCustomSuffix = authCustomSuffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -126,6 +138,7 @@ public class UserAuth implements Serializable {
|
||||
", delFlag=" + delFlag +
|
||||
", creationTime=" + creationTime +
|
||||
", updateTime=" + updateTime +
|
||||
", authCustomSuffix=" + authCustomSuffix +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
@@ -68,6 +69,16 @@ public class UserInfo implements Serializable {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 性别 0=女 1=男
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -154,4 +165,20 @@ public class UserInfo implements Serializable {
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-06-06
|
||||
*/
|
||||
public class WikiPage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 空间ID
|
||||
*/
|
||||
private Long spaceId;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点类型 0=有子节点 1=终节点
|
||||
*/
|
||||
private Integer nodeType;
|
||||
|
||||
/**
|
||||
* 赞的数量
|
||||
*/
|
||||
private Integer zanNum;
|
||||
|
||||
/**
|
||||
* 编辑类型 0=可编辑 1=不允许编辑
|
||||
*/
|
||||
private Integer editType;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改人ID
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 修改人名字
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 0=有效 1=删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 阅读数
|
||||
*/
|
||||
private Integer viewNum;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer seqNo;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getSpaceId() {
|
||||
return spaceId;
|
||||
}
|
||||
|
||||
public void setSpaceId(Long spaceId) {
|
||||
this.spaceId = spaceId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
public Integer getNodeType() {
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
public void setNodeType(Integer nodeType) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
public Integer getZanNum() {
|
||||
return zanNum;
|
||||
}
|
||||
|
||||
public void setZanNum(Integer zanNum) {
|
||||
this.zanNum = zanNum;
|
||||
}
|
||||
public Integer getEditType() {
|
||||
return editType;
|
||||
}
|
||||
|
||||
public void setEditType(Integer editType) {
|
||||
this.editType = editType;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Long getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(Long updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
public String getUpdateUserName() {
|
||||
return updateUserName;
|
||||
}
|
||||
|
||||
public void setUpdateUserName(String updateUserName) {
|
||||
this.updateUserName = updateUserName;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public Integer getViewNum() {
|
||||
return viewNum;
|
||||
}
|
||||
|
||||
public void setViewNum(Integer viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
}
|
||||
public Integer getSeqNo() {
|
||||
return seqNo;
|
||||
}
|
||||
|
||||
public void setSeqNo(Integer seqNo) {
|
||||
this.seqNo = seqNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPage{" +
|
||||
"id=" + id +
|
||||
", spaceId=" + spaceId +
|
||||
", name=" + name +
|
||||
", parentId=" + parentId +
|
||||
", nodeType=" + nodeType +
|
||||
", zanNum=" + zanNum +
|
||||
", editType=" + editType +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", updateUserId=" + updateUserId +
|
||||
", updateUserName=" + updateUserName +
|
||||
", updateTime=" + updateTime +
|
||||
", delFlag=" + delFlag +
|
||||
", viewNum=" + viewNum +
|
||||
", seqNo=" + seqNo +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public class WikiPageComment implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面ID
|
||||
*/
|
||||
private Long pageId;
|
||||
|
||||
/**
|
||||
* 父评论ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 0=有效 1=删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPageComment{" +
|
||||
"id=" + id +
|
||||
", pageId=" + pageId +
|
||||
", parentId=" + parentId +
|
||||
", content=" + content +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public class WikiPageContent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面ID
|
||||
*/
|
||||
private Long pageId;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改人ID
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 修改人名字
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 预览内容
|
||||
*/
|
||||
private String preview;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Long getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(Long updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
public String getUpdateUserName() {
|
||||
return updateUserName;
|
||||
}
|
||||
|
||||
public void setUpdateUserName(String updateUserName) {
|
||||
this.updateUserName = updateUserName;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPageContent{" +
|
||||
"id=" + id +
|
||||
", pageId=" + pageId +
|
||||
", content=" + content +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", updateUserId=" + updateUserId +
|
||||
", updateUserName=" + updateUserName +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getPreview() {
|
||||
return preview;
|
||||
}
|
||||
|
||||
public void setPreview(String preview) {
|
||||
this.preview = preview;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-06
|
||||
*/
|
||||
public class WikiPageFile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面ID
|
||||
*/
|
||||
private Long pageId;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件URL
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 文件UUID
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改人ID
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 修改人名字
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 0=有效 1=删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 下载次数
|
||||
*/
|
||||
private Integer downloadNum;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
public String getFileUrl() {
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Long getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(Long updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
public String getUpdateUserName() {
|
||||
return updateUserName;
|
||||
}
|
||||
|
||||
public void setUpdateUserName(String updateUserName) {
|
||||
this.updateUserName = updateUserName;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPageFile{" +
|
||||
"id=" + id +
|
||||
", pageId=" + pageId +
|
||||
", fileName=" + fileName +
|
||||
", fileUrl=" + fileUrl +
|
||||
", uuid=" + uuid +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", updateUserId=" + updateUserId +
|
||||
", updateUserName=" + updateUserName +
|
||||
", updateTime=" + updateTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Integer getDownloadNum() {
|
||||
return downloadNum;
|
||||
}
|
||||
|
||||
public void setDownloadNum(Integer downloadNum) {
|
||||
this.downloadNum = downloadNum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-05
|
||||
*/
|
||||
public class WikiPageZan implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面ID
|
||||
*/
|
||||
private Long pageId;
|
||||
|
||||
/**
|
||||
* 评论ID
|
||||
*/
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
public Long getCommentId() {
|
||||
return commentId;
|
||||
}
|
||||
|
||||
public void setCommentId(Long commentId) {
|
||||
this.commentId = commentId;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPageZan{" +
|
||||
"id=" + id +
|
||||
", pageId=" + pageId +
|
||||
", commentId=" + commentId +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-11
|
||||
*/
|
||||
public class WikiSpace implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 空间名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 空间类型 1=公司 2=个人 3=私人
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String spaceExplain;
|
||||
|
||||
/**
|
||||
* 编辑类型 0=可编辑 1=不允许编辑
|
||||
*/
|
||||
private Integer editType;
|
||||
|
||||
/**
|
||||
* 目录延迟加载 0=否 1=是
|
||||
*/
|
||||
private Integer treeLazyLoad;
|
||||
|
||||
/**
|
||||
* 是否是开放文档 0=否 1=是
|
||||
*/
|
||||
private Integer openDoc;
|
||||
|
||||
/**
|
||||
* 唯一UUID
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
public String getSpaceExplain() {
|
||||
return spaceExplain;
|
||||
}
|
||||
|
||||
public void setSpaceExplain(String spaceExplain) {
|
||||
this.spaceExplain = spaceExplain;
|
||||
}
|
||||
public Integer getEditType() {
|
||||
return editType;
|
||||
}
|
||||
|
||||
public void setEditType(Integer editType) {
|
||||
this.editType = editType;
|
||||
}
|
||||
public Integer getTreeLazyLoad() {
|
||||
return treeLazyLoad;
|
||||
}
|
||||
|
||||
public void setTreeLazyLoad(Integer treeLazyLoad) {
|
||||
this.treeLazyLoad = treeLazyLoad;
|
||||
}
|
||||
public Integer getOpenDoc() {
|
||||
return openDoc;
|
||||
}
|
||||
|
||||
public void setOpenDoc(Integer openDoc) {
|
||||
this.openDoc = openDoc;
|
||||
}
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiSpace{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", type=" + type +
|
||||
", spaceExplain=" + spaceExplain +
|
||||
", editType=" + editType +
|
||||
", treeLazyLoad=" + treeLazyLoad +
|
||||
", openDoc=" + openDoc +
|
||||
", uuid=" + uuid +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.entity;
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbDatasource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-04
|
||||
*/
|
||||
public interface DbDatasourceMapper extends BaseMapper<DbDatasource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbFavorite;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public interface DbFavoriteMapper extends BaseMapper<DbFavorite> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbHistory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public interface DbHistoryMapper extends BaseMapper<DbHistory> {
|
||||
|
||||
@Update("delete a from db_history a,(select id from db_history order by id desc limit 100, 1) b where a.id < b.id")
|
||||
void deleteHistory();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.EsDatasource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-27
|
||||
*/
|
||||
public interface EsDatasourceMapper extends BaseMapper<EsDatasource> {
|
||||
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* 用户权限表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
* @since 2019-05-31
|
||||
*/
|
||||
public interface UserAuthMapper extends BaseMapper<UserAuth> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public interface WikiPageCommentMapper extends BaseMapper<WikiPageComment> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.param.SearchByEsParam;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.SpaceNewsVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public interface WikiPageContentMapper extends BaseMapper<WikiPageContent> {
|
||||
|
||||
List<SpaceNewsVo> getNewsList(SearchByEsParam param);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-06
|
||||
*/
|
||||
public interface WikiPageFileMapper extends BaseMapper<WikiPageFile> {
|
||||
|
||||
@Update("update wiki_page_file set download_num=download_num+1 where id=#{id}")
|
||||
void addDownloadNum(@Param("id") Long id);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-09
|
||||
*/
|
||||
public interface WikiPageMapper extends BaseMapper<WikiPage> {
|
||||
|
||||
@Update("update wiki_page set zan_num=zan_num + #{numAdd} where id=#{id}")
|
||||
void updateZanNum(@Param("id") Long id, @Param("numAdd") Integer numAdd);
|
||||
|
||||
@Update("update wiki_page set seq_no=seq_no + 1 where parent_id=#{parentId} and seq_no >= #{afterSeq} and del_flag=0")
|
||||
void updateAfterSeq(@Param("parentId") Long parentId, @Param("afterSeq") Integer afterSeq);
|
||||
|
||||
@Select("select max(seq_no) from wiki_page where parent_id=#{parentId} and del_flag=0")
|
||||
Integer getLastSeq(@Param("parentId") Long parentId);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageZan;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-05
|
||||
*/
|
||||
public interface WikiPageZanMapper extends BaseMapper<WikiPageZan> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-13
|
||||
*/
|
||||
public interface WikiSpaceMapper extends BaseMapper<WikiSpace> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.repository.manage.mapper;
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zyplayer.doc.data.repository.manage.param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SearchByEsParam {
|
||||
private Long spaceId;
|
||||
private String keywords;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
private Integer newsType;
|
||||
private List<Long> spaceIds;
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public Integer getStartIndex() {
|
||||
return (pageNum - 1) * pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Long getSpaceId() {
|
||||
return spaceId;
|
||||
}
|
||||
|
||||
public void setSpaceId(Long spaceId) {
|
||||
this.spaceId = spaceId;
|
||||
}
|
||||
|
||||
public String getKeywords() {
|
||||
return keywords;
|
||||
}
|
||||
|
||||
public void setKeywords(String keywords) {
|
||||
this.keywords = keywords;
|
||||
}
|
||||
|
||||
public Integer getNewsType() {
|
||||
return newsType;
|
||||
}
|
||||
|
||||
public void setNewsType(Integer newsType) {
|
||||
this.newsType = newsType;
|
||||
}
|
||||
|
||||
public List<Long> getSpaceIds() {
|
||||
return spaceIds;
|
||||
}
|
||||
|
||||
public void setSpaceIds(List<Long> spaceIds) {
|
||||
this.spaceIds = spaceIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.zyplayer.doc.data.repository.manage.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class SpaceNewsVo {
|
||||
private Long spaceId;
|
||||
private Long pageId;
|
||||
private Integer zanNum;
|
||||
private Integer viewNum;
|
||||
private String createUserName;
|
||||
private String updateUserName;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
private String spaceName;
|
||||
private String pageTitle;
|
||||
private String previewContent;
|
||||
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
|
||||
public Integer getZanNum() {
|
||||
return zanNum;
|
||||
}
|
||||
|
||||
public void setZanNum(Integer zanNum) {
|
||||
this.zanNum = zanNum;
|
||||
}
|
||||
|
||||
public Integer getViewNum() {
|
||||
return viewNum;
|
||||
}
|
||||
|
||||
public void setViewNum(Integer viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
}
|
||||
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
|
||||
public String getUpdateUserName() {
|
||||
return updateUserName;
|
||||
}
|
||||
|
||||
public void setUpdateUserName(String updateUserName) {
|
||||
this.updateUserName = updateUserName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public String getPageTitle() {
|
||||
return pageTitle;
|
||||
}
|
||||
|
||||
public void setPageTitle(String pageTitle) {
|
||||
this.pageTitle = pageTitle;
|
||||
}
|
||||
|
||||
public String getPreviewContent() {
|
||||
return previewContent;
|
||||
}
|
||||
|
||||
public void setPreviewContent(String previewContent) {
|
||||
this.previewContent = previewContent;
|
||||
}
|
||||
|
||||
public Long getSpaceId() {
|
||||
return spaceId;
|
||||
}
|
||||
|
||||
public void setSpaceId(Long spaceId) {
|
||||
this.spaceId = spaceId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zyplayer.doc.data.repository.support.consts;
|
||||
|
||||
public class DocAuthConst {
|
||||
public static final String DB = "DB_";
|
||||
public static final String WIKI = "WIKI_";
|
||||
|
||||
public static final String DB_DATASOURCE_MANAGE = "DB_DATASOURCE_MANAGE";
|
||||
}
|
||||
@@ -1,96 +1,94 @@
|
||||
package com.zyplayer.doc.manage.repository.support.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.FileOutConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.PackageConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.TemplateConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
|
||||
public class CodeGenerator {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
final String moduleName = "manage";
|
||||
final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info" };
|
||||
// final String[] tableName = { "zyplayer_storage" };
|
||||
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
final String projectPath = System.getProperty("user.dir");
|
||||
gc.setOutputDir(projectPath + "/src/main/java");
|
||||
gc.setAuthor("暮光:城中城");
|
||||
gc.setOpen(false);
|
||||
gc.setDateType(DateType.ONLY_DATE);
|
||||
gc.setServiceName("%sService");
|
||||
gc.setControllerName("Generator%sController");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?useUnicode=true&useSSL=false&characterEncoding=utf8");
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName("com.mysql.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("root");
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
final PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(null);
|
||||
pc.setParent("com.zyplayer.doc.manage");
|
||||
pc.setController("web.generator");
|
||||
pc.setEntity("repository.manage.entity");
|
||||
pc.setMapper("repository.manage.mapper");
|
||||
pc.setService("service.manage");
|
||||
pc.setServiceImpl("service.manage.impl");
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
// to do nothing
|
||||
}
|
||||
};
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return projectPath + "/src/main/resources/mapper/" + moduleName + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
mpg.setTemplate(new TemplateConfig().setXml(null));
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
// strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
|
||||
strategy.setEntityLombokModel(false);
|
||||
strategy.setRestControllerStyle(true);
|
||||
// strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
|
||||
// strategy.setSuperEntityColumns("id");
|
||||
strategy.setInclude(tableName);// 表名
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setTablePrefix(pc.getModuleName() + "_");
|
||||
mpg.setStrategy(strategy);
|
||||
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
package com.zyplayer.doc.data.repository.support.generator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.*;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CodeGenerator {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
final String moduleName = "manage";
|
||||
// final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info", "db_datasource" };
|
||||
// final String[] tableName = { "wiki_space", "wiki_page", "wiki_page_content", "wiki_page_file", "wiki_page_comment", "wiki_page_zan" };
|
||||
// final String[] tableName = { "db_datasource", "es_datasource", "db_favorite" };
|
||||
final String[] tableName = { "db_history" };
|
||||
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
// 全局配置
|
||||
GlobalConfig gc = new GlobalConfig();
|
||||
final String projectPath = System.getProperty("user.dir") + "/zyplayer-doc-data";
|
||||
gc.setOutputDir(projectPath + "/src/main/java");
|
||||
gc.setAuthor("暮光:城中城");
|
||||
gc.setOpen(false);
|
||||
gc.setFileOverride(true);// 是否覆盖
|
||||
gc.setDateType(DateType.ONLY_DATE);
|
||||
gc.setServiceName("%sService");
|
||||
gc.setControllerName("Generator%sController");
|
||||
mpg.setGlobalConfig(gc);
|
||||
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/zyplayer_doc_manage?useUnicode=true&useSSL=false&characterEncoding=utf8");
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName("com.mysql.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("root");
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
// 包配置
|
||||
final PackageConfig pc = new PackageConfig();
|
||||
pc.setModuleName(null);
|
||||
pc.setParent("com.zyplayer.doc.data");
|
||||
pc.setController("web.generator");
|
||||
pc.setEntity("repository.manage.entity");
|
||||
pc.setMapper("repository.manage.mapper");
|
||||
pc.setService("service.manage");
|
||||
pc.setServiceImpl("service.manage.impl");
|
||||
mpg.setPackageInfo(pc);
|
||||
|
||||
// 自定义配置
|
||||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
// to do nothing
|
||||
}
|
||||
};
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
return projectPath + "/src/main/resources/mapper/" + moduleName + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
|
||||
}
|
||||
});
|
||||
cfg.setFileOutConfigList(focList);
|
||||
mpg.setCfg(cfg);
|
||||
mpg.setTemplate(new TemplateConfig().setXml(null));
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig strategy = new StrategyConfig();
|
||||
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||
// strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
|
||||
strategy.setEntityLombokModel(false);
|
||||
strategy.setRestControllerStyle(true);
|
||||
// strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
|
||||
// strategy.setSuperEntityColumns("id");
|
||||
strategy.setInclude(tableName);// 表名
|
||||
strategy.setControllerMappingHyphenStyle(true);
|
||||
strategy.setTablePrefix(pc.getModuleName() + "_");
|
||||
mpg.setStrategy(strategy);
|
||||
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
mpg.execute();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,127 +1,123 @@
|
||||
package com.zyplayer.doc.manage.repository.support.interceptor;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Plugin;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@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 })
|
||||
})
|
||||
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];
|
||||
Object parameter = null;
|
||||
if (invocation.getArgs().length > 1) {
|
||||
parameter = invocation.getArgs()[1];
|
||||
}
|
||||
BoundSql boundSql = mappedStatement.getBoundSql(parameter);
|
||||
Configuration configuration = mappedStatement.getConfiguration();
|
||||
// 获取sql语句
|
||||
String sql = getSqlString(configuration, boundSql);
|
||||
LOGGER.info(sql);
|
||||
// 执行结果
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
if (target instanceof Executor) {
|
||||
return Plugin.wrap(target, this);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
}
|
||||
|
||||
private String getParameterValue(Object obj) {
|
||||
String value = null;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(obj) + "'";
|
||||
//System.out.println(value);
|
||||
} else {
|
||||
if (obj != null) {
|
||||
value = obj.toString();
|
||||
} else {
|
||||
value = "'null'";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getSqlString(Configuration configuration, BoundSql boundSql) {
|
||||
Object parameterObject = boundSql.getParameterObject();
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0 && parameterObject != null) {
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(parameterObject));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(parameterObject));
|
||||
} else {
|
||||
MetaObject metaObject = configuration.newMetaObject(parameterObject);
|
||||
for (ParameterMapping parameterMapping : parameterMappings) {
|
||||
String propertyName = parameterMapping.getProperty();
|
||||
if (metaObject.hasGetter(propertyName)) {
|
||||
Object obj = metaObject.getValue(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
} else if (boundSql.hasAdditionalParameter(propertyName)) {
|
||||
Object obj = boundSql.getAdditionalParameter(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlSb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换?占位符
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年10月27日
|
||||
* @param sql
|
||||
* @param fromIndex
|
||||
* @param replaceStr
|
||||
* @return
|
||||
*/
|
||||
private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
|
||||
int index = sql.indexOf("?", fromIndex);
|
||||
if (index >= 0) {
|
||||
sql.replace(index, index + 1, replaceStr);
|
||||
}
|
||||
return index + replaceStr.length();
|
||||
}
|
||||
}
|
||||
|
||||
package com.zyplayer.doc.data.repository.support.interceptor;
|
||||
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
@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 })
|
||||
})
|
||||
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];
|
||||
Object parameter = null;
|
||||
if (invocation.getArgs().length > 1) {
|
||||
parameter = invocation.getArgs()[1];
|
||||
}
|
||||
BoundSql boundSql = mappedStatement.getBoundSql(parameter);
|
||||
Configuration configuration = mappedStatement.getConfiguration();
|
||||
// 获取sql语句
|
||||
String sql = getSqlString(configuration, boundSql);
|
||||
LOGGER.info(sql);
|
||||
// 执行结果
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
if (target instanceof Executor) {
|
||||
return Plugin.wrap(target, this);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
}
|
||||
|
||||
private String getParameterValue(Object obj) {
|
||||
String value = null;
|
||||
if (obj instanceof String) {
|
||||
value = "'" + obj.toString() + "'";
|
||||
} else if (obj instanceof Date) {
|
||||
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
|
||||
value = "'" + formatter.format(obj) + "'";
|
||||
//System.out.println(value);
|
||||
} else {
|
||||
if (obj != null) {
|
||||
value = obj.toString();
|
||||
} else {
|
||||
value = "'null'";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getSqlString(Configuration configuration, BoundSql boundSql) {
|
||||
Object parameterObject = boundSql.getParameterObject();
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
StringBuilder sqlSb = new StringBuilder(boundSql.getSql().replaceAll("[\\s]+", " "));
|
||||
int fromIndex = 0;
|
||||
if (parameterMappings.size() > 0 && parameterObject != null) {
|
||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(parameterObject));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(parameterObject));
|
||||
} else {
|
||||
MetaObject metaObject = configuration.newMetaObject(parameterObject);
|
||||
for (ParameterMapping parameterMapping : parameterMappings) {
|
||||
String propertyName = parameterMapping.getProperty();
|
||||
if (metaObject.hasGetter(propertyName)) {
|
||||
Object obj = metaObject.getValue(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
} else if (boundSql.hasAdditionalParameter(propertyName)) {
|
||||
Object obj = boundSql.getAdditionalParameter(propertyName);
|
||||
//sqlSb = sqlSb.replaceFirst("\\?", getParameterValue(obj));
|
||||
fromIndex = replacePlaceholder(sqlSb, fromIndex, getParameterValue(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sqlSb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换?占位符
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年10月27日
|
||||
* @param sql
|
||||
* @param fromIndex
|
||||
* @param replaceStr
|
||||
* @return
|
||||
*/
|
||||
private int replacePlaceholder(StringBuilder sql, int fromIndex, String replaceStr) {
|
||||
int index = sql.indexOf("?", fromIndex);
|
||||
if (index >= 0) {
|
||||
sql.replace(index, index + 1, replaceStr);
|
||||
}
|
||||
return index + replaceStr.length();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.entity;
|
||||
|
||||
import com.zyplayer.doc.data.service.elasticsearch.support.Document;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* wiki文档搜索
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Document(indexName = "zyplayer_doc_wiki", indexType = "_doc")
|
||||
public class EsWikiPage {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 空间ID
|
||||
*/
|
||||
private Long spaceId;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 节点类型 0=有子节点 1=终节点
|
||||
*/
|
||||
private Integer nodeType;
|
||||
|
||||
/**
|
||||
* 赞的数量
|
||||
*/
|
||||
private Integer zanNum;
|
||||
|
||||
/**
|
||||
* 编辑类型 0=可编辑 1=不允许编辑
|
||||
*/
|
||||
private Integer editType;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改人ID
|
||||
*/
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 修改人名字
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 0=有效 1=删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 阅读数
|
||||
*/
|
||||
private Integer viewNum;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer seqNo;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 预览内容
|
||||
*/
|
||||
private String preview;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getSpaceId() {
|
||||
return spaceId;
|
||||
}
|
||||
|
||||
public void setSpaceId(Long spaceId) {
|
||||
this.spaceId = spaceId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Integer getNodeType() {
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
public void setNodeType(Integer nodeType) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
public Integer getZanNum() {
|
||||
return zanNum;
|
||||
}
|
||||
|
||||
public void setZanNum(Integer zanNum) {
|
||||
this.zanNum = zanNum;
|
||||
}
|
||||
|
||||
public Integer getEditType() {
|
||||
return editType;
|
||||
}
|
||||
|
||||
public void setEditType(Integer editType) {
|
||||
this.editType = editType;
|
||||
}
|
||||
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Long getUpdateUserId() {
|
||||
return updateUserId;
|
||||
}
|
||||
|
||||
public void setUpdateUserId(Long updateUserId) {
|
||||
this.updateUserId = updateUserId;
|
||||
}
|
||||
|
||||
public String getUpdateUserName() {
|
||||
return updateUserName;
|
||||
}
|
||||
|
||||
public void setUpdateUserName(String updateUserName) {
|
||||
this.updateUserName = updateUserName;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Integer getViewNum() {
|
||||
return viewNum;
|
||||
}
|
||||
|
||||
public void setViewNum(Integer viewNum) {
|
||||
this.viewNum = viewNum;
|
||||
}
|
||||
|
||||
public Integer getSeqNo() {
|
||||
return seqNo;
|
||||
}
|
||||
|
||||
public void setSeqNo(Integer seqNo) {
|
||||
this.seqNo = seqNo;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getPreview() {
|
||||
return preview;
|
||||
}
|
||||
|
||||
public void setPreview(String preview) {
|
||||
this.preview = preview;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.service;
|
||||
|
||||
import com.zyplayer.doc.data.service.elasticsearch.entity.EsWikiPage;
|
||||
import com.zyplayer.doc.data.service.elasticsearch.support.EsAbstractService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* wiki文档搜索
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Service
|
||||
public class EsWikiPageService extends EsAbstractService<EsWikiPage> {
|
||||
|
||||
@Override
|
||||
public Class<EsWikiPage> getObjClass() {
|
||||
return EsWikiPage.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryKey(EsWikiPage tableIndex) {
|
||||
return String.valueOf(tableIndex.getId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* es文档定义
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface Document {
|
||||
String indexName();
|
||||
|
||||
String indexType();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 开启es客户端
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
@Configuration
|
||||
public class ElasticSearchUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(ElasticSearchUtil.class);
|
||||
|
||||
@Value(value = "${zyplayer.doc.manage.elasticsearch.hostPort:''}")
|
||||
private String hostAndPort;
|
||||
@Value(value = "${zyplayer.doc.manage.elasticsearch.scheme:''}")
|
||||
private String esScheme;
|
||||
@Value("${zyplayer.doc.manage.elasticsearch.open:''}")
|
||||
private String elasticsearchOpen;
|
||||
|
||||
private static final Object createLock = new Object();
|
||||
private static Map<String, RestHighLevelClient> restClientMap = new ConcurrentHashMap<>();
|
||||
|
||||
public boolean isOpen() {
|
||||
return Objects.equals("true", elasticsearchOpen);
|
||||
}
|
||||
|
||||
public RestHighLevelClient getEsClient() {
|
||||
if (!this.isOpen()) {
|
||||
return null;
|
||||
}
|
||||
return this.getEsClient(hostAndPort, esScheme);
|
||||
}
|
||||
|
||||
public RestHighLevelClient getEsClient(String hostPort, String scheme) {
|
||||
String mapKey = scheme + "_" + hostPort;
|
||||
RestHighLevelClient restClient = restClientMap.get(mapKey);
|
||||
if (restClient == null) {
|
||||
synchronized (createLock) {
|
||||
restClient = restClientMap.get(mapKey);
|
||||
if (restClient == null) {
|
||||
try {
|
||||
// rest请求客户端
|
||||
// 例:10.16.32.12:9200,10.16.32.12:9201
|
||||
List<HttpHost> hostPortList = new LinkedList<>();
|
||||
for (String hostPortStr : hostPort.split(",")) {
|
||||
String[] splitArr = hostPortStr.split(":");
|
||||
hostPortList.add(new HttpHost(splitArr[0], Integer.valueOf(splitArr[1]), scheme));
|
||||
}
|
||||
restClient = new RestHighLevelClient(RestClient.builder(hostPortList.toArray(new HttpHost[]{})));
|
||||
restClientMap.put(mapKey, restClient);
|
||||
} catch (Exception e) {
|
||||
logger.error("创建es客户端失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return restClient;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dozer.Mapper;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.text.Text;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* es抽象类
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
public abstract class EsAbstractService<T> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EsAbstractService.class);
|
||||
|
||||
@Resource
|
||||
private ElasticSearchUtil elasticSearchUtil;
|
||||
@Resource
|
||||
private Mapper mapper;
|
||||
|
||||
public abstract Class<T> getObjClass();
|
||||
|
||||
public abstract String getPrimaryKey(T table);
|
||||
|
||||
private String getIndexName() {
|
||||
Document annotation = this.getObjClass().getAnnotation(Document.class);
|
||||
return annotation.indexName();
|
||||
}
|
||||
|
||||
private String getIndexType() {
|
||||
Document annotation = this.getObjClass().getAnnotation(Document.class);
|
||||
return annotation.indexType();
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return elasticSearchUtil.isOpen();
|
||||
}
|
||||
|
||||
public boolean upsert(T table) {
|
||||
String pk = getPrimaryKey(table);
|
||||
UpdateRequest request = new UpdateRequest(this.getIndexName(), pk);
|
||||
request.timeout(TimeValue.timeValueMinutes(2));
|
||||
request.doc(JSON.toJSONString(table), XContentType.JSON);
|
||||
request.docAsUpsert(true);
|
||||
RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
|
||||
try {
|
||||
UpdateResponse updateResponse = esClient.update(request, RequestOptions.DEFAULT);
|
||||
return updateResponse.status() == RestStatus.OK;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void delete(T table) {
|
||||
String pk = getPrimaryKey(table);
|
||||
RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
|
||||
DeleteRequest request = new DeleteRequest(this.getIndexName(), pk);
|
||||
request.timeout(TimeValue.timeValueMinutes(2));
|
||||
try {
|
||||
DeleteResponse deleteResponse = esClient.delete(request, RequestOptions.DEFAULT);
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
logger.warn("ElasticSearch delete index id: {} but not found!", pk);
|
||||
} else {
|
||||
logger.warn("ElasticSearch delete index id: {}", pk);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条件 模糊查询,查询前100条
|
||||
* @param condition 查询条件
|
||||
*/
|
||||
public List<T> getDataByCondition(List<EsQueryColumn> condition) {
|
||||
return getDataByCondition(condition, null, 0, 100).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条件 模糊查询
|
||||
* @param condition 查询条件
|
||||
* @param startIndex 开始行
|
||||
* @param pageSize 每页数量
|
||||
*/
|
||||
public EsPage<T> getDataByCondition(List<EsQueryColumn> condition, String[] fields, Integer startIndex, Integer pageSize) {
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
// 组装条件
|
||||
for (EsQueryColumn column : condition) {
|
||||
if (StringUtils.isBlank(column.getValue())) {
|
||||
if (CollectionUtils.isEmpty(column.getValues())) {
|
||||
continue;
|
||||
}
|
||||
for (Object value : column.getValues()) {
|
||||
if (column.getType() == 0) {
|
||||
boolQueryBuilder.must(QueryBuilders.wildcardQuery(column.getKey(), value.toString()));
|
||||
} else if (column.getType() == 1) {
|
||||
boolQueryBuilder.must(QueryBuilders.termQuery(column.getKey(), value));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (column.getType() == 0) {
|
||||
boolQueryBuilder.must(QueryBuilders.wildcardQuery(column.getKey(), column.getValue()));
|
||||
} else if (column.getType() == 1) {
|
||||
boolQueryBuilder.must(QueryBuilders.termQuery(column.getKey(), column.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
condition.forEach(val -> {
|
||||
if (StringUtils.isNotBlank(val.getValue())) {
|
||||
if (val.getType() == 0) {
|
||||
boolQueryBuilder.must(QueryBuilders.wildcardQuery(val.getKey(), val.getValue()));
|
||||
} else if (val.getType() == 1) {
|
||||
boolQueryBuilder.must(QueryBuilders.termQuery(val.getKey(), val.getValue()));
|
||||
}
|
||||
}
|
||||
});
|
||||
return this.getDataByQuery(boolQueryBuilder, fields, startIndex, pageSize);
|
||||
}
|
||||
/**
|
||||
* 多条件 模糊查询
|
||||
* @param queryBuilders 查询条件
|
||||
* @param startIndex 开始行
|
||||
* @param pageSize 每页数量
|
||||
*/
|
||||
public EsPage<T> getDataByQuery(QueryBuilder queryBuilders, String[] fields, Integer startIndex, Integer pageSize) {
|
||||
// 设置高亮标签
|
||||
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
||||
highlightBuilder.preTags("<span style=\"color:red\">");
|
||||
highlightBuilder.postTags("</span>");
|
||||
highlightBuilder.field("*");
|
||||
// 组装条件
|
||||
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||
sourceBuilder.query(queryBuilders)
|
||||
.highlighter(highlightBuilder).from(startIndex).size(pageSize)
|
||||
.timeout(new TimeValue(60, TimeUnit.SECONDS));
|
||||
// 查询指定字段
|
||||
if (fields != null && fields.length > 0) {
|
||||
sourceBuilder.fetchSource(fields, new String[]{});
|
||||
}
|
||||
// 组装请求
|
||||
SearchRequest searchRequest = new SearchRequest();
|
||||
searchRequest.indices(this.getIndexName());
|
||||
searchRequest.source(sourceBuilder);
|
||||
RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
|
||||
try {
|
||||
SearchResponse response = esClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||
return responseToList(response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public EsPage<T> responseToList(SearchResponse response) {
|
||||
List<T> tableList = new LinkedList<>();
|
||||
for (SearchHit searchHit : response.getHits().getHits()) {
|
||||
// 获取表ID和表类型
|
||||
Map<String, Object> sourceMap = searchHit.getSourceAsMap();
|
||||
if (sourceMap == null) {
|
||||
sourceMap = new HashMap<>();
|
||||
}
|
||||
// 获取高亮文本
|
||||
Map<String, HighlightField> highlightFieldMap = searchHit.getHighlightFields();
|
||||
for (String key : highlightFieldMap.keySet()) {
|
||||
HighlightField hf = highlightFieldMap.get(key);
|
||||
StringBuilder fragments = new StringBuilder();
|
||||
for (Text text : hf.getFragments()) {
|
||||
fragments.append(text.toString());
|
||||
}
|
||||
sourceMap.put(key, fragments.toString());
|
||||
}
|
||||
T table = mapper.map(sourceMap, this.getObjClass());
|
||||
tableList.add(table);
|
||||
}
|
||||
EsPage<T> esPage = new EsPage<>();
|
||||
esPage.setTotal(response.getHits().getTotalHits().value);
|
||||
esPage.setData(tableList);
|
||||
return esPage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* es分页结果
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
public class EsPage<T> {
|
||||
private Long total;
|
||||
private List<T> data;
|
||||
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<T> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<T> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zyplayer.doc.data.service.elasticsearch.support;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* es查询字段封装
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-07
|
||||
*/
|
||||
public class EsQueryColumn {
|
||||
private String key;
|
||||
private String value;
|
||||
private List<Object> values;
|
||||
// 类型,0=分词搜索 1=不分词
|
||||
private int type;
|
||||
|
||||
public EsQueryColumn(String key, String value) {
|
||||
this(key, value, 0);
|
||||
}
|
||||
|
||||
public EsQueryColumn(String key, String value, int type) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public EsQueryColumn(String key, List<Object> values, int type) {
|
||||
this.key = key;
|
||||
this.values = values;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static EsQueryColumn like(String key, String value){
|
||||
return new EsQueryColumn(key, value, 0);
|
||||
}
|
||||
|
||||
public static EsQueryColumn must(String key, String value){
|
||||
return new EsQueryColumn(key, value, 1);
|
||||
}
|
||||
|
||||
public static EsQueryColumn in(String key, List<Object> values){
|
||||
return new EsQueryColumn(key, values, 1);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<Object> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(List<Object> values) {
|
||||
this.values = values;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbDatasource;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-04
|
||||
*/
|
||||
public interface DbDatasourceService extends IService<DbDatasource> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbFavorite;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public interface DbFavoriteService extends IService<DbFavorite> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbHistory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
public interface DbHistoryService extends IService<DbHistory> {
|
||||
|
||||
void saveHistory(String content, Long datasourceId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.EsDatasource;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-27
|
||||
*/
|
||||
public interface EsDatasourceService extends IService<EsDatasource> {
|
||||
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* 用户权限表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-03
|
||||
* @since 2019-05-31
|
||||
*/
|
||||
public interface UserAuthService extends IService<UserAuth> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public interface WikiPageCommentService extends IService<WikiPageComment> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
public interface WikiPageContentService extends IService<WikiPageContent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-06
|
||||
*/
|
||||
public interface WikiPageFileService extends IService<WikiPageFile> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-09
|
||||
*/
|
||||
public interface WikiPageService extends IService<WikiPage> {
|
||||
|
||||
void changeParent(WikiPage wikiPage, Integer beforeSeq, Integer afterSeq);
|
||||
|
||||
void deletePage(WikiPage wikiPage);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageZan;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-05
|
||||
*/
|
||||
public interface WikiPageZanService extends IService<WikiPageZan> {
|
||||
void zanPage(WikiPageZan wikiPageZan);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-13
|
||||
*/
|
||||
public interface WikiSpaceService extends IService<WikiSpace> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zyplayer.doc.manage.service.manage;
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.AuthInfoMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.AuthInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.AuthInfoMapper;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbDatasource;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.DbDatasourceMapper;
|
||||
import com.zyplayer.doc.data.service.manage.DbDatasourceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-04
|
||||
*/
|
||||
@Service
|
||||
public class DbDatasourceServiceImpl extends ServiceImpl<DbDatasourceMapper, DbDatasource> implements DbDatasourceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbFavorite;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.DbFavoriteMapper;
|
||||
import com.zyplayer.doc.data.service.manage.DbFavoriteService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
@Service
|
||||
public class DbFavoriteServiceImpl extends ServiceImpl<DbFavoriteMapper, DbFavorite> implements DbFavoriteService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbHistory;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.DbHistoryMapper;
|
||||
import com.zyplayer.doc.data.service.manage.DbHistoryService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-08-21
|
||||
*/
|
||||
@Service
|
||||
public class DbHistoryServiceImpl extends ServiceImpl<DbHistoryMapper, DbHistory> implements DbHistoryService {
|
||||
|
||||
@Resource
|
||||
DbHistoryMapper dbHistoryMapper;
|
||||
|
||||
@Override
|
||||
public void saveHistory(String content, Long datasourceId) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
DbHistory dbHistory = new DbHistory();
|
||||
dbHistory.setDatasourceId(datasourceId);
|
||||
dbHistory.setContent(content);
|
||||
dbHistory.setCreateTime(new Date());
|
||||
dbHistory.setCreateUserId(currentUser.getUserId());
|
||||
dbHistory.setCreateUserName(currentUser.getUsername());
|
||||
dbHistory.setYn(1);
|
||||
this.save(dbHistory);
|
||||
// 删除多余的数据
|
||||
dbHistoryMapper.deleteHistory();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.EsDatasource;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.EsDatasourceMapper;
|
||||
import com.zyplayer.doc.data.service.manage.EsDatasourceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-07-27
|
||||
*/
|
||||
@Service
|
||||
public class EsDatasourceServiceImpl extends ServiceImpl<EsDatasourceMapper, EsDatasource> implements EsDatasourceService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.UserAuthMapper;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户权限表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-05-31
|
||||
*/
|
||||
@Service
|
||||
public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuth> implements UserAuthService {
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.UserInfoMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.UserInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.UserInfoMapper;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageComment;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageCommentMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageCommentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageCommentServiceImpl extends ServiceImpl<WikiPageCommentMapper, WikiPageComment> implements WikiPageCommentService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageContent;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageContentMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageContentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-24
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageContentServiceImpl extends ServiceImpl<WikiPageContentMapper, WikiPageContent> implements WikiPageContentService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageFile;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageFileMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageFileService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-06
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageFileServiceImpl extends ServiceImpl<WikiPageFileMapper, WikiPageFile> implements WikiPageFileService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-06-05
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageServiceImpl extends ServiceImpl<WikiPageMapper, WikiPage> implements WikiPageService {
|
||||
|
||||
@Resource
|
||||
WikiPageMapper wikiPageMapper;
|
||||
|
||||
@Override
|
||||
public void changeParent(WikiPage wikiPage, Integer beforeSeq, Integer afterSeq) {
|
||||
if (beforeSeq != null && beforeSeq >= 0) {
|
||||
// 在此seq之前
|
||||
wikiPageMapper.updateAfterSeq(wikiPage.getParentId(), beforeSeq);
|
||||
wikiPage.setSeqNo(beforeSeq);
|
||||
} else if (afterSeq != null && afterSeq >= 0) {
|
||||
// 在此seq之后
|
||||
wikiPageMapper.updateAfterSeq(wikiPage.getParentId(), afterSeq + 1);
|
||||
wikiPage.setSeqNo(afterSeq + 1);
|
||||
} else {
|
||||
// 放在末尾
|
||||
Integer lastSeq = wikiPageMapper.getLastSeq(wikiPage.getParentId());
|
||||
lastSeq = Optional.ofNullable(lastSeq).orElse(0);
|
||||
wikiPage.setSeqNo(lastSeq + 1);
|
||||
}
|
||||
this.updateById(wikiPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePage(WikiPage wikiPage) {
|
||||
wikiPage.setDelFlag(1);
|
||||
this.updateById(wikiPage);
|
||||
|
||||
QueryWrapper<WikiPage> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("del_flag", 0);
|
||||
wrapper.eq("parent_id", wikiPage.getId());
|
||||
List<WikiPage> wikiPageList = this.list(wrapper);
|
||||
if (CollectionUtils.isEmpty(wikiPageList)) {
|
||||
return;
|
||||
}
|
||||
// 递归删除子页面
|
||||
for (WikiPage page : wikiPageList) {
|
||||
wikiPage.setId(page.getId());
|
||||
this.deletePage(wikiPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiPageZan;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiPageZanMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiPageZanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-05
|
||||
*/
|
||||
@Service
|
||||
public class WikiPageZanServiceImpl extends ServiceImpl<WikiPageZanMapper, WikiPageZan> implements WikiPageZanService {
|
||||
|
||||
@Resource
|
||||
WikiPageMapper wikiPageMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void zanPage(WikiPageZan wikiPageZan) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
UpdateWrapper<WikiPageZan> wrapper = new UpdateWrapper<>();
|
||||
wrapper.eq("create_user_id", currentUser.getUserId());
|
||||
wrapper.eq("page_id", wikiPageZan.getPageId());
|
||||
wrapper.eq(wikiPageZan.getCommentId() != null, "comment_id", wikiPageZan.getCommentId());
|
||||
WikiPageZan pageZan = this.getOne(wrapper);
|
||||
if (pageZan != null) {
|
||||
if (Objects.equals(wikiPageZan.getYn(), pageZan.getYn())) {
|
||||
return;
|
||||
}
|
||||
wikiPageZan.setId(pageZan.getId());
|
||||
this.updateById(wikiPageZan);
|
||||
} else {
|
||||
wikiPageZan.setCreateTime(new Date());
|
||||
wikiPageZan.setCreateUserId(currentUser.getUserId());
|
||||
wikiPageZan.setCreateUserName(currentUser.getUsername());
|
||||
this.save(wikiPageZan);
|
||||
}
|
||||
int numAdd = wikiPageZan.getYn() == 1 ? 1 : -1;
|
||||
wikiPageMapper.updateZanNum(wikiPageZan.getPageId(), numAdd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.WikiSpace;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.WikiSpaceMapper;
|
||||
import com.zyplayer.doc.data.service.manage.WikiSpaceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-03-13
|
||||
*/
|
||||
@Service
|
||||
public class WikiSpaceServiceImpl extends ServiceImpl<WikiSpaceMapper, WikiSpace> implements WikiSpaceService {
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.zyplayer.doc.manage.service.manage.impl;
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.manage.repository.manage.entity.ZyplayerStorage;
|
||||
import com.zyplayer.doc.manage.repository.manage.mapper.ZyplayerStorageMapper;
|
||||
import com.zyplayer.doc.manage.service.manage.ZyplayerStorageService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ZyplayerStorage;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ZyplayerStorageMapper;
|
||||
import com.zyplayer.doc.data.service.manage.ZyplayerStorageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zyplayer.doc.data.utils;
|
||||
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BeanUtil {
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static <T extends Annotation> T getAnnotation(JoinPoint pjp, Class<T> t) throws Exception {
|
||||
Method method = ((MethodSignature) pjp.getSignature()).getMethod();
|
||||
T annotation = method.getAnnotation(t);// 方法上定义的
|
||||
if (annotation == null) {
|
||||
annotation = (T) pjp.getSignature().getDeclaringType().getAnnotation(t);// 类上定义的
|
||||
if (annotation == null) {
|
||||
Object target = pjp.getTarget();
|
||||
annotation = target.getClass().getAnnotation(t);// 实现类上定义的
|
||||
if (annotation == null) {
|
||||
Signature sig = pjp.getSignature();
|
||||
if (sig instanceof MethodSignature) {
|
||||
MethodSignature msig = (MethodSignature) sig;
|
||||
Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes());
|
||||
annotation = currentMethod.getAnnotation(t);// 实现类的方法上定义的
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return annotation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.zyplayer.doc.data.utils;
|
||||
|
||||
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_";
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.zyplayer.doc.data.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 轻量缓存工具类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年05月25日
|
||||
*/
|
||||
public class CacheUtil {
|
||||
private static Logger logger = LoggerFactory.getLogger(CacheUtil.class);
|
||||
|
||||
// 定期清除过期的key
|
||||
static {
|
||||
Timer timer = new Timer();
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
for (String key : cacheDataMap.keySet()) {
|
||||
CacheData cacheData = cacheDataMap.get(key);
|
||||
if (cacheData == null || currentTimeMillis - cacheData.getLastVisitTime() < (cacheData.getSeconds() * 1000)) {
|
||||
continue;
|
||||
}
|
||||
cacheDataMap.remove(key);
|
||||
logger.info("缓存过期,清理缓存:{}", key);
|
||||
}
|
||||
}
|
||||
}, 0, 5000);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
CacheUtil.put("xx", "xx", 6);
|
||||
Thread.sleep(4000);
|
||||
CacheUtil.get("xx");
|
||||
System.out.println(cacheDataMap.get("xx").getLastVisitTime());
|
||||
Thread.sleep(7000);
|
||||
CacheUtil.get("xx");
|
||||
System.out.println(cacheDataMap.get("xx").getLastVisitTime());
|
||||
Thread.sleep(99000);
|
||||
}
|
||||
|
||||
// 现在是内存缓存,不支持分布式部署,后期考虑放到redis,但感觉也没必要。。
|
||||
private static Map<String, CacheData> cacheDataMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 放入缓存,默认12小时,按最后一次访问的12小时
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public static void put(String key, Object value) {
|
||||
put(key, value, 60 * 60 * 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* 放入缓存,有访问则继续有效
|
||||
* @param key
|
||||
* @param value
|
||||
* @param seconds 缓存时长 秒
|
||||
*/
|
||||
public static void put(String key, Object value, long seconds) {
|
||||
if (StringUtils.isBlank(key) || value == null) {
|
||||
return;
|
||||
}
|
||||
cacheDataMap.put(key, new CacheData(seconds, value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
* @param key
|
||||
*/
|
||||
public static void remove(String key) {
|
||||
if (StringUtils.isBlank(key)) {
|
||||
return;
|
||||
}
|
||||
cacheDataMap.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存
|
||||
* @param key
|
||||
*/
|
||||
public static <T> T get(String key) {
|
||||
if (StringUtils.isBlank(key)) {
|
||||
return null;
|
||||
}
|
||||
CacheData cacheData = cacheDataMap.get(key);
|
||||
if (cacheData != null) {
|
||||
cacheData.setLastVisitTime(System.currentTimeMillis());
|
||||
return (T) cacheData.getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class CacheData {
|
||||
/**缓存时长 秒*/
|
||||
private Long seconds;
|
||||
private Long lastVisitTime;
|
||||
private Object data;
|
||||
|
||||
public CacheData(long seconds, Object data) {
|
||||
this.data = data;
|
||||
this.seconds = seconds;
|
||||
this.lastVisitTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Long getSeconds() {
|
||||
return seconds;
|
||||
}
|
||||
|
||||
public void setSeconds(Long seconds) {
|
||||
this.seconds = seconds;
|
||||
}
|
||||
|
||||
public Long getLastVisitTime() {
|
||||
return lastVisitTime;
|
||||
}
|
||||
|
||||
public void setLastVisitTime(Long lastVisitTime) {
|
||||
this.lastVisitTime = lastVisitTime;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.DbDatasourceMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.DbFavoriteMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.DbHistoryMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.EsDatasourceMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.manage.repository.manage.mapper.UserAuthMapper">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.UserAuthMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.WikiPageCommentMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.WikiPageContentMapper">
|
||||
|
||||
<select id="getNewsList" resultType="com.zyplayer.doc.data.repository.manage.vo.SpaceNewsVo">
|
||||
select a.space_id as spaceId, a.id as pageId, a.zan_num as zanNum, a.view_num as viewNum,
|
||||
a.create_user_name as createUserName, a.update_user_name as updateUserName, a.create_time as createTime,
|
||||
a.update_time as updateTime, a.name as pageTitle, b.preview as previewContent
|
||||
from wiki_page a
|
||||
join wiki_page_content b on b.page_id = a.id
|
||||
where a.del_flag = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
and (
|
||||
a.name like #{keywords} or b.preview like #{keywords}
|
||||
)
|
||||
</if>
|
||||
<if test="spaceIds != null and spaceIds.size > 0">
|
||||
and a.space_id in
|
||||
<foreach collection="spaceIds" open="(" close=")" item="item" separator=",">#{item}</foreach>
|
||||
</if>
|
||||
<if test="newsType == 1">order by a.update_time desc</if>
|
||||
<if test="newsType == 2">order by a.create_time desc</if>
|
||||
<if test="newsType == 3">order by a.view_num desc</if>
|
||||
<if test="newsType == 4">order by a.zan_num desc</if>
|
||||
<if test="newsType == 5">order by a.view_num+a.zan_num desc</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.WikiPageFileMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.WikiPageMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.WikiPageZanMapper">
|
||||
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user