Compare commits
196 Commits
v3.6.2
...
develop_xx
Author | SHA1 | Date | |
---|---|---|---|
|
df1b72fb58 | ||
|
415bf8a64c | ||
|
3f009dc1f9 | ||
|
0e156c04b4 | ||
|
d4fa0abc4e | ||
|
eff4fc4c7c | ||
|
8c1c0f10be | ||
|
02ad0f93dc | ||
|
a06132a4c2 | ||
|
f043ddff42 | ||
|
328bd55587 | ||
|
04fc8e878a | ||
|
970ad407f1 | ||
|
f8079f443a | ||
|
75a4c3002b | ||
|
e4e511aed8 | ||
|
ec9674f2aa | ||
|
06074faf9a | ||
|
73654dda2b | ||
|
c0634a335e | ||
|
5dcc2b0b46 | ||
|
6cdb68899b | ||
|
d955b11165 | ||
|
99f2a15990 | ||
|
1081b8e10a | ||
|
4b1507b2d1 | ||
|
82658f3b5f | ||
|
acf9c76757 | ||
|
4b00ea68a9 | ||
|
d9f9fd8bd2 | ||
|
c1583f83bb | ||
|
eecbb2dd9c | ||
|
0afc7b1bbf | ||
|
f5a9a7423f | ||
|
3858cd4e49 | ||
|
c4a6acf2b3 | ||
|
8781cc54d4 | ||
|
84a06a7037 | ||
|
a046899dd6 | ||
|
14a1ff69bf | ||
|
467290b908 | ||
|
d77ce5b446 | ||
|
8d35aa80ab | ||
|
11978c2c9e | ||
|
81c1514a21 | ||
|
af1237e2d7 | ||
|
9033ca6331 | ||
|
fd200772c9 | ||
|
73502a279b | ||
|
85b64bbc10 | ||
|
6d0ab33757 | ||
|
74d7ea7000 | ||
|
cdfe481d60 | ||
|
0ff87614ea | ||
|
2cb9f85081 | ||
|
d8e559ab50 | ||
|
3849a9b86f | ||
|
71b9d1d916 | ||
|
4b9dbe969c | ||
|
2136f7490f | ||
|
3586ffbc0a | ||
|
f78a2a36cf | ||
|
a8219253e9 | ||
|
5c35f7af0a | ||
|
d55e1a3e22 | ||
|
21a6a49ce9 | ||
|
3735023cef | ||
|
89992dc781 | ||
|
976db9420e | ||
|
e33db86081 | ||
|
48a70c2aca | ||
|
ea5c0e8bd1 | ||
|
b0c249cdca | ||
|
730fcb4c76 | ||
|
b976a00389 | ||
|
6d9b563583 | ||
|
bfb7d6cc5c | ||
|
9d4dc409c6 | ||
|
34d211afbf | ||
|
2d218076c4 | ||
|
674e4df84c | ||
|
331f56d112 | ||
|
f494aae2c7 | ||
|
2fc533f8ae | ||
|
82758271e3 | ||
|
4c82c2d720 | ||
|
4665b5c4b9 | ||
|
7bbabb3492 | ||
|
d6093d8182 | ||
|
f77792aa3c | ||
|
c62da9bb3a | ||
|
8a63cff0b5 | ||
|
07bed12fa5 | ||
|
0d6e0ffb06 | ||
|
e7005004bb | ||
|
ff68cdd829 | ||
|
b61dc4d0d5 | ||
|
98f1f804c3 | ||
|
5978d6cbcc | ||
|
ef290bed9c | ||
|
5543e5aa57 | ||
|
0332802fe5 | ||
|
a55f456b3d | ||
|
f6d66e69fb | ||
|
96960789e1 | ||
|
1998dcd460 | ||
|
a33d8f68a2 | ||
|
30959da038 | ||
|
5406783344 | ||
|
d84345918b | ||
|
a5394cb426 | ||
|
2275b85752 | ||
|
2062123edd | ||
|
255b3f8c4b | ||
|
00179359bd | ||
|
6019ce11c7 | ||
|
3e1c1f02e9 | ||
|
98a5157623 | ||
|
05d65c19a7 | ||
|
4c9f39ab19 | ||
|
8bc05a1606 | ||
|
f9aad61b10 | ||
|
8311681b23 | ||
|
4497dd1974 | ||
|
44bf0cd693 | ||
|
f333a2c084 | ||
|
bff5b0827e | ||
|
14f9205d76 | ||
|
cb2ff39b1e | ||
|
3eaa526093 | ||
|
04d7b45334 | ||
|
24c80e381c | ||
|
9fe51eab74 | ||
|
e1c800d78f | ||
|
eb982b51f7 | ||
|
18f5fbf508 | ||
|
c63b4d617e | ||
|
4fb0d478f3 | ||
|
dabfb9d1e8 | ||
|
dce8a21c0d | ||
|
d9ad02e3f5 | ||
|
b02a2b3b2c | ||
|
f28c8a9c16 | ||
|
e44978617f | ||
|
aa2929a3cd | ||
|
281561c85b | ||
|
cab350dbb2 | ||
|
9ed465784a | ||
|
e2cfa5a788 | ||
|
6fb1e5cc99 | ||
|
749fd1aeaa | ||
|
8c3fb7f1ca | ||
|
c71eadef82 | ||
|
3ffa75dc10 | ||
|
8ddc6cc434 | ||
|
5854536c70 | ||
|
a7d825cc54 | ||
|
687eb61846 | ||
|
9f23f817b1 | ||
|
0c59adf23b | ||
|
57eca58b24 | ||
|
c76df15a7f | ||
|
3b0edd8e1f | ||
|
2c3b735d49 | ||
|
b45b83fdb0 | ||
|
29d074ec18 | ||
|
282bc7b707 | ||
|
68b3458c30 | ||
|
2f5002f673 | ||
|
d293d7bf91 | ||
|
a9080310a4 | ||
|
1f571f9b64 | ||
|
7be529fe4a | ||
|
2f62641b63 | ||
|
d962620814 | ||
|
7640d153ac | ||
|
3d9f52ffee | ||
|
0112af202b | ||
|
e3010ea81e | ||
|
05608d0316 | ||
|
4f6ec5aa0f | ||
|
01984f7137 | ||
|
617f6f50b0 | ||
|
e0686f079c | ||
|
5fb1717770 | ||
|
4bf495b6c0 | ||
|
028c200764 | ||
|
472440ef7c | ||
|
5278b5fc39 | ||
|
9a0a79957b | ||
|
d93bf3dd4e | ||
|
09a4f39172 | ||
|
3abe7e22c9 | ||
|
5e1135268a | ||
|
54aeef7c80 | ||
|
027fbffb7f |
79
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
name: Create novel-plus Maven Release with ZIPs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# 匹配所有以'v'开头的标签
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up JDK 21
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '21'
|
||||||
|
# 可选,默认是 temurin,也可以选择其他发行版
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Build project with Maven
|
||||||
|
run: mvn clean install -DskipTests=true -Pcentral-repo
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
# 使用 tag_name 而不是 github.ref
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
release_name: novel-plus ${{ github.ref_name }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
|
||||||
|
# 使用 action 来替代直接 curl 进行上传
|
||||||
|
- name: Upload sql.zip
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ${{ github.workspace }}/novel-common/target/build/sql.zip
|
||||||
|
asset_name: sql.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Upload novel-crawl.zip
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ${{ github.workspace }}/novel-crawl/target/build/novel-crawl.zip
|
||||||
|
asset_name: novel-crawl.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Upload novel-front.zip
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ${{ github.workspace }}/novel-front/target/build/novel-front.zip
|
||||||
|
asset_name: novel-front.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|
||||||
|
- name: Upload novel-admin.zip
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ${{ github.workspace }}/novel-admin/target/build/novel-admin.zip
|
||||||
|
asset_name: novel-admin.zip
|
||||||
|
asset_content_type: application/zip
|
305
README.md
@ -1,288 +1,135 @@
|
|||||||
[]( https://www.kuaidaili.com/?ref=mdpz65syhqup )
|
<p align="center">
|
||||||
|
<a href="https://www.swiftproxy.net/?code=T2WV1VT50"><img src="https://xxyopen.com/images/ad1.png" alt="AD" ></a>
|
||||||
|
<a href="https://cloud.tencent.com/act/cps/redirect?redirect=2446&cps_key=736e609d66e0ac4e57813316cec6fd0b&from=console"><img src="https://youdoc.github.io/img/tencent.jpg" alt="AD" ></a>
|
||||||
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href='https://github.com/201206030/novel-plus'><img alt="Github stars" src="https://img.shields.io/github/stars/201206030/novel-plus?logo=github"></a>
|
<a href='https://github.com/201206030/novel-plus'><img alt="Github stars" src="https://img.shields.io/github/stars/201206030/novel-plus?logo=github"></a>
|
||||||
<a href='https://github.com/201206030/novel-plus'><img alt="Github forks" src="https://img.shields.io/github/forks/201206030/novel-plus?logo=github"></a>
|
<a href='https://github.com/201206030/novel-plus'><img alt="Github forks" src="https://img.shields.io/github/forks/201206030/novel-plus?logo=github"></a>
|
||||||
<a href='https://gitee.com/novel_dev_team/novel-plus'><img alt="Gitee stars" src="https://gitee.com/novel_dev_team/novel-plus/badge/star.svg?theme=gitee"></a>
|
<a href='https://gitee.com/novel_dev_team/novel-plus'><img alt="Gitee stars" src="https://gitee.com/novel_dev_team/novel-plus/badge/star.svg?theme=gitee"></a>
|
||||||
<a href='https://gitee.com/novel_dev_team/novel-plus'><img alt="Gitee forks" src="https://gitee.com/novel_dev_team/novel-plus/badge/fork.svg?theme=gitee"></a>
|
<a href='https://gitee.com/novel_dev_team/novel-plus'><img alt="Gitee forks" src="https://gitee.com/novel_dev_team/novel-plus/badge/fork.svg?theme=gitee"></a>
|
||||||
<a href="https://github.com/201206030/novel-plus"><img src="https://visitor-badge.glitch.me/badge?page_id=201206030.novel-plus" alt="visitors"></a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
#### 官网
|
<p align="center">
|
||||||
|
👉 <a href='https://novel.xxyopen.com'>官网</a> | 👉 <a href='https://www.bilibili.com/video/BV1Zo4y187Mi'>项目演示</a> | 👉 <a href='https://docs.xxyopen.com/course/novelplus/1.html'>安装教程</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
https://201206030.github.io
|
## 项目介绍
|
||||||
|
|
||||||
#### 学习版
|
|
||||||
|
|
||||||
[基于 Spring Boot 3 + Vue 3 开发的前后端分离学习型小说项目](https://github.com/201206030/novel)
|
|
||||||
|
|
||||||
#### 微服务版
|
|
||||||
|
|
||||||
[Github](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
|
||||||
|
|
||||||
#### 演示地址
|
|
||||||
|
|
||||||
[点击前往](http://47.106.243.172:8888/)
|
|
||||||
|
|
||||||
#### 项目介绍
|
|
||||||
|
|
||||||
novel-plus 是一个多端(PC、WAP)阅读,功能完善的原创文学 CMS
|
novel-plus 是一个多端(PC、WAP)阅读,功能完善的原创文学 CMS
|
||||||
系统。由前台门户系统、作家后台管理系统、平台后台管理系统和爬虫管理系统等多个子系统构成,包括小说推荐、作品检索、小说排行、小说阅读、小说评论、会员中心、作家专区等功能,支持自定义多模版、可拓展的多种小说内容存储方式(内置数据库分表存储和
|
系统。由前台门户系统、作家后台管理系统、平台后台管理系统和爬虫管理系统等多个子系统构成,包括小说推荐、作品检索、小说排行、小说阅读、小说评论、会员中心、作家专区等功能,支持自定义多模版、可拓展的多种小说内容存储方式(内置数据库分表存储和
|
||||||
TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数据、会员充值、订阅模式、新闻发布和实时统计报表。
|
TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数据、AI写作、会员充值、订阅模式、新闻发布和实时统计报表。
|
||||||
|
|
||||||
#### 项目结构
|
## 项目地址
|
||||||
|
|
||||||
|
- 学习版:[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
||||||
|
| [保姆级教程](https://docs.xxyopen.com)
|
||||||
|
- **应用版**:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus)
|
||||||
|
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
||||||
|
|
||||||
|
## 项目结构
|
||||||
|
|
||||||
```
|
```
|
||||||
novel-plus -- 父工程
|
novel-plus -- 父工程
|
||||||
├── novel-common -- 通用模块
|
├── novel-common -- 通用模块
|
||||||
├── novel-front -- 前台门户&作家后台管理子系统(可拆分)
|
├── novel-front -- 前台门户&作家后台
|
||||||
├── novel-crawl -- 爬虫管理子系统
|
├── novel-crawl -- 爬虫
|
||||||
├── novel-admin -- 平台后台管理子系统
|
├── novel-admin -- 管理后台
|
||||||
└── templates -- 前端模版
|
└── templates -- 前端模版
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 技术选型
|
## 技术选型
|
||||||
|
|
||||||
| 技术 | 说明
|
| 技术 | 说明
|
||||||
|---------------------| ---------------------------
|
|---------------------|---------------------
|
||||||
| Spring Boot | Spring 应用快速开发脚手架
|
| Spring Boot | Spring 应用快速开发脚手架
|
||||||
|
| Spring AI | Spring 官方 AI 框架
|
||||||
| MyBatis | 持久层 ORM 框架
|
| MyBatis | 持久层 ORM 框架
|
||||||
| MyBatis Dynamic SQL | Mybatis 动态 sql
|
| MyBatis Dynamic SQL | Mybatis 动态 sql
|
||||||
| PageHelper | MyBatis 分页插件
|
| PageHelper | MyBatis 分页插件
|
||||||
| MyBatisGenerator | 持久层代码生成插件
|
| MyBatis Generator | 持久层代码生成插件
|
||||||
| Sharding-Jdbc | 代码层分库分表中间件
|
| Sharding-JDBC | 代码层分库分表中间件
|
||||||
| JJWT | JWT 登录支持
|
| JJWT | JWT 登录支持
|
||||||
| SpringSecurity | 安全框架
|
| Spring Security | 安全框架
|
||||||
| Shiro | 安全框架
|
| Apache Shiro | 安全框架
|
||||||
| Ehcache | Java 进程内缓存框架(默认缓存)
|
| Redis | 缓存方案
|
||||||
| Redis | 分布式缓存(缓存替换方案,默认关闭,一行配置开启)
|
| Aliyun OSS | 阿里云对象存储服务(图片存储备选方案)
|
||||||
| Elasticsearch | 搜索引擎(搜索增强方案,默认关闭,一行配置开启)
|
|
||||||
| RabbitMQ | 消息队列(流量削峰,默认关闭,一行配置开启)
|
|
||||||
| Aliyun OSS | 阿里云对象存储服务(图片存储方式之一,一行配置即可切换)
|
|
||||||
| FastDFS | 开源轻量级分布式文件系统(图片存储方式之一,一行配置即可切换)
|
|
||||||
| Redisson | 实现分布式锁
|
|
||||||
| Lombok | 简化对象封装工具
|
| Lombok | 简化对象封装工具
|
||||||
| Docker | 应用容器引擎
|
| Docker | 应用容器引擎
|
||||||
| MySQL | 数据库服务
|
| MySQL | 数据库服务
|
||||||
| Thymeleaf | 模板引擎
|
| Thymeleaf | 模板引擎
|
||||||
| Layui | 前端 UI 框架
|
| Layui | 前端 UI 框架
|
||||||
|
|
||||||
#### 橙色主题模版截图
|
## 项目截图
|
||||||
|
|
||||||
##### PC站截图
|
### 绿色主题模版
|
||||||
|
|
||||||
1. 首页
|
[](https://www.xxyopen.com/images/green_novel.png)
|
||||||
|
[](https://www.xxyopen.com/images/resource/os/novel-plus/green3.png)
|
||||||
|
[](https://www.xxyopen.com/images/resource/os/novel-plus/green2.png)
|
||||||
|
|
||||||

|
## 演示视频
|
||||||
|
|
||||||
2. 分类索引页
|
https://www.bilibili.com/video/BV18e41197xs
|
||||||
|
|
||||||

|
## AI 功能
|
||||||
|
|
||||||
3. 搜索页
|
novel-plus 5.x 已集成 Spring 官方最新发布的 Spring AI 框架,并推出多项 AI 功能:
|
||||||
|
|
||||||

|
1. v5.0.0 版本在小说章节发布页面的文本编辑器中集成了多项智能编辑功能,包括 AI 扩写、缩写、续写及文本润色等。这些功能的设计灵感来源于百家号文章编辑器中的 AI 助手。
|
||||||
|
2. v5.1.0 版本在小说发布页面,新增 AI 生成封面图功能。若作家未上传自定义封面图,系统将根据小说信息自动生成封面图。
|
||||||
|
|
||||||

|
目前,AI 功能仍处于实验阶段,仅实现了基础的核心功能。我们非常重视用户的实际使用体验和反馈,未来将根据用户需求和使用情况,持续优化和调整该功能。如果用户反馈积极,我们计划进一步开发更高级的
|
||||||
|
AI 功能,例如自动生成有声小说、智能情节推荐等,以全面提升 novel-plus 的创作能力和用户体验。
|
||||||
|
|
||||||
4. 排行榜
|
我们将持续关注 AI 技术的发展,并致力于将其与小说创作场景深度融合,为用户带来更智能、更便捷的创作工具。
|
||||||
|
|
||||||

|
由于 DeepSeek 官方 API 目前不可用,novel-plus 项目默认使用的是第三方[硅基流动](https://cloud.siliconflow.cn/i/DOgMRH9S)
|
||||||
|
提供的 API,采用的 AI 模型有对话模型`deepseek-ai/DeepSeek-R1-Distill-Llama-8B`(DeepSeek-R1 的蒸馏版本,免费使用)和生图模型`Kwai-Kolors/Kolors`(快手 Kolors 团队开发的文本到图像生成模型,免费使用)。只需注册一个硅基流动账号,创建一个
|
||||||
|
API 密钥,并将其添加到 novel-plus 项目 novel-front 模块的 yaml 配置文件中,即可体验 novel-plus 项目的 AI 写作功能。
|
||||||
|
|
||||||
5. 详情页
|
```yaml
|
||||||
|
spring:
|
||||||
|
ai:
|
||||||
|
openai:
|
||||||
|
image:
|
||||||
|
enabled: true
|
||||||
|
base-url: https://api.siliconflow.cn
|
||||||
|
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||||
|
options:
|
||||||
|
model: Kwai-Kolors/Kolors
|
||||||
|
response_format: URL
|
||||||
|
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||||
|
base-url: https://api.siliconflow.cn
|
||||||
|
chat:
|
||||||
|
options:
|
||||||
|
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
||||||
|
```
|
||||||
|
|
||||||

|
> ⚠️ novel-plus 项目默认使用的都是免费 AI 模型,生成效果有限。如果对生成内容有更高的要求,建议选用付费的 AI 模型。
|
||||||
|
|
||||||
6. 阅读页
|
## 增值服务
|
||||||
|
|
||||||

|
👉 [了解详情](https://novel.xxyopen.com/service.htm)
|
||||||
|
|
||||||
7. 用户中心
|
## 微信公众号
|
||||||
|
|
||||||

|
发布最新更新动态、最新前端模版、最新爬虫规则、文档教程等。
|
||||||
|
|
||||||
8. 充值
|

|
||||||
|
|
||||||

|
## 赞赏支持
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
9. 作家专区
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
10. 购买
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
##### 手机站截图
|
|
||||||
|
|
||||||
1. 首页
|
|
||||||
|
|
||||||
<img src="https://s3.ax1x.com/2020/12/27/r5447n.jpg" alt="index" width="300" />
|
|
||||||
|
|
||||||
2. 小说列表页
|
|
||||||
|
|
||||||
<img src="https://s3.ax1x.com/2020/12/27/r55xKg.jpg" alt="微信图片_20190904181558" width="300" />
|
|
||||||
|
|
||||||
3. 小说详情页
|
|
||||||
|
|
||||||
<img src="https://s3.ax1x.com/2020/12/28/roZWOf.jpg" alt="QQ图片20191018161901" width="300" />
|
|
||||||
|
|
||||||
4. 小说阅读页
|
|
||||||
|
|
||||||
<img src="https://s3.ax1x.com/2020/12/27/r55Stx.jpg" alt="QQ图片20191018161901" width="300" />
|
|
||||||
|
|
||||||
##### 爬虫管理系统截图
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
##### 后台管理系统截图
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 深色主题模版截图
|
|
||||||
|
|
||||||
##### PC站截图
|
|
||||||
|
|
||||||
1. 首页
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
##### 手机站截图
|
|
||||||
|
|
||||||
1. 首页
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
4. 小说详情页
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
5. 目录页
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
5. 小说阅读页
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 蓝色主题模版截图(更新中)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 源码安装教程
|
|
||||||
|
|
||||||
- JDK 安装
|
|
||||||
|
|
||||||
建议[安装 JDK 8](https://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html)
|
|
||||||
|
|
||||||
- MySQL 安装:
|
|
||||||
|
|
||||||
1. [安装 MySQL 服务](https://dev.mysql.com/doc/refman/8.0/en/linux-installation.html)
|
|
||||||
2. 修改 MySQL`max_allowed_packet `配置(建议 100 M)
|
|
||||||
3. 新建数据库,设置编码为 utf8mb4
|
|
||||||
4. 执行 doc/sql/novel_plus.sql 脚本文件
|
|
||||||
|
|
||||||
- Maven 安装
|
|
||||||
|
|
||||||
[安装 Apache Maven](https://maven.apache.org/install.html)
|
|
||||||
|
|
||||||
- 源码打包
|
|
||||||
|
|
||||||
novel-plus 根目录下执行打包命令`mvn clean package -Dmaven.test.skip`
|
|
||||||
|
|
||||||
- 爬虫安装
|
|
||||||
|
|
||||||
1. 上传 novel-crawl/target/build/novel-crawl.zip 压缩包到 Linux 服务器的 novel-crawl 目录
|
|
||||||
2. 使用`unzip novel-crawl.zip`命令解压 novel-crawl.zip
|
|
||||||
3. 修改 `config/application-common-prod.yml` 文件中的数据库配置
|
|
||||||
4. 修改 `config/application-common-prod.yml` 文件中的管理员账号密码
|
|
||||||
5. 根据需要[设置爬虫的代理IP](https://github.com/201206030/novel-plus/wiki/%E7%88%AC%E8%99%AB%E7%A8%8B%E5%BA%8F-HTTP-%E4%BB%A3%E7%90%86%E8%AE%BE%E7%BD%AE)
|
|
||||||
6. novel-crawl 目录下使用`bin/novel-crawl.sh start`命令启动爬虫程序
|
|
||||||
7. 打开浏览器,默认`8083`端口访问
|
|
||||||
8. 选择已有或新增爬虫源(支持自定义爬虫规则),点击`开启`按钮,开始采集小说数据
|
|
||||||
9. novel-crawl 目录下使用`bin/novel-crawl.sh stop`命令停止爬虫程序
|
|
||||||
10. novel-crawl 目录下使用`bin/novel-crawl.sh restart`命令重启爬虫程序
|
|
||||||
11. novel-crawl 目录下使用`bin/novel-crawl.sh status`命令查看爬虫程序的运行状态
|
|
||||||
|
|
||||||
- 前台安装
|
|
||||||
|
|
||||||
1. 上传 novel-front/target/build/novel-front.zip 压缩包到 Linux 服务器的 novel-front 目录
|
|
||||||
2. 使用`unzip novel-front.zip`命令解压 novel-front.zip
|
|
||||||
3. 修改 `config/application-common-prod.yml` 文件中的数据库配置
|
|
||||||
4. 修改 `config/application-website.yml` 配置文件中的网站信息
|
|
||||||
5. novel-front 目录下使用`bin/novel-front.sh start`命令启动前台程序
|
|
||||||
6. 打开浏览器,默认`8085`端口访问
|
|
||||||
7. novel-front 目录下使用`bin/novel-front.sh stop`命令停止前台程序
|
|
||||||
8. novel-front 目录下使用`bin/novel-front.sh restart`命令重启前台程序
|
|
||||||
9. novel-front 目录下使用`bin/novel-front.sh status`命令查看前台程序的运行状态
|
|
||||||
|
|
||||||
- 后台安装
|
|
||||||
|
|
||||||
1. 上传 novel-admin/target/build/novel-admin.zip 压缩包到 Linux 服务器的 novel-admin 目录
|
|
||||||
2. 使用`unzip novel-admin.zip`命令解压 novel-admin.zip
|
|
||||||
3. 修改 `config/application-prod.yml` 文件中的数据库配置
|
|
||||||
4. novel-admin 目录下使用`bin/novel-admin.sh start`命令启动后台程序
|
|
||||||
5. 打开浏览器,默认`8088`端口访问
|
|
||||||
6. novel-admin 目录下使用`bin/novel-admin.sh stop`命令停止后台程序
|
|
||||||
7. novel-admin 目录下使用`bin/novel-admin.sh restart`命令重启后台程序
|
|
||||||
8. novel-admin 目录下使用`bin/novel-admin.sh status`命令查看后台程序的运行状态
|
|
||||||
|
|
||||||
**注:部分环境(如新版 Mac OS 系统)获取不到主机 IP,需要手动修改 hosts 文件,增加 IP-主机名(通过 hostname 命令查看主机名)的映射。**
|
|
||||||
|
|
||||||
#### 代码仓库
|
|
||||||
|
|
||||||
Github 仓库地址: https://github.com/201206030/novel-plus
|
|
||||||
|
|
||||||
Gitee 仓库地址: https://gitee.com/novel_dev_team/novel-plus
|
|
||||||
|
|
||||||
#### QQ 交流群
|
|
||||||
|
|
||||||
[点击前往官网查看](https://xiongxyang.gitee.io/service.htm)
|
|
||||||
|
|
||||||
#### 微信交流群
|
|
||||||
|
|
||||||
微信群二维码会过期,所以每周在公众号更新一次,请关注公众号“**xxyopen**”回复关键词“**微信群**”获取。
|
|
||||||
|
|
||||||
问问题的三要素
|
|
||||||
|
|
||||||
1. 说明背景,使用了哪个模块,要做什么?
|
|
||||||
|
|
||||||
2. 怎么输入或操作的得到了什么结果? 截图,日志
|
|
||||||
|
|
||||||
3. 哪里不明白或有什么疑问 ?
|
|
||||||
|
|
||||||
#### 微信公众号(发布最新更新资讯、最新前端模版、最新爬虫规则、技术文档等)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
#### 赞赏支持
|
|
||||||
|
|
||||||
开源项目不易,若此项目能得到你的青睐,那么你可以赞赏支持作者持续开发与维护。
|
开源项目不易,若此项目能得到你的青睐,那么你可以赞赏支持作者持续开发与维护。
|
||||||
|
|
||||||
- 服务器的费用也是一笔开销
|
- 服务器的费用也是一笔开销
|
||||||
- 为用户提供更好的开发环境
|
- 编写更完备的文档教程
|
||||||
|
- 发布更多前端模版和爬虫规则
|
||||||
- 一杯咖啡
|
- 一杯咖啡
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 免责声明
|
## 免责声明
|
||||||
|
|
||||||
本项目提供的爬虫工具仅用于采集项目初期的测试数据,请勿用于商业盈利。 用户使用本系统从事任何违法违规的事情,一切后果由用户自行承担,作者不承担任何责任。
|
本项目提供的爬虫工具仅用于采集项目初期的测试数据,请勿用于商业盈利。 用户使用本系统从事任何违法违规的事情,一切后果由用户自行承担,作者不承担任何责任。
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 411 KiB |
Before Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 263 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 461 KiB |
Before Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 12 KiB |
BIN
assets/jk.png
Before Width: | Height: | Size: 130 KiB |
Before Width: | Height: | Size: 36 KiB |
BIN
assets/jk_wc.png
Before Width: | Height: | Size: 82 KiB |
BIN
assets/login.png
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 310 KiB |
Before Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 223 KiB |
Before Width: | Height: | Size: 4.5 KiB |
BIN
assets/mini4.png
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 360 KiB |
Before Width: | Height: | Size: 357 KiB |
Before Width: | Height: | Size: 307 KiB |
Before Width: | Height: | Size: 929 KiB |
Before Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 77 KiB |
BIN
assets/精品小说楼.png
Before Width: | Height: | Size: 764 KiB |
Before Width: | Height: | Size: 1.1 MiB |
53
config/shardingsphere-jdbc.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
mode:
|
||||||
|
# 单机模式
|
||||||
|
type: Standalone
|
||||||
|
# 元数据持久化
|
||||||
|
repository:
|
||||||
|
# 数据库持久化
|
||||||
|
type: JDBC
|
||||||
|
|
||||||
|
# 数据源配置
|
||||||
|
dataSources:
|
||||||
|
ds_1:
|
||||||
|
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: test123456
|
||||||
|
ds_2:
|
||||||
|
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/information_schema?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: test123456
|
||||||
|
# 规则配置
|
||||||
|
rules:
|
||||||
|
- !SINGLE
|
||||||
|
tables:
|
||||||
|
- "*.*"
|
||||||
|
- !SHARDING
|
||||||
|
tables: # 数据分片规则配置
|
||||||
|
book_content:
|
||||||
|
# 分库策略,缺省表示使用默认分库策略
|
||||||
|
actualDataNodes: ds_${1}.book_content${0..9}
|
||||||
|
# 分表策略
|
||||||
|
tableStrategy:
|
||||||
|
standard:
|
||||||
|
# 分片列名称
|
||||||
|
shardingColumn: index_id
|
||||||
|
# 分片算法名称
|
||||||
|
shardingAlgorithmName: bookContentSharding
|
||||||
|
|
||||||
|
shardingAlgorithms:
|
||||||
|
bookContentSharding:
|
||||||
|
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
|
||||||
|
type: INLINE
|
||||||
|
props:
|
||||||
|
# 分片算法的行表达式
|
||||||
|
algorithm-expression: book_content${index_id % 10}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
props:
|
||||||
|
# 是否在日志中打印 SQL
|
||||||
|
sql-show: true
|
116
doc/api/api.md
@ -1,116 +0,0 @@
|
|||||||
|
|
||||||
<h1 class="curproject-name"> 小说精品屋-plus </h1>
|
|
||||||
小说精品屋-plus接口
|
|
||||||
|
|
||||||
|
|
||||||
# 作家模块
|
|
||||||
|
|
||||||
## 小说章节分页列表查询接口
|
|
||||||
<a id=小说章节分页列表查询接口> </a>
|
|
||||||
### 基本信息
|
|
||||||
|
|
||||||
**Path:** /book/queryIndexList
|
|
||||||
|
|
||||||
**Method:** GET
|
|
||||||
|
|
||||||
**接口描述:**
|
|
||||||
<p>作家后台章节管理页面需要请求该接口获取小说章节分页列表信息</p>
|
|
||||||
|
|
||||||
|
|
||||||
### 请求参数
|
|
||||||
**Query**
|
|
||||||
|
|
||||||
| 参数名称 | 是否必须 | 示例 | 备注 |
|
|
||||||
| ------------ | ------------ | ------------ | ------------ |
|
|
||||||
| bookId | 是 | 1334337530296893441 | 小说ID |
|
|
||||||
| curr | 否 | 1 | 查询页码,默认1 |
|
|
||||||
| limit | 否 | 5 | 分页大小,默认5 |
|
|
||||||
|
|
||||||
### 返回数据
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead class="ant-table-thead">
|
|
||||||
<tr>
|
|
||||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
|
||||||
</tr>
|
|
||||||
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗,200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr><tr key=0-2><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> data</span></td><td key=1><span>object</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应数据</span></td><td key=5></td></tr><tr key=0-2-0><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> total</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">总数量</span></td><td key=5></td></tr><tr key=0-2-1><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> list</span></td><td key=1><span>object []</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节数据集合</span></td><td key=5><p key=3><span style="font-weight: '700'">item 类型: </span><span>object</span></p></td></tr><tr key=0-2-1-0><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> id</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节ID</span></td><td key=5></td></tr><tr key=0-2-1-1><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> bookId</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">小说ID</span></td><td key=5></td></tr><tr key=0-2-1-2><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> indexName</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节名</span></td><td key=5></td></tr><tr key=0-2-1-3><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> isVip</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">是否收费,1:收费,0:免费</span></td><td key=5></td></tr><tr key=0-2-1-4><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> updateTime</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">更新时间</span></td><td key=5></td></tr><tr key=0-2-2><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> pageNum</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">页码</span></td><td key=5></td></tr><tr key=0-2-3><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> pageSize</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">分页大小</span></td><td key=5></td></tr><tr key=0-2-4><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> size</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">当前页数量</span></td><td key=5></td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
## 小说章节删除接口
|
|
||||||
<a id=小说章节删除接口> </a>
|
|
||||||
### 基本信息
|
|
||||||
|
|
||||||
**Path:** /author/deleteIndex/{indexId}
|
|
||||||
|
|
||||||
**Method:** DELETE
|
|
||||||
|
|
||||||
**接口描述:**
|
|
||||||
<p>作家后台章节管理页面点击删除按钮请求该接口删除小说章节内容</p>
|
|
||||||
|
|
||||||
|
|
||||||
### 请求参数
|
|
||||||
**Headers**
|
|
||||||
|
|
||||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
|
||||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
|
||||||
| Content-Type | application/x-www-form-urlencoded | 是 | | |
|
|
||||||
| Authorization | | 是 | eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MDgzNDg0NzksInN1YiI6IntcImlkXCI6MTI1NTA2MDMyODMyMjAyNzUyMCxcInVzZXJuYW1lXCI6XCIxMzU2MDQyMTMyNFwiLFwibmlja05hbWVcIjpcIjEzNTYwNDIxMzI0XCJ9IiwiY3JlYXRlZCI6MTYwNzc0MzY3OTkxM30.0qhwis_zPb6t8wGNejMhDZ2iHCL9Tgh2UHd1gcQBCp8t6RW3ggSwtfo4l_RgMT_v8jOkLW91GzTVWlNnTE6LCA | 认证JWT,请求登录接口成功后返回 |
|
|
||||||
**路径参数**
|
|
||||||
|
|
||||||
| 参数名称 | 示例 | 备注 |
|
|
||||||
| ------------ | ------------ | ------------ |
|
|
||||||
| indexId | 1337603246936645632 | 章节ID |
|
|
||||||
|
|
||||||
### 返回数据
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead class="ant-table-thead">
|
|
||||||
<tr>
|
|
||||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
|
||||||
</tr>
|
|
||||||
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗,200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
## 小说章节发布接口
|
|
||||||
<a id=小说章节发布接口> </a>
|
|
||||||
### 基本信息
|
|
||||||
|
|
||||||
**Path:** /author/addBookContent
|
|
||||||
|
|
||||||
**Method:** POST
|
|
||||||
|
|
||||||
**接口描述:**
|
|
||||||
<p>作家后台章节发布页面点击提交按钮请求该接口新增小说章节内容</p>
|
|
||||||
|
|
||||||
|
|
||||||
### 请求参数
|
|
||||||
**Headers**
|
|
||||||
|
|
||||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
|
||||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
|
||||||
| Content-Type | application/x-www-form-urlencoded | 是 | | |
|
|
||||||
| Authorization | | 是 | eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MDgzNDg0NzksInN1YiI6IntcImlkXCI6MTI1NTA2MDMyODMyMjAyNzUyMCxcInVzZXJuYW1lXCI6XCIxMzU2MDQyMTMyNFwiLFwibmlja05hbWVcIjpcIjEzNTYwNDIxMzI0XCJ9IiwiY3JlYXRlZCI6MTYwNzc0MzY3OTkxM30.0qhwis_zPb6t8wGNejMhDZ2iHCL9Tgh2UHd1gcQBCp8t6RW3ggSwtfo4l_RgMT_v8jOkLW91GzTVWlNnTE6LCA | 认证JWT,请求登录接口成功后返回 |
|
|
||||||
**Body**
|
|
||||||
|
|
||||||
| 参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
|
|
||||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
|
||||||
| bookId | text | 是 | 1334337530296893441 | 小说ID |
|
|
||||||
| indexName | text | 是 | 第六章未婚妻(下) | 章节名 |
|
|
||||||
| content | text | 是 | 开始之时,李七夜还是生疏无比,那怕他对于刀术的所有奥义了然于胸,但是,他出刀之时依然会颤抖,无法达到妙及巅毫的要求。 | 章节内容 |
|
|
||||||
| isVip | text | 是 | 1 | 是否收费,1:收费,0:免费 |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 返回数据
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead class="ant-table-thead">
|
|
||||||
<tr>
|
|
||||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
|
||||||
</tr>
|
|
||||||
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗,200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
121
doc/sql/20230413.sql
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
CREATE TABLE `website_info`
|
||||||
|
(
|
||||||
|
id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
name varchar(50) NOT NULL COMMENT '网站名',
|
||||||
|
domain varchar(50) NOT NULL COMMENT '网站域名',
|
||||||
|
keyword varchar(50) NOT NULL COMMENT 'SEO关键词',
|
||||||
|
description varchar(512) NOT NULL COMMENT '网站描述',
|
||||||
|
qq varchar(20) NOT NULL COMMENT '站长QQ',
|
||||||
|
logo varchar(200) NOT NULL COMMENT '网站logo图片(默认)',
|
||||||
|
logo_dark varchar(200) NOT NULL COMMENT '网站logo图片(深色)',
|
||||||
|
create_time datetime null comment '创建时间',
|
||||||
|
create_user_id bigint null comment '创建人ID',
|
||||||
|
update_time datetime null comment '更新时间',
|
||||||
|
update_user_id bigint null comment '更新人ID',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='网站信息表';
|
||||||
|
|
||||||
|
INSERT INTO website_info (id, name, domain, keyword, description, qq, logo, logo_dark, create_time, create_user_id,
|
||||||
|
update_time, update_user_id)
|
||||||
|
VALUES (1, '小说精品屋', 'www.xxyopen.com', '小说精品屋,小说,小说CMS,原创文学系统,开源小说系统,免费小说建站程序',
|
||||||
|
'小说精品屋是一个多端(PC、WAP)阅读、功能完善的原创文学CMS系统,由前台门户系统、作家后台管理系统、平台后台管理系统、爬虫管理系统等多个子系统构成,支持会员充值、订阅模式、新闻发布和实时统计报表等功能,新书自动入库,老书自动更新。',
|
||||||
|
'1179705413', 'https://youdoc.gitee.io/resource/images/logo/logo.png',
|
||||||
|
'https://youdoc.gitee.io/resource/images/logo/logo_white.png', null, null, null, null);
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
|
||||||
|
VALUES (300, 0, '网站管理', '', '', 0, 'fa fa-television', 6, null, null);
|
||||||
|
|
||||||
|
INSERT
|
||||||
|
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (301, 300, '网站信息', 'novel/websiteInfo', 'novel:websiteInfo:websiteInfo', '1', 'fa', '6');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 300);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 301);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (310, 300, '友情链接', 'novel/friendLink', 'novel:friendLink:friendLink', '1', 'fa', '16');
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (311, 310, '查看', null, 'novel:friendLink:detail', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (312, 310, '新增', null, 'novel:friendLink:add', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (313, 310, '修改', null, 'novel:friendLink:edit', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (314, 310, '删除', null, 'novel:friendLink:remove', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (315, 310, '批量删除', null, 'novel:friendLink:batchRemove', '2', null, '6');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 310);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 311);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 312);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 313);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 314);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 315);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
|
||||||
|
VALUES (400, 0, '会员管理', '', '', 0, 'fa fa-vcard', 9, null, null);
|
||||||
|
|
||||||
|
INSERT
|
||||||
|
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (401, 400, '会员列表', 'novel/user', 'novel:user:user', '1', 'fa', '6');
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 400);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 401);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
|
||||||
|
VALUES (500, 0, '订单管理', '', '', 0, 'fa fa-money', 19, null, null);
|
||||||
|
|
||||||
|
INSERT
|
||||||
|
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (501, 500, '订单列表', 'novel/pay', 'novel:pay:pay', '1', 'fa', '6');
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 500);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 501);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_menu (menu_id, parent_id, name, url, perms, type, icon, order_num, gmt_create, gmt_modified)
|
||||||
|
VALUES (600, 0, '小说管理', '', '', 0, 'fa fa-book', 15, null, null);
|
||||||
|
|
||||||
|
INSERT
|
||||||
|
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (601, 600, '小说列表', 'novel/book', 'novel:book:book', '1', 'fa', '6');
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 600);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 601);
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (602, 601, '删除', null, 'novel:book:remove', '2', null, '6');
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 602);
|
||||||
|
|
||||||
|
INSERT
|
||||||
|
INTO `sys_menu`(`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (603, 600, '评论管理', 'novel/bookComment', 'novel:bookComment:bookComment', '1', 'fa', '10');
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 603);
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (604, 603, '删除', null, 'novel:bookComment:remove', '2', null, '6');
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 604);
|
51
doc/sql/20230418.sql
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
INSERT INTO sys_dict (name, value, type, description, sort, parent_id, create_by, create_date, update_by,
|
||||||
|
update_date, remarks, del_flag)
|
||||||
|
VALUES ('轮播图', '0', 'book_rec_type', '小说推荐类型', 0, null, null, null, null, null, '', null);
|
||||||
|
INSERT INTO sys_dict (name, value, type, description, sort, parent_id, create_by, create_date, update_by,
|
||||||
|
update_date, remarks, del_flag)
|
||||||
|
VALUES ('顶部小说栏', '1', 'book_rec_type', '小说推荐类型', 1, null, null, null, null, null, '', null);
|
||||||
|
INSERT INTO sys_dict (name, value, type, description, sort, parent_id, create_by, create_date, update_by,
|
||||||
|
update_date, remarks, del_flag)
|
||||||
|
VALUES ('本周强推', '2', 'book_rec_type', '小说推荐类型', 2, null, null, null, null, null, '', null);
|
||||||
|
INSERT INTO sys_dict (name, value, type, description, sort, parent_id, create_by, create_date, update_by,
|
||||||
|
update_date, remarks, del_flag)
|
||||||
|
VALUES ('热门推荐', '3', 'book_rec_type', '小说推荐类型', 3, null, null, null, null, null, '', null);
|
||||||
|
INSERT INTO sys_dict (name, value, type, description, sort, parent_id, create_by, create_date, update_by,
|
||||||
|
update_date, remarks, del_flag)
|
||||||
|
VALUES ('精品推荐', '4', 'book_rec_type', '小说推荐类型', 4, null, null, null, null, null, '', null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (320, '300', '小说推荐', 'novel/bookSetting', 'novel:bookSetting:bookSetting', '1', 'fa', '6');
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (321, '320', '查看', null, 'novel:bookSetting:detail', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (322, '320', '新增', null, 'novel:bookSetting:add', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (323, '320', '修改', null, 'novel:bookSetting:edit', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (324, '320', '删除', null, 'novel:bookSetting:remove', '2', null, '6');
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (325, '320', '批量删除', null, 'novel:bookSetting:batchRemove', '2', null, '6');
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 320);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 321);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 322);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 323);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 324);
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 325);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (410, '400', '会员反馈', 'novel/userFeedback', 'novel:userFeedback:userFeedback', '1', 'fa', '16');
|
||||||
|
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 410);
|
4
doc/sql/20230508.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
|
||||||
|
VALUES (305, '301', '修改', null, 'novel:websiteInfo:edit', '2', null, '6');
|
||||||
|
INSERT INTO sys_role_menu (role_id, menu_id)
|
||||||
|
VALUES (1, 305);
|
3
doc/sql/20240512.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
update crawl_source
|
||||||
|
set crawl_rule = replace(crawl_rule, 'ibiquge.net', 'ibiquzw.org')
|
||||||
|
where id = 16;
|
44
doc/sql/20250317.sql
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
INSERT INTO crawl_source (source_name, crawl_rule, source_status, create_time, update_time)
|
||||||
|
VALUES ('香书小说网', '{
|
||||||
|
"bookListUrl": "http://www.xbiqugu.la/fenlei/{catId}_{page}.html",
|
||||||
|
"catIdRule": {
|
||||||
|
"catId1": "1",
|
||||||
|
"catId2": "2",
|
||||||
|
"catId3": "3",
|
||||||
|
"catId4": "4",
|
||||||
|
"catId5": "6",
|
||||||
|
"catId6": "5"
|
||||||
|
},
|
||||||
|
"bookIdPatten": "<a\\\\s+href=\\"http://www.xbiqugu.la/(\\\\d+/\\\\d+)/\\"\\\\s+target=\\"_blank\\">",
|
||||||
|
"pagePatten": "<em\\\\s+id=\\"pagestats\\">(\\\\d+)/\\\\d+</em>",
|
||||||
|
"totalPagePatten": "<em\\\\s+id=\\"pagestats\\">\\\\d+/(\\\\d+)</em>",
|
||||||
|
"bookDetailUrl": "http://www.xbiqugu.la/{bookId}/",
|
||||||
|
"bookNamePatten": "<h1>([^/]+)</h1>",
|
||||||
|
"authorNamePatten": "者:([^/]+)</p>",
|
||||||
|
"picUrlPatten": "src=\\"(http://www.xbiqugu.la/files/article/image/\\\\d+/\\\\d+/\\\\d+s\\\\.jpg)\\"",
|
||||||
|
"bookStatusRule": {},
|
||||||
|
"descStart": "<div id=\\"intro\\">",
|
||||||
|
"descEnd": "</div>",
|
||||||
|
"upadateTimePatten": "<p>最后更新:(\\\\d+-\\\\d+-\\\\d+\\\\s\\\\d+:\\\\d+:\\\\d+)</p>",
|
||||||
|
"upadateTimeFormatPatten": "yyyy-MM-dd HH:mm:ss",
|
||||||
|
"bookIndexUrl": "http://www.xbiqugu.la/{bookId}/",
|
||||||
|
"indexIdPatten": "<a\\\\s+href=''/\\\\d+/\\\\d+/(\\\\d+)\\\\.html''\\\\s+>[^/]+</a>",
|
||||||
|
"indexNamePatten": "<a\\\\s+href=''/\\\\d+/\\\\d+/\\\\d+\\\\.html''\\\\s+>([^/]+)</a>",
|
||||||
|
"bookContentUrl": "http://www.xbiqugu.la/{bookId}/{indexId}.html",
|
||||||
|
"contentStart": "<div id=\\"content\\">",
|
||||||
|
"contentEnd": "<p>",
|
||||||
|
"filterContent":"<div\\\\s+id=\\"content_tip\\">\\\\s*<b>([^/]+)</b>\\\\s*</div>"
|
||||||
|
}', 0, '2024-06-01 10:11:39', '2024-06-01 10:11:39');
|
||||||
|
|
||||||
|
|
||||||
|
update crawl_source
|
||||||
|
set crawl_rule = replace(crawl_rule, 'ibiquzw.org', 'biquxs.info')
|
||||||
|
where id = 16;
|
||||||
|
|
||||||
|
delete
|
||||||
|
from sys_menu
|
||||||
|
where menu_id = 104;
|
||||||
|
|
||||||
|
delete
|
||||||
|
from sys_menu
|
||||||
|
where menu_id = 57;
|
2
doc/sql/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM mysql:8.0
|
||||||
|
COPY novel_plus.sql /docker-entrypoint-initdb.d/init.sql
|
@ -1,6 +0,0 @@
|
|||||||
FROM java:8
|
|
||||||
ADD novel-admin-1.0.0.jar /root
|
|
||||||
ENV dburl=""
|
|
||||||
ENV username=""
|
|
||||||
ENV password=""
|
|
||||||
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -jar /root/novel-admin-1.0.0.jar"]
|
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel-admin</artifactId>
|
<artifactId>novel-admin</artifactId>
|
||||||
<version>3.6.2</version>
|
<version>5.1.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>novel-admin</name>
|
<name>novel-admin</name>
|
||||||
@ -14,16 +14,14 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.0.1.RELEASE</version>
|
<version>2.7.18</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<java.version>21</java.version>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
<activiti.version>5.22.0</activiti.version>
|
<shardingsphere-jdbc.version>5.5.1</shardingsphere-jdbc.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -58,16 +56,16 @@
|
|||||||
<groupId>net.sourceforge.nekohtml</groupId>
|
<groupId>net.sourceforge.nekohtml</groupId>
|
||||||
<artifactId>nekohtml</artifactId>
|
<artifactId>nekohtml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 请求参数校验相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.validator</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--mybatis -->
|
<!--mybatis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>8.0.11</version>
|
<version>8.0.29</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis</artifactId>
|
|
||||||
<version>3.4.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -75,18 +73,7 @@
|
|||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>1.1.1</version>
|
<version>1.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--druid -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid</artifactId>
|
|
||||||
<version>1.0.28</version>
|
|
||||||
</dependency>
|
|
||||||
<!--commons -->
|
<!--commons -->
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-configuration</groupId>
|
<groupId>commons-configuration</groupId>
|
||||||
<artifactId>commons-configuration</artifactId>
|
<artifactId>commons-configuration</artifactId>
|
||||||
@ -95,18 +82,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.9.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--shiro -->
|
<!--shiro -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-core</artifactId>
|
<artifactId>shiro-core</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-spring</artifactId>
|
<artifactId>shiro-spring</artifactId>
|
||||||
<version>1.7.0</version>
|
<version>1.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- shiro ehcache -->
|
<!-- shiro ehcache -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -118,7 +105,7 @@
|
|||||||
<artifactId>ehcache-core</artifactId>
|
<artifactId>ehcache-core</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
<version>1.4.0</version>
|
<version>1.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.theborakompanioni</groupId>
|
<groupId>com.github.theborakompanioni</groupId>
|
||||||
@ -129,13 +116,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.31</version>
|
<version>1.2.83</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--velocity代码生成使用模板 -->
|
<!--velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity</artifactId>
|
<artifactId>velocity</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>-->
|
<!--<dependency>-->
|
||||||
<!--<groupId>org.springframework.boot</groupId>-->
|
<!--<groupId>org.springframework.boot</groupId>-->
|
||||||
@ -164,6 +157,12 @@
|
|||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
<version>2.6.1</version>
|
<version>2.6.1</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
@ -193,16 +192,29 @@
|
|||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-text</artifactId>
|
<artifactId>commons-text</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.4</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- ehchache -->
|
<!-- ShardingSphere-JDBC -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.apache.shardingsphere</groupId>
|
||||||
<artifactId>spring-boot-starter-cache</artifactId>
|
<artifactId>shardingsphere-jdbc</artifactId>
|
||||||
|
<version>${shardingsphere-jdbc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.ehcache</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>ehcache</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--war包部署需要-->
|
<!--war包部署需要-->
|
||||||
@ -286,6 +298,9 @@
|
|||||||
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
|
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
|
||||||
<zipfileset filemode="755" dir='${project.build.directory}/build/'/>
|
<zipfileset filemode="755" dir='${project.build.directory}/build/'/>
|
||||||
</zip>
|
</zip>
|
||||||
|
|
||||||
|
<copy file="${basedir}/src/main/build/docker/Dockerfile"
|
||||||
|
tofile="${project.build.directory}/build/Dockerfile"/>
|
||||||
</tasks>
|
</tasks>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
@ -293,16 +308,59 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<!--<distributionManagement>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>nexus_release</id>
|
<id>ali</id>
|
||||||
<name>release</name>
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
<url>http://47.106.243.172:8081/nexus/content/repositories/releases/</url>
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
<snapshotRepository>
|
</repositories>
|
||||||
<id>nexus_snapshots</id>
|
<pluginRepositories>
|
||||||
<name>snapshots</name>
|
<pluginRepository>
|
||||||
<url>http://47.106.243.172:8081/nexus/content/repositories/snapshots/</url>
|
<id>ali-plugin</id>
|
||||||
</snapshotRepository>
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
</distributionManagement>-->
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<!-- 定义一个用于切换到中央仓库的profile -->
|
||||||
|
<id>central-repo</id>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>central</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>central-plugin</id>
|
||||||
|
<url>https://repo.maven.apache.org/maven2/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#端口号
|
|
||||||
server:
|
|
||||||
port: 8088
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
|
||||||
username: root
|
|
||||||
password: test123456
|
|
||||||
|
|
||||||
|
|
9
novel-admin/src/main/build/config/application.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#端口号
|
||||||
|
server:
|
||||||
|
port: 8088
|
||||||
|
spring:
|
||||||
|
redis:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
password: test123456
|
||||||
|
|
47
novel-admin/src/main/build/config/shardingsphere-jdbc.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
mode:
|
||||||
|
# 单机模式
|
||||||
|
type: Standalone
|
||||||
|
# 元数据持久化
|
||||||
|
repository:
|
||||||
|
# 数据库持久化
|
||||||
|
type: JDBC
|
||||||
|
|
||||||
|
# 数据源配置
|
||||||
|
dataSources:
|
||||||
|
ds_1:
|
||||||
|
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: test123456
|
||||||
|
# 规则配置
|
||||||
|
rules:
|
||||||
|
- !SINGLE
|
||||||
|
tables:
|
||||||
|
- "*.*"
|
||||||
|
- !SHARDING
|
||||||
|
tables: # 数据分片规则配置
|
||||||
|
book_content:
|
||||||
|
# 分库策略,缺省表示使用默认分库策略
|
||||||
|
actualDataNodes: ds_${1}.book_content${0..9}
|
||||||
|
# 分表策略
|
||||||
|
tableStrategy:
|
||||||
|
standard:
|
||||||
|
# 分片列名称
|
||||||
|
shardingColumn: index_id
|
||||||
|
# 分片算法名称
|
||||||
|
shardingAlgorithmName: bookContentSharding
|
||||||
|
|
||||||
|
shardingAlgorithms:
|
||||||
|
bookContentSharding:
|
||||||
|
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
|
||||||
|
type: INLINE
|
||||||
|
props:
|
||||||
|
# 分片算法的行表达式
|
||||||
|
algorithm-expression: book_content${index_id % 10}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
props:
|
||||||
|
# 是否在日志中打印 SQL
|
||||||
|
sql-show: true
|
9
novel-admin/src/main/build/docker/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM openjdk:8
|
||||||
|
ADD novel-admin.jar /root
|
||||||
|
ENV dburl=""
|
||||||
|
ENV username=""
|
||||||
|
ENV password=""
|
||||||
|
ENV redishost = ""
|
||||||
|
ENV redisport = ""
|
||||||
|
ENV redispwd = ""
|
||||||
|
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -Dspring.redis.host=${redishost} -Dspring.redis.port=${redisport} -Dspring.redis.password=${redispwd} -jar /root/novel-admin.jar"]
|
@ -11,27 +11,37 @@ import org.springframework.context.ApplicationContext;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@ServletComponentScan
|
@ServletComponentScan
|
||||||
@MapperScan("com.java2nb.*.dao")
|
@MapperScan("com.java2nb.*.dao")
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {
|
||||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||||
})
|
})
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AdminApplication {
|
public class AdminApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
public CommandLineRunner commandLineRunner(ApplicationContext ctx, DataSource dataSource) {
|
||||||
return args -> {
|
return args -> {
|
||||||
log.info("项目启动啦,访问路径:{}", "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment().getProperty("server.port"));
|
log.info("创建连接池...");
|
||||||
|
try (Connection connection = dataSource.getConnection()) {
|
||||||
|
log.info("连接池已创建.");
|
||||||
|
log.info("数据库:{}", connection.getMetaData().getDatabaseProductName());
|
||||||
|
log.info("数据库版本:{}", connection.getMetaData().getDatabaseProductVersion());
|
||||||
|
}
|
||||||
|
log.info("项目启动啦,访问路径:{}",
|
||||||
|
"http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment()
|
||||||
|
.getProperty("server.port"));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
package com.java2nb.common.aspect;
|
package com.java2nb.common.aspect;
|
||||||
|
|
||||||
import com.java2nb.common.utils.HttpContextUtils;
|
import com.java2nb.common.utils.IPUtils;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.*;
|
import org.aspectj.lang.annotation.*;
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import sun.net.util.IPAddressUtil;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Aspect
|
@Aspect
|
||||||
@ -37,11 +34,10 @@ public class WebLogAspect {
|
|||||||
logger.info("请求地址 : " + request.getRequestURL().toString());
|
logger.info("请求地址 : " + request.getRequestURL().toString());
|
||||||
logger.info("HTTP METHOD : " + request.getMethod());
|
logger.info("HTTP METHOD : " + request.getMethod());
|
||||||
// 获取真实的ip地址
|
// 获取真实的ip地址
|
||||||
//logger.info("IP : " + IPAddressUtil.getClientIpAddress(request));
|
logger.info("IP : " + IPUtils.getIpAddr(request));
|
||||||
logger.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "."
|
logger.info("CLASS_METHOD : " + joinPoint.getSignature().getDeclaringTypeName() + "."
|
||||||
+ joinPoint.getSignature().getName());
|
+ joinPoint.getSignature().getName());
|
||||||
logger.info("参数 : " + Arrays.toString(joinPoint.getArgs()));
|
logger.info("参数 : " + Arrays.toString(joinPoint.getArgs()));
|
||||||
// loggger.info("参数 : " + joinPoint.getArgs());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.java2nb.common.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 11797
|
||||||
|
*/
|
||||||
|
public interface CacheKey {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页小说设置
|
||||||
|
*/
|
||||||
|
String INDEX_BOOK_SETTINGS_KEY = "indexBookSettingsKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页新闻
|
||||||
|
*/
|
||||||
|
String INDEX_NEWS_KEY = "indexNewsKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页点击榜单
|
||||||
|
*/
|
||||||
|
String INDEX_CLICK_BANK_BOOK_KEY = "indexClickBankBookKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页友情链接
|
||||||
|
*/
|
||||||
|
String INDEX_LINK_KEY = "indexLinkKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页新书榜单
|
||||||
|
*/
|
||||||
|
String INDEX_NEW_BOOK_KEY = "indexNewBookKey";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页更新榜单
|
||||||
|
*/
|
||||||
|
String INDEX_UPDATE_BOOK_KEY = "indexUpdateBookKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板目录保存key
|
||||||
|
*/
|
||||||
|
String TEMPLATE_DIR_KEY = "templateDirKey";
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正在运行的爬虫线程存储KEY前缀
|
||||||
|
*/
|
||||||
|
String RUNNING_CRAWL_THREAD_KEY_PREFIX = "runningCrawlTreadDataKeyPrefix";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一次搜索引擎更新的时间
|
||||||
|
*/
|
||||||
|
String ES_LAST_UPDATE_TIME = "esLastUpdateTime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索引擎转换锁
|
||||||
|
*/
|
||||||
|
String ES_TRANS_LOCK = "esTransLock";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上一次搜索引擎是否更新过小说点击量
|
||||||
|
*/
|
||||||
|
String ES_IS_UPDATE_VISIT = "esIsUpdateVisit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累积的小说点击量
|
||||||
|
*/
|
||||||
|
String BOOK_ADD_VISIT_COUNT = "bookAddVisitCount";
|
||||||
|
/**
|
||||||
|
* 测试爬虫规则缓存
|
||||||
|
*/
|
||||||
|
String BOOK_TEST_PARSE = "testParse";
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.java2nb.common.config;
|
package com.java2nb.common.config;
|
||||||
|
|
||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
//演示系统账户
|
//演示系统账户
|
||||||
public static String DEMO_ACCOUNT = "test";
|
public static String DEMO_ACCOUNT = "test";
|
||||||
//自动去除表前缀
|
//自动去除表前缀
|
||||||
@ -16,9 +17,11 @@ public class Constant {
|
|||||||
//部门根节点id
|
//部门根节点id
|
||||||
public static Long DEPT_ROOT_ID = 0l;
|
public static Long DEPT_ROOT_ID = 0l;
|
||||||
//缓存方式
|
//缓存方式
|
||||||
public static String CACHE_TYPE_REDIS ="redis";
|
public static String CACHE_TYPE_REDIS = "redis";
|
||||||
|
|
||||||
public static String LOG_ERROR = "error";
|
public static String LOG_ERROR = "error";
|
||||||
|
|
||||||
|
public static final String UPLOAD_FILES_PREFIX = "/files/";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,132 +0,0 @@
|
|||||||
package com.java2nb.common.config;
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import com.alibaba.druid.support.http.StatViewServlet;
|
|
||||||
import com.alibaba.druid.support.http.WebStatFilter;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
||||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by PrimaryKey on 17/2/4.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("AlibabaRemoveCommentedCode")
|
|
||||||
@Configuration
|
|
||||||
public class DruidDBConfig {
|
|
||||||
private Logger logger = LoggerFactory.getLogger(DruidDBConfig.class);
|
|
||||||
@Value("${spring.datasource.url}")
|
|
||||||
private String dbUrl;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.username}")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.password}")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.driverClassName}")
|
|
||||||
private String driverClassName;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.initialSize}")
|
|
||||||
private int initialSize;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.minIdle}")
|
|
||||||
private int minIdle;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.maxActive}")
|
|
||||||
private int maxActive;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.maxWait}")
|
|
||||||
private int maxWait;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
|
|
||||||
private int timeBetweenEvictionRunsMillis;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.minEvictableIdleTimeMillis}")
|
|
||||||
private int minEvictableIdleTimeMillis;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.validationQuery}")
|
|
||||||
private String validationQuery;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.testWhileIdle}")
|
|
||||||
private boolean testWhileIdle;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.testOnBorrow}")
|
|
||||||
private boolean testOnBorrow;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.testOnReturn}")
|
|
||||||
private boolean testOnReturn;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.poolPreparedStatements}")
|
|
||||||
private boolean poolPreparedStatements;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
|
|
||||||
private int maxPoolPreparedStatementPerConnectionSize;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.filters}")
|
|
||||||
private String filters;
|
|
||||||
|
|
||||||
@Value("{spring.datasource.connectionProperties}")
|
|
||||||
private String connectionProperties;
|
|
||||||
|
|
||||||
@Bean(initMethod = "init", destroyMethod = "close") //声明其为Bean实例
|
|
||||||
@Primary //在同样的DataSource中,首先使用被标注的DataSource
|
|
||||||
public DataSource dataSource() {
|
|
||||||
DruidDataSource datasource = new DruidDataSource();
|
|
||||||
|
|
||||||
datasource.setUrl(this.dbUrl);
|
|
||||||
datasource.setUsername(username);
|
|
||||||
datasource.setPassword(password);
|
|
||||||
datasource.setDriverClassName(driverClassName);
|
|
||||||
|
|
||||||
//configuration
|
|
||||||
datasource.setInitialSize(initialSize);
|
|
||||||
datasource.setMinIdle(minIdle);
|
|
||||||
datasource.setMaxActive(maxActive);
|
|
||||||
datasource.setMaxWait(maxWait);
|
|
||||||
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
|
||||||
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
|
||||||
datasource.setValidationQuery(validationQuery);
|
|
||||||
datasource.setTestWhileIdle(testWhileIdle);
|
|
||||||
datasource.setTestOnBorrow(testOnBorrow);
|
|
||||||
datasource.setTestOnReturn(testOnReturn);
|
|
||||||
datasource.setPoolPreparedStatements(poolPreparedStatements);
|
|
||||||
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
|
|
||||||
try {
|
|
||||||
datasource.setFilters(filters);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
logger.error("druid configuration initialization filter", e);
|
|
||||||
}
|
|
||||||
datasource.setConnectionProperties(connectionProperties);
|
|
||||||
|
|
||||||
return datasource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ServletRegistrationBean druidServlet() {
|
|
||||||
ServletRegistrationBean reg = new ServletRegistrationBean();
|
|
||||||
reg.setServlet(new StatViewServlet());
|
|
||||||
reg.addUrlMappings("/druid/*");
|
|
||||||
reg.addInitParameter("allow", ""); //白名单
|
|
||||||
return reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean public FilterRegistrationBean filterRegistrationBean() {
|
|
||||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
|
||||||
filterRegistrationBean.setFilter(new WebStatFilter());
|
|
||||||
filterRegistrationBean.addUrlPatterns("/*");
|
|
||||||
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
|
|
||||||
filterRegistrationBean.addInitParameter("profileEnable", "true");
|
|
||||||
filterRegistrationBean.addInitParameter("principalCookieName","USER_COOKIE");
|
|
||||||
filterRegistrationBean.addInitParameter("principalSessionName","USER_SESSION");
|
|
||||||
filterRegistrationBean.addInitParameter("DruidWebStatFilter","/*");
|
|
||||||
return filterRegistrationBean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
|||||||
package com.java2nb.common.config;
|
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|
||||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class RedisConfig {
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
|
||||||
|
|
||||||
|
|
||||||
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
|
|
||||||
|
|
||||||
|
|
||||||
template.setConnectionFactory(factory);
|
|
||||||
|
|
||||||
|
|
||||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
|
||||||
|
|
||||||
|
|
||||||
ObjectMapper om = new ObjectMapper();
|
|
||||||
|
|
||||||
|
|
||||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
|
||||||
|
|
||||||
|
|
||||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
|
||||||
|
|
||||||
|
|
||||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
|
||||||
|
|
||||||
|
|
||||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
|
||||||
|
|
||||||
|
|
||||||
// key采用String的序列化方式
|
|
||||||
|
|
||||||
|
|
||||||
template.setKeySerializer(stringRedisSerializer);
|
|
||||||
|
|
||||||
|
|
||||||
// hash的key也采用String的序列化方式
|
|
||||||
|
|
||||||
|
|
||||||
template.setHashKeySerializer(stringRedisSerializer);
|
|
||||||
|
|
||||||
|
|
||||||
// value序列化方式采用jackson
|
|
||||||
|
|
||||||
|
|
||||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
|
||||||
|
|
||||||
|
|
||||||
// hash的value序列化方式采用jackson
|
|
||||||
|
|
||||||
|
|
||||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
|
||||||
|
|
||||||
|
|
||||||
template.afterPropertiesSet();
|
|
||||||
|
|
||||||
|
|
||||||
return template;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -5,11 +5,8 @@ import com.java2nb.common.redis.shiro.RedisCacheManager;
|
|||||||
import com.java2nb.common.redis.shiro.RedisManager;
|
import com.java2nb.common.redis.shiro.RedisManager;
|
||||||
import com.java2nb.common.redis.shiro.RedisSessionDAO;
|
import com.java2nb.common.redis.shiro.RedisSessionDAO;
|
||||||
import com.java2nb.system.shiro.UserRealm;
|
import com.java2nb.system.shiro.UserRealm;
|
||||||
import net.sf.ehcache.CacheManager;
|
|
||||||
import org.apache.shiro.cache.ehcache.EhCacheManager;
|
|
||||||
import org.apache.shiro.mgt.SecurityManager;
|
import org.apache.shiro.mgt.SecurityManager;
|
||||||
import org.apache.shiro.session.SessionListener;
|
import org.apache.shiro.session.SessionListener;
|
||||||
import org.apache.shiro.session.mgt.eis.MemorySessionDAO;
|
|
||||||
import org.apache.shiro.session.mgt.eis.SessionDAO;
|
import org.apache.shiro.session.mgt.eis.SessionDAO;
|
||||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||||
@ -29,6 +26,7 @@ import java.util.LinkedHashMap;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ShiroConfig {
|
public class ShiroConfig {
|
||||||
|
|
||||||
@Value("${spring.redis.host}")
|
@Value("${spring.redis.host}")
|
||||||
private String host;
|
private String host;
|
||||||
@Value("${spring.redis.password}")
|
@Value("${spring.redis.password}")
|
||||||
@ -38,9 +36,6 @@ public class ShiroConfig {
|
|||||||
@Value("${spring.redis.timeout}")
|
@Value("${spring.redis.timeout}")
|
||||||
private int timeout;
|
private int timeout;
|
||||||
|
|
||||||
@Value("${spring.cache.type}")
|
|
||||||
private String cacheType ;
|
|
||||||
|
|
||||||
@Value("${server.session-timeout}")
|
@Value("${server.session-timeout}")
|
||||||
private int tomcatTimeout;
|
private int tomcatTimeout;
|
||||||
|
|
||||||
@ -67,16 +62,17 @@ public class ShiroConfig {
|
|||||||
shiroFilterFactoryBean.setSuccessUrl("/index");
|
shiroFilterFactoryBean.setSuccessUrl("/index");
|
||||||
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
|
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
|
||||||
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
||||||
filterChainDefinitionMap.put("/login","anon");
|
filterChainDefinitionMap.put("/login", "anon");
|
||||||
filterChainDefinitionMap.put("/getVerify","anon");
|
filterChainDefinitionMap.put("/getVerify", "anon");
|
||||||
filterChainDefinitionMap.put("/css/**", "anon");
|
filterChainDefinitionMap.put("/css/**", "anon");
|
||||||
filterChainDefinitionMap.put("/js/**", "anon");
|
filterChainDefinitionMap.put("/js/**", "anon");
|
||||||
filterChainDefinitionMap.put("/fonts/**", "anon");
|
filterChainDefinitionMap.put("/fonts/**", "anon");
|
||||||
filterChainDefinitionMap.put("/img/**", "anon");
|
filterChainDefinitionMap.put("/img/**", "anon");
|
||||||
|
filterChainDefinitionMap.put("/favicon.ico", "anon");
|
||||||
filterChainDefinitionMap.put("/docs/**", "anon");
|
filterChainDefinitionMap.put("/docs/**", "anon");
|
||||||
filterChainDefinitionMap.put("/layuimini/**", "anon");
|
filterChainDefinitionMap.put("/layuimini/**", "anon");
|
||||||
filterChainDefinitionMap.put("/upload/**", "anon");
|
filterChainDefinitionMap.put("/upload/**", "anon");
|
||||||
filterChainDefinitionMap.put("/files/**", "anon");
|
filterChainDefinitionMap.put(Constant.UPLOAD_FILES_PREFIX + "**", "anon");
|
||||||
filterChainDefinitionMap.put("/logout", "logout");
|
filterChainDefinitionMap.put("/logout", "logout");
|
||||||
filterChainDefinitionMap.put("/blog", "anon");
|
filterChainDefinitionMap.put("/blog", "anon");
|
||||||
filterChainDefinitionMap.put("/blog/open/**", "anon");
|
filterChainDefinitionMap.put("/blog/open/**", "anon");
|
||||||
@ -92,11 +88,7 @@ public class ShiroConfig {
|
|||||||
//设置realm.
|
//设置realm.
|
||||||
securityManager.setRealm(userRealm());
|
securityManager.setRealm(userRealm());
|
||||||
// 自定义缓存实现 使用redis
|
// 自定义缓存实现 使用redis
|
||||||
if (Constant.CACHE_TYPE_REDIS.equals(cacheType)) {
|
securityManager.setCacheManager(rediscacheManager());
|
||||||
securityManager.setCacheManager(rediscacheManager());
|
|
||||||
} else {
|
|
||||||
securityManager.setCacheManager(ehCacheManager());
|
|
||||||
}
|
|
||||||
securityManager.setSessionManager(sessionManager());
|
securityManager.setSessionManager(sessionManager());
|
||||||
return securityManager;
|
return securityManager;
|
||||||
}
|
}
|
||||||
@ -108,8 +100,7 @@ public class ShiroConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开启shiro aop注解支持.
|
* 开启shiro aop注解支持. 使用代理方式;所以需要开启代码支持;
|
||||||
* 使用代理方式;所以需要开启代码支持;
|
|
||||||
*
|
*
|
||||||
* @param securityManager
|
* @param securityManager
|
||||||
* @return
|
* @return
|
||||||
@ -138,8 +129,7 @@ public class ShiroConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheManager 缓存 redis实现
|
* cacheManager 缓存 redis实现 使用的是shiro-redis开源插件
|
||||||
* 使用的是shiro-redis开源插件
|
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -151,8 +141,7 @@ public class ShiroConfig {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RedisSessionDAO shiro sessionDao层的实现 通过redis
|
* RedisSessionDAO shiro sessionDao层的实现 通过redis 使用的是shiro-redis开源插件
|
||||||
* 使用的是shiro-redis开源插件
|
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public RedisSessionDAO redisSessionDAO() {
|
public RedisSessionDAO redisSessionDAO() {
|
||||||
@ -163,11 +152,7 @@ public class ShiroConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SessionDAO sessionDAO() {
|
public SessionDAO sessionDAO() {
|
||||||
if (Constant.CACHE_TYPE_REDIS.equals(cacheType)) {
|
return redisSessionDAO();
|
||||||
return redisSessionDAO();
|
|
||||||
} else {
|
|
||||||
return new MemorySessionDAO();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,19 +169,4 @@ public class ShiroConfig {
|
|||||||
return sessionManager;
|
return sessionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public EhCacheManager ehCacheManager() {
|
|
||||||
EhCacheManager em = new EhCacheManager();
|
|
||||||
em.setCacheManager(cacheManager());
|
|
||||||
return em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean("cacheManager2")
|
|
||||||
CacheManager cacheManager(){
|
|
||||||
return CacheManager.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
package com.java2nb.common.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
|
||||||
import springfox.documentation.builders.PathSelectors;
|
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
|
||||||
import springfox.documentation.service.ApiInfo;
|
|
||||||
import springfox.documentation.service.Contact;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ${DESCRIPTION}
|
|
||||||
*
|
|
||||||
* @author xiongxy
|
|
||||||
* @create 2019-11-02 23:53
|
|
||||||
*/
|
|
||||||
@EnableSwagger2
|
|
||||||
@Configuration
|
|
||||||
public class Swagger2Config {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Docket createRestApi() {
|
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.apiInfo(apiInfo())
|
|
||||||
.select()
|
|
||||||
//为当前包路径
|
|
||||||
.apis(RequestHandlerSelectors.any())
|
|
||||||
.paths(PathSelectors.any())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
//构建 api文档的详细信息函数
|
|
||||||
private ApiInfo apiInfo() {
|
|
||||||
return new ApiInfoBuilder()
|
|
||||||
//页面标题
|
|
||||||
.title("功能测试")
|
|
||||||
//创建人
|
|
||||||
.contact(new Contact("xiongxy", "1179705413@qq.com", "1179705413@qq.com"))
|
|
||||||
//版本号
|
|
||||||
.version("1.0")
|
|
||||||
//描述
|
|
||||||
.description("API 描述")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,11 +7,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
class WebConfigurer extends WebMvcConfigurerAdapter {
|
class WebConfigurer extends WebMvcConfigurerAdapter {
|
||||||
@Autowired
|
|
||||||
|
@Autowired
|
||||||
JnConfig jnConfig;
|
JnConfig jnConfig;
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
@Override
|
||||||
registry.addResourceHandler("/files/**").addResourceLocations("file:///"+ jnConfig.getUploadPath());
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
}
|
registry.addResourceHandler(Constant.UPLOAD_FILES_PREFIX + "**")
|
||||||
|
.addResourceLocations("file:///" + jnConfig.getUploadPath());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,10 @@
|
|||||||
package com.java2nb.common.controller;
|
package com.java2nb.common.controller;
|
||||||
|
|
||||||
|
import com.java2nb.common.config.Constant;
|
||||||
import com.java2nb.common.config.JnConfig;
|
import com.java2nb.common.config.JnConfig;
|
||||||
import com.java2nb.common.domain.FileDO;
|
import com.java2nb.common.domain.FileDO;
|
||||||
import com.java2nb.common.service.FileService;
|
import com.java2nb.common.service.FileService;
|
||||||
import com.java2nb.common.utils.*;
|
import com.java2nb.common.utils.*;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -14,7 +12,11 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -32,165 +34,167 @@ import java.util.Map;
|
|||||||
@RequestMapping("/common/sysFile")
|
@RequestMapping("/common/sysFile")
|
||||||
public class FileController extends BaseController {
|
public class FileController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FileService sysFileService;
|
private FileService sysFileService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JnConfig jnConfig;
|
private JnConfig jnConfig;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@RequiresPermissions("common:sysFile:sysFile")
|
@RequiresPermissions("common:sysFile:sysFile")
|
||||||
String sysFile(Model model) {
|
String sysFile(Model model) {
|
||||||
Map<String, Object> params = new HashMap<>(16);
|
Map<String, Object> params = new HashMap<>(16);
|
||||||
return "common/file/file";
|
return "common/file/file";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@RequiresPermissions("common:sysFile:sysFile")
|
@RequiresPermissions("common:sysFile:sysFile")
|
||||||
public PageBean list(@RequestParam Map<String, Object> params) {
|
public PageBean list(@RequestParam Map<String, Object> params) {
|
||||||
// 查询列表数据
|
// 查询列表数据
|
||||||
Query query = new Query(params);
|
Query query = new Query(params);
|
||||||
List<FileDO> sysFileList = sysFileService.list(query);
|
List<FileDO> sysFileList = sysFileService.list(query);
|
||||||
int total = sysFileService.count(query);
|
int total = sysFileService.count(query);
|
||||||
PageBean pageBean = new PageBean(sysFileList, total);
|
PageBean pageBean = new PageBean(sysFileList, total);
|
||||||
return pageBean;
|
return pageBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
// @RequiresPermissions("common:bComments")
|
// @RequiresPermissions("common:bComments")
|
||||||
String add() {
|
String add() {
|
||||||
return "common/sysFile/add";
|
return "common/sysFile/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
// @RequiresPermissions("common:bComments")
|
// @RequiresPermissions("common:bComments")
|
||||||
String edit(Long id, Model model) {
|
String edit(Long id, Model model) {
|
||||||
FileDO sysFile = sysFileService.get(id);
|
FileDO sysFile = sysFileService.get(id);
|
||||||
model.addAttribute("sysFile", sysFile);
|
model.addAttribute("sysFile", sysFile);
|
||||||
return "common/sysFile/edit";
|
return "common/sysFile/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信息
|
* 信息
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/info/{id}")
|
@RequestMapping("/info/{id}")
|
||||||
@RequiresPermissions("common:info")
|
@RequiresPermissions("common:info")
|
||||||
public R info(@PathVariable("id") Long id) {
|
public R info(@PathVariable("id") Long id) {
|
||||||
FileDO sysFile = sysFileService.get(id);
|
FileDO sysFile = sysFileService.get(id);
|
||||||
return R.ok().put("sysFile", sysFile);
|
return R.ok().put("sysFile", sysFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@RequiresPermissions("common:save")
|
@RequiresPermissions("common:save")
|
||||||
public R save(FileDO sysFile) {
|
public R save(FileDO sysFile) {
|
||||||
if (sysFileService.save(sysFile) > 0) {
|
if (sysFileService.save(sysFile) > 0) {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@RequiresPermissions("common:update")
|
@RequiresPermissions("common:update")
|
||||||
public R update(@RequestBody FileDO sysFile) {
|
public R update(@RequestBody FileDO sysFile) {
|
||||||
sysFileService.update(sysFile);
|
sysFileService.update(sysFile);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
// @RequiresPermissions("common:remove")
|
// @RequiresPermissions("common:remove")
|
||||||
public R remove(Long id, HttpServletRequest request) {
|
public R remove(Long id, HttpServletRequest request) {
|
||||||
if ("test".equals(getUsername())) {
|
if ("test".equals(getUsername())) {
|
||||||
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
||||||
}
|
}
|
||||||
String fileName = jnConfig.getUploadPath() + sysFileService.get(id).getUrl().replace("/files/", "");
|
String fileName =
|
||||||
if (sysFileService.remove(id) > 0) {
|
jnConfig.getUploadPath() + sysFileService.get(id).getUrl().replace(Constant.UPLOAD_FILES_PREFIX, "");
|
||||||
boolean b = FileUtil.deleteFile(fileName);
|
if (sysFileService.remove(id) > 0) {
|
||||||
if (!b) {
|
boolean b = FileUtil.deleteFile(fileName);
|
||||||
return R.error("数据库记录删除成功,文件删除失败");
|
if (!b) {
|
||||||
}
|
return R.error("数据库记录删除成功,文件删除失败");
|
||||||
return R.ok();
|
}
|
||||||
} else {
|
return R.ok();
|
||||||
return R.error();
|
} else {
|
||||||
}
|
return R.error();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@PostMapping("/batchRemove")
|
@PostMapping("/batchRemove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequiresPermissions("common:remove")
|
@RequiresPermissions("common:remove")
|
||||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
if ("test".equals(getUsername())) {
|
if ("test".equals(getUsername())) {
|
||||||
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
||||||
}
|
}
|
||||||
sysFileService.batchRemove(ids);
|
sysFileService.batchRemove(ids);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||||
if ("test".equals(getUsername())) {
|
if ("test".equals(getUsername())) {
|
||||||
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
return R.error(1, "演示系统不允许修改,完整体验请部署程序");
|
||||||
}
|
}
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
String year = DateUtils.format(date,DateUtils.YEAR_PATTERN);
|
String year = DateUtils.format(date, DateUtils.YEAR_PATTERN);
|
||||||
String month = DateUtils.format(date,DateUtils.MONTH_PATTERN);
|
String month = DateUtils.format(date, DateUtils.MONTH_PATTERN);
|
||||||
String day = DateUtils.format(date,DateUtils.DAY_PATTERN);
|
String day = DateUtils.format(date, DateUtils.DAY_PATTERN);
|
||||||
|
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
String fileDir = year+"/"+month+"/"+day + "/";
|
String fileDir = year + "/" + month + "/" + day + "/";
|
||||||
fileName = FileUtil.renameToUUID(fileName);
|
fileName = FileUtil.renameToUUID(fileName);
|
||||||
FileDO sysFile = new FileDO(FileType.fileType(fileName), "/files/" + fileDir + fileName, date);
|
FileDO sysFile = new FileDO(FileType.fileType(fileName), Constant.UPLOAD_FILES_PREFIX + fileDir + fileName,
|
||||||
try {
|
date);
|
||||||
FileUtil.uploadFile(file.getBytes(), jnConfig.getUploadPath()+fileDir, fileName);
|
try {
|
||||||
} catch (Exception e) {
|
FileUtil.uploadFile(file.getBytes(), jnConfig.getUploadPath() + fileDir, fileName);
|
||||||
return R.error();
|
} catch (Exception e) {
|
||||||
}
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
if (sysFileService.save(sysFile) > 0) {
|
if (sysFileService.save(sysFile) > 0) {
|
||||||
return R.ok().put("fileName",sysFile.getUrl());
|
return R.ok().put("fileName", sysFile.getUrl());
|
||||||
}
|
}
|
||||||
return R.error();
|
return R.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件下载
|
* 文件下载
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/download")
|
@RequestMapping(value = "/download")
|
||||||
public void fileDownload(String filePath,String fileName, HttpServletResponse resp) throws Exception {
|
public void fileDownload(String filePath, String fileName, HttpServletResponse resp) throws Exception {
|
||||||
String realFilePath = jnConfig.getUploadPath() + filePath;
|
String realFilePath = jnConfig.getUploadPath() + filePath;
|
||||||
InputStream in = new FileInputStream(realFilePath);
|
InputStream in = new FileInputStream(realFilePath);
|
||||||
//设置响应头,对文件进行url编码
|
//设置响应头,对文件进行url编码
|
||||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||||
resp.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
resp.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||||
|
|
||||||
resp.setContentLength(in.available());
|
resp.setContentLength(in.available());
|
||||||
|
|
||||||
OutputStream out = resp.getOutputStream();
|
OutputStream out = resp.getOutputStream();
|
||||||
byte[] b = new byte[1024];
|
byte[] b = new byte[1024];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
while ((len = in.read(b)) != -1) {
|
while ((len = in.read(b)) != -1) {
|
||||||
out.write(b, 0, len);
|
out.write(b, 0, len);
|
||||||
}
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,33 @@
|
|||||||
package com.java2nb.common.dao;
|
package com.java2nb.common.dao;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface GeneratorMapper {
|
public interface GeneratorMapper {
|
||||||
@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables"
|
|
||||||
+ " where table_schema = (select database()) and table_name like concat('%',#{tableName},'%')")
|
|
||||||
List<Map<String, Object>> list(@Param("tableName") String tableName);
|
|
||||||
|
|
||||||
@Select("select count(*) from information_schema.tables where table_schema = (select database())")
|
@Select(
|
||||||
int count(Map<String, Object> map);
|
"select table_name tableName, engine, table_comment tableComment, create_time createTime from tables"
|
||||||
|
+ " where table_schema = 'novel_plus' and table_name like concat('%',#{tableName},'%')")
|
||||||
|
List<Map<String, Object>> list(@Param("tableName") String tableName);
|
||||||
|
|
||||||
@Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables \r\n"
|
@Select("select count(*) from tables where table_schema = 'novel_plus'")
|
||||||
+ " where table_schema = (select database()) and table_name = #{tableName}")
|
int count(Map<String, Object> map);
|
||||||
Map<String, String> get(String tableName);
|
|
||||||
|
|
||||||
@Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\r\n"
|
@Select(
|
||||||
+ " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
|
"select table_name tableName, engine, table_comment tableComment, create_time createTime from tables \r\n"
|
||||||
List<Map<String, String>> listColumns(String tableName);
|
+ " where table_schema = 'novel_plus' and table_name = #{tableName}")
|
||||||
|
Map<String, String> get(String tableName);
|
||||||
|
|
||||||
@Select("select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns\r\n"
|
@Select(
|
||||||
+ " where table_name = #{tableName} and table_schema = (select database()) and column_key = 'PRI' limit 1")
|
"select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from columns\r\n"
|
||||||
|
+ " where table_name = #{tableName} and table_schema = 'novel_plus' order by ordinal_position")
|
||||||
|
List<Map<String, String>> listColumns(String tableName);
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from columns\r\n"
|
||||||
|
+ " where table_name = #{tableName} and table_schema = 'novel_plus' and column_key = 'PRI' limit 1")
|
||||||
Map<String, String> getPriColumn(String tableName);
|
Map<String, String> getPriColumn(String tableName);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package com.java2nb.common.domain;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,208 +14,259 @@ import java.util.Date;
|
|||||||
* @date 2019-09-29 18:28:07
|
* @date 2019-09-29 18:28:07
|
||||||
*/
|
*/
|
||||||
public class DictDO implements Serializable {
|
public class DictDO implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
//编号
|
private static final long serialVersionUID = 1L;
|
||||||
private Long id;
|
|
||||||
//标签名
|
|
||||||
private String name;
|
|
||||||
//数据值
|
|
||||||
private String value;
|
|
||||||
//类型
|
|
||||||
private String type;
|
|
||||||
//描述
|
|
||||||
private String description;
|
|
||||||
//排序(升序)
|
|
||||||
private BigDecimal sort;
|
|
||||||
//父级编号
|
|
||||||
private Long parentId;
|
|
||||||
//创建者
|
|
||||||
private Integer createBy;
|
|
||||||
//创建时间
|
|
||||||
private Date createDate;
|
|
||||||
//更新者
|
|
||||||
private Long updateBy;
|
|
||||||
//更新时间
|
|
||||||
private Date updateDate;
|
|
||||||
//备注信息
|
|
||||||
private String remarks;
|
|
||||||
//删除标记
|
|
||||||
private String delFlag;
|
|
||||||
|
|
||||||
/**
|
//编号
|
||||||
* 设置:编号
|
private Long id;
|
||||||
*/
|
//标签名
|
||||||
public void setId(Long id) {
|
private String name;
|
||||||
this.id = id;
|
//数据值
|
||||||
}
|
private String value;
|
||||||
/**
|
//类型
|
||||||
* 获取:编号
|
private String type;
|
||||||
*/
|
//描述
|
||||||
public Long getId() {
|
private String description;
|
||||||
return id;
|
//排序(升序)
|
||||||
}
|
private BigDecimal sort;
|
||||||
/**
|
//父级编号
|
||||||
* 设置:标签名
|
private Long parentId;
|
||||||
*/
|
//创建者
|
||||||
public void setName(String name) {
|
private Integer createBy;
|
||||||
this.name = name;
|
//创建时间
|
||||||
}
|
private Date createDate;
|
||||||
/**
|
//更新者
|
||||||
* 获取:标签名
|
private Long updateBy;
|
||||||
*/
|
//更新时间
|
||||||
public String getName() {
|
private Date updateDate;
|
||||||
return name;
|
//备注信息
|
||||||
}
|
private String remarks;
|
||||||
/**
|
//删除标记
|
||||||
* 设置:数据值
|
private String delFlag;
|
||||||
*/
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:数据值
|
|
||||||
*/
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:类型
|
|
||||||
*/
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:类型
|
|
||||||
*/
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:描述
|
|
||||||
*/
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:描述
|
|
||||||
*/
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:排序(升序)
|
|
||||||
*/
|
|
||||||
public void setSort(BigDecimal sort) {
|
|
||||||
this.sort = sort;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:排序(升序)
|
|
||||||
*/
|
|
||||||
public BigDecimal getSort() {
|
|
||||||
return sort;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:父级编号
|
|
||||||
*/
|
|
||||||
public void setParentId(Long parentId) {
|
|
||||||
this.parentId = parentId;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:父级编号
|
|
||||||
*/
|
|
||||||
public Long getParentId() {
|
|
||||||
return parentId;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:创建者
|
|
||||||
*/
|
|
||||||
public void setCreateBy(Integer createBy) {
|
|
||||||
this.createBy = createBy;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:创建者
|
|
||||||
*/
|
|
||||||
public Integer getCreateBy() {
|
|
||||||
return createBy;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:创建时间
|
|
||||||
*/
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:创建时间
|
|
||||||
*/
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:更新者
|
|
||||||
*/
|
|
||||||
public void setUpdateBy(Long updateBy) {
|
|
||||||
this.updateBy = updateBy;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:更新者
|
|
||||||
*/
|
|
||||||
public Long getUpdateBy() {
|
|
||||||
return updateBy;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:更新时间
|
|
||||||
*/
|
|
||||||
public void setUpdateDate(Date updateDate) {
|
|
||||||
this.updateDate = updateDate;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:更新时间
|
|
||||||
*/
|
|
||||||
public Date getUpdateDate() {
|
|
||||||
return updateDate;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:备注信息
|
|
||||||
*/
|
|
||||||
public void setRemarks(String remarks) {
|
|
||||||
this.remarks = remarks;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:备注信息
|
|
||||||
*/
|
|
||||||
public String getRemarks() {
|
|
||||||
return remarks;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置:删除标记
|
|
||||||
*/
|
|
||||||
public void setDelFlag(String delFlag) {
|
|
||||||
this.delFlag = delFlag;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取:删除标记
|
|
||||||
*/
|
|
||||||
public String getDelFlag() {
|
|
||||||
return delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public String toString() {
|
* 设置:编号
|
||||||
return "DictDO{" +
|
*/
|
||||||
"id=" + id +
|
public void setId(Long id) {
|
||||||
", name='" + name + '\'' +
|
this.id = id;
|
||||||
", value='" + value + '\'' +
|
}
|
||||||
", type='" + type + '\'' +
|
|
||||||
", description='" + description + '\'' +
|
/**
|
||||||
", sort=" + sort +
|
* 获取:编号
|
||||||
", parentId=" + parentId +
|
*/
|
||||||
", createBy=" + createBy +
|
public Long getId() {
|
||||||
", createDate=" + createDate +
|
return id;
|
||||||
", updateBy=" + updateBy +
|
}
|
||||||
", updateDate=" + updateDate +
|
|
||||||
", remarks='" + remarks + '\'' +
|
/**
|
||||||
", delFlag='" + delFlag + '\'' +
|
* 设置:标签名
|
||||||
'}';
|
*/
|
||||||
}
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:标签名
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:数据值
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:数据值
|
||||||
|
*/
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:类型
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:类型
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:描述
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:描述
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:排序(升序)
|
||||||
|
*/
|
||||||
|
public void setSort(BigDecimal sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:排序(升序)
|
||||||
|
*/
|
||||||
|
public BigDecimal getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:父级编号
|
||||||
|
*/
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:父级编号
|
||||||
|
*/
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:创建者
|
||||||
|
*/
|
||||||
|
public void setCreateBy(Integer createBy) {
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:创建者
|
||||||
|
*/
|
||||||
|
public Integer getCreateBy() {
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:创建时间
|
||||||
|
*/
|
||||||
|
public void setCreateDate(Date createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:创建时间
|
||||||
|
*/
|
||||||
|
public Date getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:更新者
|
||||||
|
*/
|
||||||
|
public void setUpdateBy(Long updateBy) {
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:更新者
|
||||||
|
*/
|
||||||
|
public Long getUpdateBy() {
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:更新时间
|
||||||
|
*/
|
||||||
|
public void setUpdateDate(Date updateDate) {
|
||||||
|
this.updateDate = updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:更新时间
|
||||||
|
*/
|
||||||
|
public Date getUpdateDate() {
|
||||||
|
return updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:备注信息
|
||||||
|
*/
|
||||||
|
public void setRemarks(String remarks) {
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:备注信息
|
||||||
|
*/
|
||||||
|
public String getRemarks() {
|
||||||
|
return remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置:删除标记
|
||||||
|
*/
|
||||||
|
public void setDelFlag(String delFlag) {
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取:删除标记
|
||||||
|
*/
|
||||||
|
public String getDelFlag() {
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DictDO{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", value='" + value + '\'' +
|
||||||
|
", type='" + type + '\'' +
|
||||||
|
", description='" + description + '\'' +
|
||||||
|
", sort=" + sort +
|
||||||
|
", parentId=" + parentId +
|
||||||
|
", createBy=" + createBy +
|
||||||
|
", createDate=" + createDate +
|
||||||
|
", updateBy=" + updateBy +
|
||||||
|
", updateDate=" + updateDate +
|
||||||
|
", remarks='" + remarks + '\'' +
|
||||||
|
", delFlag='" + delFlag + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
DictDO dictDO = (DictDO) o;
|
||||||
|
return Objects.equals(id, dictDO.id) && Objects.equals(name, dictDO.name)
|
||||||
|
&& Objects.equals(value, dictDO.value) && Objects.equals(type, dictDO.type)
|
||||||
|
&& Objects.equals(description, dictDO.description) && Objects.equals(sort, dictDO.sort)
|
||||||
|
&& Objects.equals(parentId, dictDO.parentId) && Objects.equals(createBy, dictDO.createBy)
|
||||||
|
&& Objects.equals(createDate, dictDO.createDate) && Objects.equals(updateBy,
|
||||||
|
dictDO.updateBy) && Objects.equals(updateDate, dictDO.updateDate) && Objects.equals(remarks,
|
||||||
|
dictDO.remarks) && Objects.equals(delFlag, dictDO.delFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name, value, type, description, sort, parentId, createBy, createDate, updateBy,
|
||||||
|
updateDate,
|
||||||
|
remarks, delFlag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,32 +2,27 @@ package com.java2nb.common.exception;
|
|||||||
|
|
||||||
|
|
||||||
import com.java2nb.common.utils.R;
|
import com.java2nb.common.utils.R;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
||||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class MainsiteErrorController implements ErrorController {
|
public class MainsiteErrorController implements ErrorController {
|
||||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
||||||
private static final String ERROR_PATH = "/error";
|
private static final String ERROR_PATH = "/error";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ErrorAttributes errorAttributes;
|
ErrorAttributes errorAttributes;
|
||||||
|
|
||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = {ERROR_PATH},
|
value = {ERROR_PATH},
|
||||||
produces = {"text/html"}
|
produces = {"text/html"}
|
||||||
)
|
)
|
||||||
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
|
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
|
||||||
int code = response.getStatus();
|
int code = response.getStatus();
|
||||||
@ -58,9 +53,4 @@ public class MainsiteErrorController implements ErrorController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getErrorPath() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return ERROR_PATH;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package com.java2nb.common.service.impl;
|
package com.java2nb.common.service.impl;
|
||||||
|
|
||||||
|
import com.java2nb.common.dao.DictDao;
|
||||||
|
import com.java2nb.common.domain.DictDO;
|
||||||
|
import com.java2nb.common.service.DictService;
|
||||||
import com.java2nb.common.utils.StringUtils;
|
import com.java2nb.common.utils.StringUtils;
|
||||||
import com.java2nb.system.domain.UserDO;
|
import com.java2nb.system.domain.UserDO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -9,14 +12,12 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import com.java2nb.common.dao.DictDao;
|
|
||||||
import com.java2nb.common.domain.DictDO;
|
|
||||||
import com.java2nb.common.service.DictService;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DictServiceImpl implements DictService {
|
public class DictServiceImpl implements DictService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictDao dictDao;
|
private DictDao dictDao;
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ public class DictServiceImpl implements DictService {
|
|||||||
@Override
|
@Override
|
||||||
|
|
||||||
public List<DictDO> listType() {
|
public List<DictDO> listType() {
|
||||||
return dictDao.listType();
|
return dictDao.listType().stream().distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,72 +1,74 @@
|
|||||||
package com.java2nb.common.service.impl;
|
package com.java2nb.common.service.impl;
|
||||||
|
|
||||||
|
import com.java2nb.common.config.Constant;
|
||||||
import com.java2nb.common.config.JnConfig;
|
import com.java2nb.common.config.JnConfig;
|
||||||
|
import com.java2nb.common.dao.FileDao;
|
||||||
|
import com.java2nb.common.domain.FileDO;
|
||||||
|
import com.java2nb.common.service.FileService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.java2nb.common.dao.FileDao;
|
|
||||||
import com.java2nb.common.domain.FileDO;
|
|
||||||
import com.java2nb.common.service.FileService;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FileServiceImpl implements FileService {
|
public class FileServiceImpl implements FileService {
|
||||||
@Autowired
|
|
||||||
private FileDao sysFileMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JnConfig jnConfig;
|
private FileDao sysFileMapper;
|
||||||
@Override
|
|
||||||
public FileDO get(Long id){
|
|
||||||
return sysFileMapper.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Autowired
|
||||||
public List<FileDO> list(Map<String, Object> map){
|
private JnConfig jnConfig;
|
||||||
return sysFileMapper.list(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int count(Map<String, Object> map){
|
public FileDO get(Long id) {
|
||||||
return sysFileMapper.count(map);
|
return sysFileMapper.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int save(FileDO sysFile){
|
public List<FileDO> list(Map<String, Object> map) {
|
||||||
return sysFileMapper.save(sysFile);
|
return sysFileMapper.list(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(FileDO sysFile){
|
public int count(Map<String, Object> map) {
|
||||||
return sysFileMapper.update(sysFile);
|
return sysFileMapper.count(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int remove(Long id){
|
public int save(FileDO sysFile) {
|
||||||
return sysFileMapper.remove(id);
|
return sysFileMapper.save(sysFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int batchRemove(Long[] ids){
|
public int update(FileDO sysFile) {
|
||||||
return sysFileMapper.batchRemove(ids);
|
return sysFileMapper.update(sysFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int remove(Long id) {
|
||||||
|
return sysFileMapper.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int batchRemove(Long[] ids) {
|
||||||
|
return sysFileMapper.batchRemove(ids);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isExist(String url) {
|
public Boolean isExist(String url) {
|
||||||
Boolean isExist = false;
|
Boolean isExist = false;
|
||||||
if (!StringUtils.isEmpty(url)) {
|
if (!StringUtils.isEmpty(url)) {
|
||||||
String filePath = url.replace("/files/", "");
|
String filePath = url.replace(Constant.UPLOAD_FILES_PREFIX, "");
|
||||||
filePath = jnConfig.getUploadPath() + filePath;
|
filePath = jnConfig.getUploadPath() + filePath;
|
||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
isExist = true;
|
isExist = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isExist;
|
return isExist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.java2nb.common.utils;
|
package com.java2nb.common.utils;
|
||||||
|
|
||||||
import com.alibaba.druid.util.StringUtils;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
@ -8,79 +7,80 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class JSONUtils {
|
public class JSONUtils {
|
||||||
/**
|
|
||||||
* Bean对象转JSON
|
|
||||||
*
|
|
||||||
* @param object
|
|
||||||
* @param dataFormatString
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String beanToJson(Object object, String dataFormatString) {
|
|
||||||
if (object != null) {
|
|
||||||
if (StringUtils.isEmpty(dataFormatString)) {
|
|
||||||
return JSONObject.toJSONString(object);
|
|
||||||
}
|
|
||||||
return JSON.toJSONStringWithDateFormat(object, dataFormatString);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean对象转JSON
|
* Bean对象转JSON
|
||||||
*
|
*
|
||||||
* @param object
|
* @param object
|
||||||
* @return
|
* @param dataFormatString
|
||||||
*/
|
* @return
|
||||||
public static String beanToJson(Object object) {
|
*/
|
||||||
if (object != null) {
|
public static String beanToJson(Object object, String dataFormatString) {
|
||||||
return JSON.toJSONString(object);
|
if (object != null) {
|
||||||
} else {
|
if (StringUtils.isEmpty(dataFormatString)) {
|
||||||
return null;
|
return JSONObject.toJSONString(object);
|
||||||
}
|
}
|
||||||
}
|
return JSON.toJSONStringWithDateFormat(object, dataFormatString);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String转JSON字符串
|
* Bean对象转JSON
|
||||||
*
|
*
|
||||||
* @param key
|
* @param object
|
||||||
* @param value
|
* @return
|
||||||
* @return
|
*/
|
||||||
*/
|
public static String beanToJson(Object object) {
|
||||||
public static String stringToJsonByFastjson(String key, String value) {
|
if (object != null) {
|
||||||
if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
|
return JSON.toJSONString(object);
|
||||||
return null;
|
} else {
|
||||||
}
|
return null;
|
||||||
Map<String, String> map = new HashMap<String, String>(16);
|
}
|
||||||
map.put(key, value);
|
}
|
||||||
return beanToJson(map, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将json字符串转换成对象
|
* String转JSON字符串
|
||||||
*
|
*
|
||||||
* @param json
|
* @param key
|
||||||
* @param clazz
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Object jsonToBean(String json, Object clazz) {
|
public static String stringToJsonByFastjson(String key, String value) {
|
||||||
if (StringUtils.isEmpty(json) || clazz == null) {
|
if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSON.parseObject(json, clazz.getClass());
|
Map<String, String> map = new HashMap<String, String>(16);
|
||||||
}
|
map.put(key, value);
|
||||||
|
return beanToJson(map, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* json字符串转map
|
* 将json字符串转换成对象
|
||||||
*
|
*
|
||||||
* @param json
|
* @param json
|
||||||
* @return
|
* @param clazz
|
||||||
*/
|
* @return
|
||||||
@SuppressWarnings("unchecked")
|
*/
|
||||||
public static Map<String, Object> jsonToMap(String json) {
|
public static Object jsonToBean(String json, Object clazz) {
|
||||||
if (StringUtils.isEmpty(json)) {
|
if (StringUtils.isEmpty(json) || clazz == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return JSON.parseObject(json, Map.class);
|
return JSON.parseObject(json, clazz.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json字符串转map
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static Map<String, Object> jsonToMap(String json) {
|
||||||
|
if (StringUtils.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(json, Map.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,601 +0,0 @@
|
|||||||
package com.java2nb.common.utils;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public final class RedisUtil {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate<String, Object> redisTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 指定缓存失效时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public boolean expire(String key, long time) {
|
|
||||||
try {
|
|
||||||
if (time > 0) {
|
|
||||||
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据key 获取过期时间
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @return 时间(秒) 返回0代表为永久有效
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public long getExpire(String key) {
|
|
||||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断key是否存在
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public boolean hasKey(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.hasKey(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除缓存
|
|
||||||
*
|
|
||||||
* @param key 可以传一个值 或多个
|
|
||||||
*/
|
|
||||||
public void del(String... key) {
|
|
||||||
if (key != null && key.length > 0) {
|
|
||||||
if (key.length == 1) {
|
|
||||||
redisTemplate.delete(key[0]);
|
|
||||||
} else {
|
|
||||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存获取
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return 值
|
|
||||||
*/
|
|
||||||
public Object get(String key) {
|
|
||||||
return key == null ? null : redisTemplate.opsForValue().get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存放入
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return true成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean set(String key, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForValue().set(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 普通缓存放入并设置时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
|
|
||||||
* @return true成功 false 失败
|
|
||||||
*/
|
|
||||||
public boolean set(String key, Object value, long time) {
|
|
||||||
try {
|
|
||||||
if (time > 0) {
|
|
||||||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
|
||||||
} else {
|
|
||||||
set(key, value);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递增
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param delta 要增加几(大于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long incr(String key, long delta) {
|
|
||||||
if (delta < 0) {
|
|
||||||
throw new RuntimeException("递增因子必须大于0");
|
|
||||||
}
|
|
||||||
return redisTemplate.opsForValue().increment(key, delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 递减
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param delta 要减少几(小于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long decr(String key, long delta) {
|
|
||||||
if (delta < 0) {
|
|
||||||
throw new RuntimeException("递减因子必须大于0");
|
|
||||||
}
|
|
||||||
return redisTemplate.opsForValue().increment(key, -delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ================================Map=================================
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashGet
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 不能为null
|
|
||||||
* @return 值
|
|
||||||
*/
|
|
||||||
public Object hget(String key, String item) {
|
|
||||||
return redisTemplate.opsForHash().get(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取hashKey对应的所有键值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return 对应的多个键值
|
|
||||||
*/
|
|
||||||
public Map<Object, Object> hmget(String key) {
|
|
||||||
return redisTemplate.opsForHash().entries(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param map 对应多个键值
|
|
||||||
* @return true 成功 false 失败
|
|
||||||
*/
|
|
||||||
public boolean hmset(String key, Map<String, Object> map) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().putAll(key, map);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet 并设置时间
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param map 对应多个键值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return true成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().putAll(key, map);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向一张hash表中放入数据,如果不存在将创建
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param value 值
|
|
||||||
* @return true 成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hset(String key, String item, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().put(key, item, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向一张hash表中放入数据,如果不存在将创建
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
|
||||||
* @return true 成功 false失败
|
|
||||||
*/
|
|
||||||
public boolean hset(String key, String item, Object value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForHash().put(key, item, value);
|
|
||||||
if (time > 0) {
|
|
||||||
expire(key, time);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除hash表中的值
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 可以使多个 不能为null
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public void hdel(String key, Object... item) {
|
|
||||||
redisTemplate.opsForHash().delete(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断hash表中是否有该项的值
|
|
||||||
*
|
|
||||||
* @param key 键 不能为null
|
|
||||||
* @param item 项 不能为null
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
public boolean hHasKey(String key, String item) {
|
|
||||||
return redisTemplate.opsForHash().hasKey(key, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param by 要增加几(大于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public double hincr(String key, String item, double by) {
|
|
||||||
return redisTemplate.opsForHash().increment(key, item, by);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hash递减
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param item 项
|
|
||||||
* @param by 要减少记(小于0)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public double hdecr(String key, String item, double by) {
|
|
||||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据key获取Set中的所有值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Set<Object> sGet(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().members(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据value从一个set中查询,是否存在
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return true 存在 false不存在
|
|
||||||
*/
|
|
||||||
public boolean sHasKey(String key, Object value) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().isMember(key, value);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将数据放入set缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 成功个数
|
|
||||||
*/
|
|
||||||
public long sSet(String key, Object... values) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().add(key, values);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将set数据放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 成功个数
|
|
||||||
*/
|
|
||||||
public long sSetAndTime(String key, long time, Object... values) {
|
|
||||||
try {
|
|
||||||
Long count = redisTemplate.opsForSet().add(key, values);
|
|
||||||
if (time > 0)
|
|
||||||
expire(key, time);
|
|
||||||
return count;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取set缓存的长度
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long sGetSetSize(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForSet().size(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除值为value的
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param values 值 可以是多个
|
|
||||||
* @return 移除的个数
|
|
||||||
*/
|
|
||||||
public long setRemove(String key, Object... values) {
|
|
||||||
try {
|
|
||||||
Long count = redisTemplate.opsForSet().remove(key, values);
|
|
||||||
return count;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取list缓存的内容
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param start 开始
|
|
||||||
* @param end 结束 0 到 -代表所有值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<Object> lGet(String key, long start, long end) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().range(key, start, end);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取list缓存的长度
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public long lGetListSize(String key) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().size(key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过索引 获取list中的值
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param index 索引 index>=0时, 0 表头, 第二个元素,依次类推;index<0时,-,表尾,-倒数第二个元素,依次类推
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Object lGetIndex(String key, long index) {
|
|
||||||
try {
|
|
||||||
return redisTemplate.opsForList().index(key, index);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPush(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, Object value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPush(key, value);
|
|
||||||
if (time > 0)
|
|
||||||
expire(key, time);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, List<Object> value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPushAll(key, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将list放入缓存
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param value 值
|
|
||||||
* @param time 时间(秒)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lSet(String key, List<Object> value, long time) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().rightPushAll(key, value);
|
|
||||||
if (time > 0)
|
|
||||||
expire(key, time);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引修改list中的某条数据
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param index 索引
|
|
||||||
* @param value 值
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
|
||||||
try {
|
|
||||||
redisTemplate.opsForList().set(key, index, value);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 移除N个值为value
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
* @param count 移除多少个
|
|
||||||
* @param value 值
|
|
||||||
* @return 移除的个数
|
|
||||||
*/
|
|
||||||
public long lRemove(String key, long count, Object value) {
|
|
||||||
try {
|
|
||||||
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
|
||||||
return remove;
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.domain.BookCommentDO;
|
||||||
|
import com.java2nb.novel.service.BookCommentService;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说评论表
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 21:59:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/bookComment")
|
||||||
|
public class BookCommentController {
|
||||||
|
@Autowired
|
||||||
|
private BookCommentService bookCommentService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:bookComment:bookComment")
|
||||||
|
String BookComment() {
|
||||||
|
return "novel/bookComment/bookComment";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取小说评论表列表", notes = "获取小说评论表列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:bookComment:bookComment")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<BookCommentDO> bookCommentList = bookCommentService.list(query);
|
||||||
|
int total = bookCommentService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(bookCommentList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增小说评论表页面", notes = "新增小说评论表页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:bookComment:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/bookComment/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改小说评论表页面", notes = "修改小说评论表页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:bookComment:edit")
|
||||||
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookCommentDO bookComment = bookCommentService.get(id);
|
||||||
|
model.addAttribute("bookComment", bookComment);
|
||||||
|
return "novel/bookComment/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看小说评论表页面", notes = "查看小说评论表页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:bookComment:detail")
|
||||||
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookCommentDO bookComment = bookCommentService.get(id);
|
||||||
|
model.addAttribute("bookComment", bookComment);
|
||||||
|
return "novel/bookComment/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增小说评论表", notes = "新增小说评论表")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:bookComment:add")
|
||||||
|
public R save( BookCommentDO bookComment) {
|
||||||
|
if (bookCommentService.save(bookComment) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改小说评论表", notes = "修改小说评论表")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:bookComment:edit")
|
||||||
|
public R update( BookCommentDO bookComment) {
|
||||||
|
bookCommentService.update(bookComment);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除小说评论表", notes = "删除小说评论表")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookComment:remove")
|
||||||
|
public R remove( Long id) {
|
||||||
|
if (bookCommentService.remove(id) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除小说评论表", notes = "批量删除小说评论表")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookComment:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
|
bookCommentService.batchRemove(ids);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.domain.BookContentDO;
|
||||||
|
import com.java2nb.novel.service.BookContentService;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说内容表
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 19:52:06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/bookContent")
|
||||||
|
public class BookContentController {
|
||||||
|
@Autowired
|
||||||
|
private BookContentService bookContentService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:bookContent:bookContent")
|
||||||
|
String BookContent() {
|
||||||
|
return "novel/bookContent/bookContent";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取小说内容表列表", notes = "获取小说内容表列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:bookContent:bookContent")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<BookContentDO> bookContentList = bookContentService.list(query);
|
||||||
|
int total = bookContentService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(bookContentList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增小说内容表页面", notes = "新增小说内容表页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:bookContent:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/bookContent/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改小说内容表页面", notes = "修改小说内容表页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:bookContent:edit")
|
||||||
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookContentDO bookContent = bookContentService.get(id);
|
||||||
|
model.addAttribute("bookContent", bookContent);
|
||||||
|
return "novel/bookContent/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看小说内容表页面", notes = "查看小说内容表页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:bookContent:detail")
|
||||||
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookContentDO bookContent = bookContentService.get(id);
|
||||||
|
model.addAttribute("bookContent", bookContent);
|
||||||
|
return "novel/bookContent/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增小说内容表", notes = "新增小说内容表")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:bookContent:add")
|
||||||
|
public R save( BookContentDO bookContent) {
|
||||||
|
if (bookContentService.save(bookContent) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改小说内容表", notes = "修改小说内容表")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:bookContent:edit")
|
||||||
|
public R update( BookContentDO bookContent) {
|
||||||
|
bookContentService.update(bookContent);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除小说内容表", notes = "删除小说内容表")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookContent:remove")
|
||||||
|
public R remove( Long id) {
|
||||||
|
if (bookContentService.remove(id) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除小说内容表", notes = "批量删除小说内容表")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookContent:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
|
bookContentService.batchRemove(ids);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.domain.BookIndexDO;
|
||||||
|
import com.java2nb.novel.service.BookIndexService;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说目录表
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 19:51:54
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/bookIndex")
|
||||||
|
public class BookIndexController {
|
||||||
|
@Autowired
|
||||||
|
private BookIndexService bookIndexService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:bookIndex:bookIndex")
|
||||||
|
String BookIndex() {
|
||||||
|
return "novel/bookIndex/bookIndex";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取小说目录表列表", notes = "获取小说目录表列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:bookIndex:bookIndex")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<BookIndexDO> bookIndexList = bookIndexService.list(query);
|
||||||
|
int total = bookIndexService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(bookIndexList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增小说目录表页面", notes = "新增小说目录表页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:bookIndex:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/bookIndex/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改小说目录表页面", notes = "修改小说目录表页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:bookIndex:edit")
|
||||||
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookIndexDO bookIndex = bookIndexService.get(id);
|
||||||
|
model.addAttribute("bookIndex", bookIndex);
|
||||||
|
return "novel/bookIndex/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看小说目录表页面", notes = "查看小说目录表页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:bookIndex:detail")
|
||||||
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookIndexDO bookIndex = bookIndexService.get(id);
|
||||||
|
model.addAttribute("bookIndex", bookIndex);
|
||||||
|
return "novel/bookIndex/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增小说目录表", notes = "新增小说目录表")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:bookIndex:add")
|
||||||
|
public R save( BookIndexDO bookIndex) {
|
||||||
|
if (bookIndexService.save(bookIndex) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改小说目录表", notes = "修改小说目录表")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:bookIndex:edit")
|
||||||
|
public R update( BookIndexDO bookIndex) {
|
||||||
|
bookIndexService.update(bookIndex);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除小说目录表", notes = "删除小说目录表")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookIndex:remove")
|
||||||
|
public R remove( Long id) {
|
||||||
|
if (bookIndexService.remove(id) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除小说目录表", notes = "批量删除小说目录表")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookIndex:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
|
bookIndexService.batchRemove(ids);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,134 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import com.java2nb.common.config.CacheKey;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
import com.java2nb.novel.domain.BookSettingDO;
|
||||||
|
import com.java2nb.novel.service.BookSettingService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页小说推荐
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-18 10:01:13
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/bookSetting")
|
||||||
|
public class BookSettingController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BookSettingService bookSettingService;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:bookSetting:bookSetting")
|
||||||
|
String BookSetting() {
|
||||||
|
return "novel/bookSetting/bookSetting";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取首页小说设置表列表", notes = "获取首页小说设置表列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:bookSetting:bookSetting")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<BookSettingDO> bookSettingList = bookSettingService.list(query);
|
||||||
|
int total = bookSettingService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(bookSettingList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增首页小说设置表页面", notes = "新增首页小说设置表页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:bookSetting:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/bookSetting/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改首页小说设置表页面", notes = "修改首页小说设置表页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:bookSetting:edit")
|
||||||
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookSettingDO bookSetting = bookSettingService.get(id);
|
||||||
|
model.addAttribute("bookSetting", bookSetting);
|
||||||
|
return "novel/bookSetting/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看首页小说设置表页面", notes = "查看首页小说设置表页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:bookSetting:detail")
|
||||||
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
|
BookSettingDO bookSetting = bookSettingService.get(id);
|
||||||
|
model.addAttribute("bookSetting", bookSetting);
|
||||||
|
return "novel/bookSetting/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增首页小说设置表", notes = "新增首页小说设置表")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:bookSetting:add")
|
||||||
|
public R save(BookSettingDO bookSetting) {
|
||||||
|
if (bookSettingService.save(bookSetting) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改首页小说设置表", notes = "修改首页小说设置表")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:bookSetting:edit")
|
||||||
|
public R update(BookSettingDO bookSetting) {
|
||||||
|
bookSettingService.update(bookSetting);
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_BOOK_SETTINGS_KEY);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除首页小说设置表", notes = "删除首页小说设置表")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookSetting:remove")
|
||||||
|
public R remove(Long id) {
|
||||||
|
if (bookSettingService.remove(id) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除首页小说设置表", notes = "批量删除首页小说设置表")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:bookSetting:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
|
bookSettingService.batchRemove(ids);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import com.java2nb.common.config.CacheKey;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
import com.java2nb.novel.domain.FriendLinkDO;
|
||||||
|
import com.java2nb.novel.service.FriendLinkService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 15:12:25
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/friendLink")
|
||||||
|
public class FriendLinkController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FriendLinkService friendLinkService;
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:friendLink:friendLink")
|
||||||
|
String FriendLink() {
|
||||||
|
return "novel/friendLink/friendLink";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取列表", notes = "获取列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:friendLink:friendLink")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<FriendLinkDO> friendLinkList = friendLinkService.list(query);
|
||||||
|
int total = friendLinkService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(friendLinkList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增页面", notes = "新增页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:friendLink:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/friendLink/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改页面", notes = "修改页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:friendLink:edit")
|
||||||
|
String edit(@PathVariable("id") Integer id, Model model) {
|
||||||
|
FriendLinkDO friendLink = friendLinkService.get(id);
|
||||||
|
model.addAttribute("friendLink", friendLink);
|
||||||
|
return "novel/friendLink/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看页面", notes = "查看页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:friendLink:detail")
|
||||||
|
String detail(@PathVariable("id") Integer id, Model model) {
|
||||||
|
FriendLinkDO friendLink = friendLinkService.get(id);
|
||||||
|
model.addAttribute("friendLink", friendLink);
|
||||||
|
return "novel/friendLink/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增", notes = "新增")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:friendLink:add")
|
||||||
|
public R save(@Validated FriendLinkDO friendLink) {
|
||||||
|
if (friendLinkService.save(friendLink) > 0) {
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改", notes = "修改")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:friendLink:edit")
|
||||||
|
public R update(@Validated FriendLinkDO friendLink) {
|
||||||
|
friendLinkService.update(friendLink);
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除", notes = "删除")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:friendLink:remove")
|
||||||
|
public R remove(Integer id) {
|
||||||
|
if (friendLinkService.remove(id) > 0) {
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除", notes = "批量删除")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:friendLink:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Integer[] ids) {
|
||||||
|
friendLinkService.batchRemove(ids);
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,26 +1,21 @@
|
|||||||
package com.java2nb.novel.controller;
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.java2nb.common.config.CacheKey;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
|
|
||||||
|
|
||||||
import com.java2nb.novel.domain.NewsDO;
|
|
||||||
import com.java2nb.novel.service.NewsService;
|
|
||||||
import com.java2nb.common.utils.PageBean;
|
import com.java2nb.common.utils.PageBean;
|
||||||
import com.java2nb.common.utils.Query;
|
import com.java2nb.common.utils.Query;
|
||||||
import com.java2nb.common.utils.R;
|
import com.java2nb.common.utils.R;
|
||||||
|
import com.java2nb.novel.domain.NewsDO;
|
||||||
|
import com.java2nb.novel.service.NewsService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新闻表
|
* 新闻表
|
||||||
@ -33,8 +28,11 @@ import com.java2nb.common.utils.R;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/novel/news")
|
@RequestMapping("/novel/news")
|
||||||
public class NewsController {
|
public class NewsController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private NewsService newsService;
|
private NewsService newsService;
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@RequiresPermissions("novel:news:news")
|
@RequiresPermissions("novel:news:news")
|
||||||
@ -66,7 +64,7 @@ public class NewsController {
|
|||||||
@GetMapping("/edit/{id}")
|
@GetMapping("/edit/{id}")
|
||||||
@RequiresPermissions("novel:news:edit")
|
@RequiresPermissions("novel:news:edit")
|
||||||
String edit(@PathVariable("id") Long id, Model model) {
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
NewsDO news = newsService.get(id);
|
NewsDO news = newsService.get(id);
|
||||||
model.addAttribute("news", news);
|
model.addAttribute("news", news);
|
||||||
return "novel/news/edit";
|
return "novel/news/edit";
|
||||||
}
|
}
|
||||||
@ -75,7 +73,7 @@ public class NewsController {
|
|||||||
@GetMapping("/detail/{id}")
|
@GetMapping("/detail/{id}")
|
||||||
@RequiresPermissions("novel:news:detail")
|
@RequiresPermissions("novel:news:detail")
|
||||||
String detail(@PathVariable("id") Long id, Model model) {
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
NewsDO news = newsService.get(id);
|
NewsDO news = newsService.get(id);
|
||||||
model.addAttribute("news", news);
|
model.addAttribute("news", news);
|
||||||
return "novel/news/detail";
|
return "novel/news/detail";
|
||||||
}
|
}
|
||||||
@ -87,8 +85,9 @@ public class NewsController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@RequiresPermissions("novel:news:add")
|
@RequiresPermissions("novel:news:add")
|
||||||
public R save( NewsDO news) {
|
public R save(NewsDO news) {
|
||||||
if (newsService.save(news) > 0) {
|
if (newsService.save(news) > 0) {
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_NEWS_KEY);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
return R.error();
|
return R.error();
|
||||||
@ -101,8 +100,9 @@ public class NewsController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@RequiresPermissions("novel:news:edit")
|
@RequiresPermissions("novel:news:edit")
|
||||||
public R update( NewsDO news) {
|
public R update(NewsDO news) {
|
||||||
newsService.update(news);
|
newsService.update(news);
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_NEWS_KEY);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,8 +113,9 @@ public class NewsController {
|
|||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequiresPermissions("novel:news:remove")
|
@RequiresPermissions("novel:news:remove")
|
||||||
public R remove( Long id) {
|
public R remove(Long id) {
|
||||||
if (newsService.remove(id) > 0) {
|
if (newsService.remove(id) > 0) {
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_NEWS_KEY);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
return R.error();
|
return R.error();
|
||||||
@ -128,7 +129,8 @@ public class NewsController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequiresPermissions("novel:news:batchRemove")
|
@RequiresPermissions("novel:news:batchRemove")
|
||||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
newsService.batchRemove(ids);
|
newsService.batchRemove(ids);
|
||||||
|
redisTemplate.delete(CacheKey.INDEX_NEWS_KEY);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.domain.UserFeedbackDO;
|
||||||
|
import com.java2nb.novel.service.UserFeedbackService;
|
||||||
|
import com.java2nb.common.utils.PageBean;
|
||||||
|
import com.java2nb.common.utils.Query;
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-18 11:08:54
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/userFeedback")
|
||||||
|
public class UserFeedbackController {
|
||||||
|
@Autowired
|
||||||
|
private UserFeedbackService userFeedbackService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:userFeedback:userFeedback")
|
||||||
|
String UserFeedback() {
|
||||||
|
return "novel/userFeedback/userFeedback";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取列表", notes = "获取列表")
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("novel:userFeedback:userFeedback")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
|
//查询列表数据
|
||||||
|
Query query = new Query(params);
|
||||||
|
List<UserFeedbackDO> userFeedbackList = userFeedbackService.list(query);
|
||||||
|
int total = userFeedbackService.count(query);
|
||||||
|
PageBean pageBean = new PageBean(userFeedbackList, total);
|
||||||
|
return R.ok().put("data", pageBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增页面", notes = "新增页面")
|
||||||
|
@GetMapping("/add")
|
||||||
|
@RequiresPermissions("novel:userFeedback:add")
|
||||||
|
String add() {
|
||||||
|
return "novel/userFeedback/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改页面", notes = "修改页面")
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
@RequiresPermissions("novel:userFeedback:edit")
|
||||||
|
String edit(@PathVariable("id") Long id, Model model) {
|
||||||
|
UserFeedbackDO userFeedback = userFeedbackService.get(id);
|
||||||
|
model.addAttribute("userFeedback", userFeedback);
|
||||||
|
return "novel/userFeedback/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "查看页面", notes = "查看页面")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
@RequiresPermissions("novel:userFeedback:detail")
|
||||||
|
String detail(@PathVariable("id") Long id, Model model) {
|
||||||
|
UserFeedbackDO userFeedback = userFeedbackService.get(id);
|
||||||
|
model.addAttribute("userFeedback", userFeedback);
|
||||||
|
return "novel/userFeedback/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增", notes = "新增")
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/save")
|
||||||
|
@RequiresPermissions("novel:userFeedback:add")
|
||||||
|
public R save( UserFeedbackDO userFeedback) {
|
||||||
|
if (userFeedbackService.save(userFeedback) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改", notes = "修改")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:userFeedback:edit")
|
||||||
|
public R update( UserFeedbackDO userFeedback) {
|
||||||
|
userFeedbackService.update(userFeedback);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除", notes = "删除")
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:userFeedback:remove")
|
||||||
|
public R remove( Long id) {
|
||||||
|
if (userFeedbackService.remove(id) > 0) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "批量删除", notes = "批量删除")
|
||||||
|
@PostMapping("/batchRemove")
|
||||||
|
@ResponseBody
|
||||||
|
@RequiresPermissions("novel:userFeedback:batchRemove")
|
||||||
|
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||||
|
userFeedbackService.batchRemove(ids);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.java2nb.novel.controller;
|
||||||
|
|
||||||
|
import com.java2nb.common.utils.R;
|
||||||
|
import com.java2nb.novel.domain.WebsiteInfoDO;
|
||||||
|
import com.java2nb.novel.service.WebsiteInfoService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网站信息表
|
||||||
|
*
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 11:05:43
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/novel/websiteInfo")
|
||||||
|
public class WebsiteInfoController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WebsiteInfoService websiteInfoService;
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@RequiresPermissions("novel:websiteInfo:websiteInfo")
|
||||||
|
String detail(Model model) {
|
||||||
|
WebsiteInfoDO websiteInfo = websiteInfoService.get(1L);
|
||||||
|
model.addAttribute("websiteInfo", websiteInfo);
|
||||||
|
return "novel/websiteInfo/detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改网站信息表", notes = "修改网站信息表")
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/update")
|
||||||
|
@RequiresPermissions("novel:websiteInfo:edit")
|
||||||
|
public R update(WebsiteInfoDO websiteInfo) {
|
||||||
|
websiteInfoService.update(websiteInfo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.java2nb.novel.dao;
|
||||||
|
|
||||||
|
import com.java2nb.novel.domain.BookCommentDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小说评论表
|
||||||
|
* @author xiongxy
|
||||||
|
* @email 1179705413@qq.com
|
||||||
|
* @date 2023-04-14 21:59:28
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BookCommentDao {
|
||||||
|
|
||||||
|
BookCommentDO get(Long id);
|
||||||
|
|
||||||
|
List<BookCommentDO> list(Map<String,Object> map);
|
||||||
|
|
||||||
|
int count(Map<String,Object> map);
|
||||||
|
|
||||||
|
int save(BookCommentDO bookComment);
|
||||||
|
|
||||||
|
int update(BookCommentDO bookComment);
|
||||||
|
|
||||||
|
int remove(Long id);
|
||||||
|
|
||||||
|
int batchRemove(Long[] ids);
|
||||||
|
}
|