mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-20 10:16:40 +08:00
发布 v2.6.0
This commit is contained in:
parent
a3e781915e
commit
3f3a7db544
@ -4,14 +4,14 @@
|
|||||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
|
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
|
||||||
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
|
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
|
||||||
<br>
|
<br>
|
||||||
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
|
[](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
[]()
|
[]()
|
||||||
|
|
||||||
RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期与 RuoYi-Vue 同步
|
RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期与 RuoYi-Vue 同步
|
||||||
|
|
||||||
集成 Lock4j dynamic-datasource 等分布式场景解决方案
|
集成 Lock4j dynamic-datasource OSS存储 等分布式场景解决方案
|
||||||
|
|
||||||
集成 Mybatis-Plus Lombok Hutool 等便捷开发工具 适配重写相关业务 便于开发
|
集成 Mybatis-Plus Lombok Hutool 等便捷开发工具 适配重写相关业务 便于开发
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期
|
|||||||
* Redis客户端 采用 Redisson 性能更强
|
* Redis客户端 采用 Redisson 性能更强
|
||||||
* 分布式锁 Lock4j 注解锁、工具锁 多种多样
|
* 分布式锁 Lock4j 注解锁、工具锁 多种多样
|
||||||
* 部署方式 Docker 容器编排 一键部署业务集群
|
* 部署方式 Docker 容器编排 一键部署业务集群
|
||||||
|
* 文件存储 OSS 对象存储模块 支持(Minio、七牛、阿里、腾讯)
|
||||||
|
|
||||||
## 参考文档
|
## 参考文档
|
||||||
|
|
||||||
@ -89,13 +90,14 @@ RuoYi-Vue-Plus 是基于 RuoYi-Vue 针对 `分布式集群` 场景升级 定期
|
|||||||
* 集成 dynamic-datasource 多数据源(默认支持MySQL,其他种类需自行适配)
|
* 集成 dynamic-datasource 多数据源(默认支持MySQL,其他种类需自行适配)
|
||||||
* 集成 Lock4j 实现分布式 注解锁、工具锁 多种多样
|
* 集成 Lock4j 实现分布式 注解锁、工具锁 多种多样
|
||||||
* 增加 Docker 容器编排 打包插件与部署脚本
|
* 增加 Docker 容器编排 打包插件与部署脚本
|
||||||
|
* 移除 本地文件上传 改为 OSS对象存储 支持(Minio、七牛、阿里、腾讯)
|
||||||
|
|
||||||
### 代码改动
|
### 代码改动
|
||||||
|
|
||||||
* 所有原生功能使用 Mybatis-Plus 与 Lombok 重写
|
* 所有原生功能使用 Mybatis-Plus 与 Lombok 重写
|
||||||
* 增加 IServicePlus 与 BaseMapperPlus 可自定义通用方法
|
* 增加 IServicePlus 与 BaseMapperPlus 可自定义通用方法
|
||||||
* 代码生成模板 改为适配 Mybatis-Plus 的代码
|
* 代码生成模板 改为适配 Mybatis-Plus 的代码
|
||||||
* 代码生成模板 拆分出 Vo,QueryBo,AddBo,EditBo 等领域对象
|
* 代码生成模板 根据 Alibaba 代码规约 拆分出 VO、BO 等领域对象
|
||||||
* 代码生成模板 增加 文档注解 与 校验注解 简化通用操作
|
* 代码生成模板 增加 文档注解 与 校验注解 简化通用操作
|
||||||
* 项目修改为 maven多环境配置
|
* 项目修改为 maven多环境配置
|
||||||
* 项目配置修改为 application.yml 统一管理
|
* 项目配置修改为 application.yml 统一管理
|
||||||
|
@ -6,10 +6,17 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#开启所需端口
|
#开启所需端口(生产环境不推荐开启)
|
||||||
port(){
|
port(){
|
||||||
|
# mysql 端口
|
||||||
firewall-cmd --add-port=3306/tcp --permanent
|
firewall-cmd --add-port=3306/tcp --permanent
|
||||||
|
# redis 端口
|
||||||
firewall-cmd --add-port=6379/tcp --permanent
|
firewall-cmd --add-port=6379/tcp --permanent
|
||||||
|
# minio api 端口
|
||||||
|
firewall-cmd --add-port=9000/tcp --permanent
|
||||||
|
# minio 控制台端口
|
||||||
|
firewall-cmd --add-port=9001/tcp --permanent
|
||||||
|
# 重启防火墙
|
||||||
service firewalld restart
|
service firewalld restart
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +31,7 @@ mount(){
|
|||||||
|
|
||||||
#启动基础模块
|
#启动基础模块
|
||||||
base(){
|
base(){
|
||||||
docker-compose up -d mysql nginx-web redis
|
docker-compose up -d mysql nginx-web redis minio
|
||||||
}
|
}
|
||||||
|
|
||||||
#启动基础模块
|
#启动基础模块
|
||||||
|
@ -18,6 +18,8 @@ services:
|
|||||||
- /docker/mysql/data/:/var/lib/mysql/
|
- /docker/mysql/data/:/var/lib/mysql/
|
||||||
# 配置挂载
|
# 配置挂载
|
||||||
- /docker/mysql/conf/:/etc/mysql/conf.d/
|
- /docker/mysql/conf/:/etc/mysql/conf.d/
|
||||||
|
# 主机本机时间文件映射 与本机时间同步
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
command:
|
command:
|
||||||
# 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)
|
# 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配)
|
||||||
--default-authentication-plugin=mysql_native_password
|
--default-authentication-plugin=mysql_native_password
|
||||||
@ -68,6 +70,8 @@ services:
|
|||||||
- /docker/redis/conf/redis.conf:/redis.conf:rw
|
- /docker/redis/conf/redis.conf:/redis.conf:rw
|
||||||
# 数据文件
|
# 数据文件
|
||||||
- /docker/redis/data:/data:rw
|
- /docker/redis/data:/data:rw
|
||||||
|
# 主机本机时间文件映射 与本机时间同步
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
command: "redis-server --appendonly yes"
|
command: "redis-server --appendonly yes"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
restart: always
|
||||||
@ -75,8 +79,35 @@ services:
|
|||||||
ruoyi_net:
|
ruoyi_net:
|
||||||
ipv4_address: 172.30.0.48
|
ipv4_address: 172.30.0.48
|
||||||
|
|
||||||
|
minio:
|
||||||
|
image: minio/minio:RELEASE.2021-07-08T01-15-01Z
|
||||||
|
hostname: "minio"
|
||||||
|
ports:
|
||||||
|
# api 端口
|
||||||
|
- 9000:9000
|
||||||
|
# 控制台端口
|
||||||
|
- 9001:9001
|
||||||
|
environment:
|
||||||
|
# 管理后台用户名
|
||||||
|
MINIO_ACCESS_KEY: ruoyi
|
||||||
|
# 管理后台密码,最小8个字符
|
||||||
|
MINIO_SECRET_KEY: ruoyi123
|
||||||
|
volumes:
|
||||||
|
# 映射当前目录下的data目录至容器内/data目录
|
||||||
|
- /docker/minio/data:/data
|
||||||
|
# 映射配置目录
|
||||||
|
- /docker/minio/config:/root/.minio/
|
||||||
|
# 主机本机时间文件映射 与本机时间同步
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
command: server --console-address ':9001' /data # 指定容器中的目录 /data
|
||||||
|
privileged: true
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
ruoyi_net:
|
||||||
|
ipv4_address: 172.30.0.54
|
||||||
|
|
||||||
ruoyi-server1:
|
ruoyi-server1:
|
||||||
image: "ruoyi/ruoyi-server:2.5.2"
|
image: "ruoyi/ruoyi-server:2.6.0"
|
||||||
environment:
|
environment:
|
||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
volumes:
|
volumes:
|
||||||
@ -90,7 +121,7 @@ services:
|
|||||||
ipv4_address: 172.30.0.60
|
ipv4_address: 172.30.0.60
|
||||||
|
|
||||||
ruoyi-server2:
|
ruoyi-server2:
|
||||||
image: "ruoyi/ruoyi-server:2.5.2"
|
image: "ruoyi/ruoyi-server:2.6.0"
|
||||||
environment:
|
environment:
|
||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
volumes:
|
volumes:
|
||||||
@ -104,7 +135,7 @@ services:
|
|||||||
ipv4_address: 172.30.0.61
|
ipv4_address: 172.30.0.61
|
||||||
|
|
||||||
ruoyi-monitor-admin:
|
ruoyi-monitor-admin:
|
||||||
image: "ruoyi/ruoyi-monitor-admin:2.5.2"
|
image: "ruoyi/ruoyi-monitor-admin:2.6.0"
|
||||||
environment:
|
environment:
|
||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
privileged: true
|
privileged: true
|
||||||
|
20
pom.xml
20
pom.xml
@ -6,15 +6,15 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<version>2.5.2</version>
|
<version>2.6.0</version>
|
||||||
|
|
||||||
<name>RuoYi-Vue-Plus</name>
|
<name>RuoYi-Vue-Plus</name>
|
||||||
<url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
|
<url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
|
||||||
<description>RuoYi-Vue-Plus后台管理系统</description>
|
<description>RuoYi-Vue-Plus后台管理系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi-vue-plus.version>2.5.2</ruoyi-vue-plus.version>
|
<ruoyi-vue-plus.version>2.6.0</ruoyi-vue-plus.version>
|
||||||
<spring-boot.version>2.4.8</spring-boot.version>
|
<spring-boot.version>2.5.3</spring-boot.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
@ -25,19 +25,25 @@
|
|||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<mybatis-plus.version>3.4.3</mybatis-plus.version>
|
<mybatis-plus.version>3.4.3</mybatis-plus.version>
|
||||||
<hutool.version>5.7.4</hutool.version>
|
<hutool.version>5.7.6</hutool.version>
|
||||||
<feign.version>3.0.3</feign.version>
|
<feign.version>3.0.3</feign.version>
|
||||||
<feign-okhttp.version>11.0</feign-okhttp.version>
|
<feign-okhttp.version>11.0</feign-okhttp.version>
|
||||||
<spring-boot-admin.version>2.4.3</spring-boot-admin.version>
|
<spring-boot-admin.version>2.4.3</spring-boot-admin.version>
|
||||||
<redisson.version>3.16.0</redisson.version>
|
<redisson.version>3.16.1</redisson.version>
|
||||||
<lock4j.version>2.2.1</lock4j.version>
|
<lock4j.version>2.2.1</lock4j.version>
|
||||||
<datasource.version>3.4.0</datasource.version>
|
<datasource.version>3.4.1</datasource.version>
|
||||||
|
|
||||||
|
<!-- OSS 配置 -->
|
||||||
|
<qiniu.version>7.8.0</qiniu.version>
|
||||||
|
<aliyun.oss.version>3.13.0</aliyun.oss.version>
|
||||||
|
<qcloud.cos.version>5.6.47</qcloud.cos.version>
|
||||||
|
<minio.version>8.3.0</minio.version>
|
||||||
|
|
||||||
<!-- docker 配置 -->
|
<!-- docker 配置 -->
|
||||||
<docker.registry.url>localhost</docker.registry.url>
|
<docker.registry.url>localhost</docker.registry.url>
|
||||||
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
|
||||||
<docker.namespace>ruoyi</docker.namespace>
|
<docker.namespace>ruoyi</docker.namespace>
|
||||||
<docker.plugin.version>1.2.0</docker.plugin.version>
|
<docker.plugin.version>1.2.2</docker.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>2.5.2</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
<artifactId>ruoyi-extend</artifactId>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-extend</artifactId>
|
<artifactId>ruoyi-extend</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>2.5.2</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi-vue-plus",
|
"name": "ruoyi-vue-plus",
|
||||||
"version": "2.5.2",
|
"version": "2.6.0",
|
||||||
"description": "RuoYi-Vue-Plus后台管理系统",
|
"description": "RuoYi-Vue-Plus后台管理系统",
|
||||||
"author": "LionLi",
|
"author": "LionLi",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"core-js": "3.8.1",
|
"core-js": "3.8.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.15.2",
|
"element-ui": "2.15.3",
|
||||||
"file-saver": "2.0.4",
|
"file-saver": "2.0.4",
|
||||||
"fuse.js": "6.4.3",
|
"fuse.js": "6.4.3",
|
||||||
"highlight.js": "9.18.5",
|
"highlight.js": "9.18.5",
|
||||||
|
@ -9,6 +9,15 @@ export function listDemo(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 自定义分页接口
|
||||||
|
export function pageDemo(query) {
|
||||||
|
return request({
|
||||||
|
url: '/demo/demo/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询测试单表详细
|
// 查询测试单表详细
|
||||||
export function getDemo(id) {
|
export function getDemo(id) {
|
||||||
return request({
|
return request({
|
||||||
@ -50,4 +59,4 @@ export function exportDemo(query) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
18
ruoyi-ui/src/api/system/oss.js
Normal file
18
ruoyi-ui/src/api/system/oss.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询OSS云存储列表
|
||||||
|
export function listOss(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/oss/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除OSS云存储
|
||||||
|
export function delOss(ossId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/oss/' + ossId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-upload
|
<el-upload
|
||||||
:action="uploadUrl"
|
:action="uploadUrl"
|
||||||
|
:before-upload="handleBeforeUpload"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
:on-error="handleUploadError"
|
:on-error="handleUploadError"
|
||||||
name="file"
|
name="file"
|
||||||
@ -46,6 +47,11 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
// 上传文件大小限制(MB)
|
||||||
|
fileSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 5,
|
||||||
|
},
|
||||||
/* 类型(base64格式、url格式) */
|
/* 类型(base64格式、url格式) */
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -54,7 +60,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
uploadUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传的图片服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken()
|
Authorization: "Bearer " + getToken()
|
||||||
},
|
},
|
||||||
@ -130,14 +136,6 @@ export default {
|
|||||||
this.quill.format("image", false);
|
this.quill.format("image", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// toolbar.addHandler("video", (value) => {
|
|
||||||
// this.uploadType = "video";
|
|
||||||
// if (value) {
|
|
||||||
// this.$refs.upload.$children[0].$refs.input.click();
|
|
||||||
// } else {
|
|
||||||
// this.quill.format("video", false);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
this.Quill.pasteHTML(this.currentValue);
|
this.Quill.pasteHTML(this.currentValue);
|
||||||
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
||||||
@ -158,6 +156,18 @@ export default {
|
|||||||
this.$emit("on-editor-change", eventName, ...args);
|
this.$emit("on-editor-change", eventName, ...args);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 上传前校检格式和大小
|
||||||
|
handleBeforeUpload(file) {
|
||||||
|
// 校检文件大小
|
||||||
|
if (this.fileSize) {
|
||||||
|
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||||
|
if (!isLt) {
|
||||||
|
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
// 获取富文本组件实例
|
// 获取富文本组件实例
|
||||||
let quill = this.Quill;
|
let quill = this.Quill;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<!-- 文件列表 -->
|
<!-- 文件列表 -->
|
||||||
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||||
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||||
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
<el-link :href="`${file.url}`" :underline="false" target="_blank">
|
||||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
</el-link>
|
</el-link>
|
||||||
<div class="ele-upload-list__item-content-action">
|
<div class="ele-upload-list__item-content-action">
|
||||||
@ -70,7 +70,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseUrl: process.env.VUE_APP_BASE_API,
|
baseUrl: process.env.VUE_APP_BASE_API,
|
||||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadFileUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传的图片服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
},
|
},
|
||||||
|
@ -74,7 +74,7 @@ export default {
|
|||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
hideUpload: false,
|
hideUpload: false,
|
||||||
baseUrl: process.env.VUE_APP_BASE_API,
|
baseUrl: process.env.VUE_APP_BASE_API,
|
||||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadImgUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传的图片服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
},
|
},
|
||||||
@ -90,11 +90,7 @@ export default {
|
|||||||
// 然后将数组转为对象数组
|
// 然后将数组转为对象数组
|
||||||
this.fileList = list.map(item => {
|
this.fileList = list.map(item => {
|
||||||
if (typeof item === "string") {
|
if (typeof item === "string") {
|
||||||
if (item.indexOf(this.baseUrl) === -1) {
|
item = { name: item, url: item };
|
||||||
item = { name: this.baseUrl + item, url: this.baseUrl + item };
|
|
||||||
} else {
|
|
||||||
item = { name: item, url: item };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
@ -122,7 +118,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res) {
|
||||||
this.fileList.push({ name: res.data.fileName, url: res.data.fileName });
|
this.fileList.push({ name: res.data.fileName, url: res.data.url });
|
||||||
this.$emit("input", this.listToString(this.fileList));
|
this.$emit("input", this.listToString(this.fileList));
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,7 @@ export default {
|
|||||||
name: 'RuoYiDoc',
|
name: 'RuoYiDoc',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: 'http://doc.ruoyi.vip/ruoyi-vue'
|
url: 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +18,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -9,7 +9,7 @@ export default {
|
|||||||
name: 'RuoYiGit',
|
name: 'RuoYiGit',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: 'https://gitee.com/y_project/RuoYi-Vue'
|
url: 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -18,4 +18,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 顶部菜单超出数量折叠 -->
|
<!-- 顶部菜单超出数量折叠 -->
|
||||||
<el-submenu index="more" v-if="topMenus.length > visibleNumber">
|
<el-submenu :style="{'--theme': theme}" index="more" v-if="topMenus.length > visibleNumber">
|
||||||
<template slot="title">更多菜单</template>
|
<template slot="title">更多菜单</template>
|
||||||
<template v-for="(item, index) in topMenus">
|
<template v-for="(item, index) in topMenus">
|
||||||
<el-menu-item
|
<el-menu-item
|
||||||
@ -87,7 +87,7 @@ export default {
|
|||||||
// 默认激活的菜单
|
// 默认激活的菜单
|
||||||
activeMenu() {
|
activeMenu() {
|
||||||
const path = this.$route.path;
|
const path = this.$route.path;
|
||||||
let activePath = this.routers[0].path;
|
let activePath = this.defaultRouter();
|
||||||
if (path.lastIndexOf("/") > 0) {
|
if (path.lastIndexOf("/") > 0) {
|
||||||
const tmpPath = path.substring(1, path.length);
|
const tmpPath = path.substring(1, path.length);
|
||||||
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
|
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
|
||||||
@ -100,7 +100,7 @@ export default {
|
|||||||
}
|
}
|
||||||
var routes = this.activeRoutes(activePath);
|
var routes = this.activeRoutes(activePath);
|
||||||
if (routes.length === 0) {
|
if (routes.length === 0) {
|
||||||
activePath = this.currentIndex || this.routers[0].path
|
activePath = this.currentIndex || this.defaultRouter()
|
||||||
this.activeRoutes(activePath);
|
this.activeRoutes(activePath);
|
||||||
}
|
}
|
||||||
return activePath;
|
return activePath;
|
||||||
@ -121,6 +121,17 @@ export default {
|
|||||||
const width = document.body.getBoundingClientRect().width / 3;
|
const width = document.body.getBoundingClientRect().width / 3;
|
||||||
this.visibleNumber = parseInt(width / 85);
|
this.visibleNumber = parseInt(width / 85);
|
||||||
},
|
},
|
||||||
|
// 默认激活的路由
|
||||||
|
defaultRouter() {
|
||||||
|
let router;
|
||||||
|
Object.keys(this.routers).some((key) => {
|
||||||
|
if (!this.routers[key].hidden) {
|
||||||
|
router = this.routers[key].path;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return router;
|
||||||
|
},
|
||||||
// 菜单选择事件
|
// 菜单选择事件
|
||||||
handleSelect(key, keyPath) {
|
handleSelect(key, keyPath) {
|
||||||
this.currentIndex = key;
|
this.currentIndex = key;
|
||||||
@ -158,25 +169,27 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.el-menu--horizontal > .el-menu-item {
|
.topmenu-container.el-menu--horizontal > .el-menu-item {
|
||||||
float: left;
|
float: left;
|
||||||
height: 50px;
|
height: 50px !important;
|
||||||
line-height: 50px;
|
line-height: 50px !important;
|
||||||
margin: 0;
|
color: #999093 !important;
|
||||||
border-bottom: 3px solid transparent;
|
padding: 0 5px !important;
|
||||||
color: #999093;
|
margin: 0 10px !important;
|
||||||
padding: 0 5px;
|
|
||||||
margin: 0 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--horizontal > .el-menu-item.is-active {
|
.topmenu-container.el-menu--horizontal > .el-menu-item.is-active, .el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
|
||||||
border-bottom: 3px solid #{'var(--theme)'};
|
border-bottom: 2px solid #{'var(--theme)'} !important;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* submenu item */
|
/* submenu item */
|
||||||
.el-menu--horizontal > .el-submenu .el-submenu__title {
|
.topmenu-container.el-menu--horizontal > .el-submenu .el-submenu__title {
|
||||||
height: 50px !important;
|
float: left;
|
||||||
line-height: 50px !important;
|
height: 50px !important;
|
||||||
|
line-height: 50px !important;
|
||||||
|
color: #999093 !important;
|
||||||
|
padding: 0 5px !important;
|
||||||
|
margin: 0 10px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -5,8 +5,6 @@ Vue.use(Router)
|
|||||||
|
|
||||||
/* Layout */
|
/* Layout */
|
||||||
import Layout from '@/layout'
|
import Layout from '@/layout'
|
||||||
import ParentView from '@/components/ParentView';
|
|
||||||
import InnerLink from '@/layout/components/InnerLink'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: 路由配置项
|
* Note: 路由配置项
|
||||||
@ -23,6 +21,7 @@ import InnerLink from '@/layout/components/InnerLink'
|
|||||||
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
||||||
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
||||||
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
||||||
|
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -82,7 +81,7 @@ export const constantRoutes = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/auth',
|
path: '/system/user-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
@ -90,12 +89,12 @@ export const constantRoutes = [
|
|||||||
path: 'role/:userId(\\d+)',
|
path: 'role/:userId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/user/authRole'], resolve),
|
component: (resolve) => require(['@/views/system/user/authRole'], resolve),
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
meta: { title: '分配角色'}
|
meta: { title: '分配角色', activeMenu: '/system/user'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/auth',
|
path: '/system/role-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
@ -103,46 +102,46 @@ export const constantRoutes = [
|
|||||||
path: 'user/:roleId(\\d+)',
|
path: 'user/:roleId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/role/authUser'], resolve),
|
component: (resolve) => require(['@/views/system/role/authUser'], resolve),
|
||||||
name: 'AuthUser',
|
name: 'AuthUser',
|
||||||
meta: { title: '分配用户'}
|
meta: { title: '分配用户', activeMenu: '/system/role'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/dict',
|
path: '/system/dict-data',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'type/data/:dictId(\\d+)',
|
path: 'index/:dictId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/dict/data'], resolve),
|
component: (resolve) => require(['@/views/system/dict/data'], resolve),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '字典数据', icon: '' }
|
meta: { title: '字典数据', activeMenu: '/system/dict'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/job',
|
path: '/monitor/job-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'log',
|
path: 'index',
|
||||||
component: (resolve) => require(['@/views/monitor/job/log'], resolve),
|
component: (resolve) => require(['@/views/monitor/job/log'], resolve),
|
||||||
name: 'JobLog',
|
name: 'JobLog',
|
||||||
meta: { title: '调度日志' }
|
meta: { title: '调度日志', activeMenu: '/monitor/job'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/gen',
|
path: '/tool/gen-edit',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'edit/:tableId(\\d+)',
|
path: 'index/:tableId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
|
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
|
||||||
name: 'GenEdit',
|
name: 'GenEdit',
|
||||||
meta: { title: '修改生成配置' }
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
39
ruoyi-ui/src/utils/ossdownload.js
Normal file
39
ruoyi-ui/src/utils/ossdownload.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
|
const mimeMap = {
|
||||||
|
oss: 'application/octet-stream'
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseUrl = process.env.VUE_APP_BASE_API
|
||||||
|
export function downLoadOss(ossId) {
|
||||||
|
var url = baseUrl + '/system/oss/download/' + ossId
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||||
|
}).then(res => {
|
||||||
|
resolveBlob(res, mimeMap.oss)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 解析blob响应内容并下载
|
||||||
|
* @param {*} res blob响应内容
|
||||||
|
* @param {String} mimeType MIME类型
|
||||||
|
*/
|
||||||
|
export function resolveBlob(res, mimeType) {
|
||||||
|
const aLink = document.createElement('a')
|
||||||
|
var blob = new Blob([res.data], { type: mimeType })
|
||||||
|
// 从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
|
||||||
|
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||||
|
var contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||||
|
var result = patt.exec(contentDisposition)
|
||||||
|
var fileName = result[1]
|
||||||
|
fileName = fileName.replace(/\"/g, '')
|
||||||
|
aLink.href = URL.createObjectURL(blob)
|
||||||
|
aLink.setAttribute('download', decodeURI(fileName)) // 设置下载文件名称
|
||||||
|
document.body.appendChild(aLink)
|
||||||
|
aLink.click()
|
||||||
|
document.body.removeChild(aLink);
|
||||||
|
}
|
@ -64,6 +64,7 @@ service.interceptors.response.use(res => {
|
|||||||
location.href = '/index';
|
location.href = '/index';
|
||||||
})
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
return Promise.reject('error')
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
Message({
|
Message({
|
||||||
message: msg,
|
message: msg,
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handlePage">搜索(自定义分页接口)</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -168,7 +169,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listDemo, getDemo, delDemo, addDemo, updateDemo, exportDemo } from "@/api/demo/demo";
|
import { listDemo, pageDemo, getDemo, delDemo, addDemo, updateDemo, exportDemo } from "@/api/demo/demo";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Demo",
|
name: "Demo",
|
||||||
@ -239,6 +240,20 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 自定义分页查询 */
|
||||||
|
getPage() {
|
||||||
|
this.loading = true;
|
||||||
|
this.queryParams.params = {};
|
||||||
|
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||||
|
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||||
|
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||||
|
}
|
||||||
|
pageDemo(this.queryParams).then(response => {
|
||||||
|
this.demoList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -267,6 +282,11 @@ export default {
|
|||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handlePage() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getPage();
|
||||||
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.daterangeCreateTime = [];
|
this.daterangeCreateTime = [];
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
* 多数据源框架 dynamic-datasource 支持主从与多种类数据库异构<br/>
|
* 多数据源框架 dynamic-datasource 支持主从与多种类数据库异构<br/>
|
||||||
* Redis客户端 采用 Redisson 性能更强<br/>
|
* Redis客户端 采用 Redisson 性能更强<br/>
|
||||||
* 分布式锁 Lock4j 注解锁、工具锁 多种多样<br/>
|
* 分布式锁 Lock4j 注解锁、工具锁 多种多样<br/>
|
||||||
|
* 部署方式 Docker 容器编排 一键部署业务集群<br/>
|
||||||
|
* 文件存储 OSS 对象存储模块 支持(Minio、七牛、阿里、腾讯)<br/>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>当前版本:</b> <span>v{{ version }}</span>
|
<b>当前版本:</b> <span>v{{ version }}</span>
|
||||||
@ -91,6 +93,37 @@
|
|||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v2.6.0 - 2021-7-28">
|
||||||
|
<ol>
|
||||||
|
<li>add [重大新增] 增加 OSS 对象存储模块</li>
|
||||||
|
<li>remove [重大改动] 删除 自带通用上传 接口 使用OSS模块替换<li>
|
||||||
|
<li>update [重大改动] 重写VO转换 支持深拷贝 将VO类抽象到 ServicePlus 泛型处理<li>
|
||||||
|
<li>update [重大改动] 多BO合并 使用分组校验 生成BO代码<li>
|
||||||
|
<li>update [重大改动] 重构 IServicePlus 功能 增加 BeanCopyUtils 深拷贝工具<li>
|
||||||
|
<li>update springboot 2.4.9 => 2.5.3<li>
|
||||||
|
<li>update hutool 5.7.4 => 5.7.6<li>
|
||||||
|
<li>update minio 8.2.2 => 8.3.0<li>
|
||||||
|
<li>update docker plugin 1.2.0 => 1.2.2<li>
|
||||||
|
<li>update redisson 3.16.0 => 3.16.1<li>
|
||||||
|
<li>update datasource 3.4.0 => 3.4.1<li>
|
||||||
|
<li>update element-ui 2.15.2 => 2.15.3<li>
|
||||||
|
<li>add 演示Demo增加自定义分页接口案例</li>
|
||||||
|
<li>add 角色&菜单新增字段属性提示信息</li>
|
||||||
|
<li>update 更新druid配置 独立配置更明显</li>
|
||||||
|
<li>update 顶部菜单排除隐藏的默认路由</li>
|
||||||
|
<li>update 富文本新增上传文件大小限制</li>
|
||||||
|
<li>update 导入用户样式调整</li>
|
||||||
|
<li>update 顶部菜单样式调整</li>
|
||||||
|
<li>update 密码框新增显示切换密码图标</li>
|
||||||
|
<li>update 内链设置meta信息</li>
|
||||||
|
<li>update 跳转路由高亮相对应的菜单栏</li>
|
||||||
|
<li>fix 修复多数据源druid全局配置缩进错误 引起无效配置问题</li>
|
||||||
|
<li>fix 修复定时任务日志执行状态显示</li>
|
||||||
|
<li>fix 修复 授权角色空数据问题</li>
|
||||||
|
<li>fix 修复 DictData 删除逻辑问题</li>
|
||||||
|
<li>fix 修复任意账户越权漏洞</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v2.5.2 - 2021-7-19">
|
<el-collapse-item title="v2.5.2 - 2021-7-19">
|
||||||
<ol>
|
<ol>
|
||||||
<li>update 优化代码生成器注释格式</li>
|
<li>update 优化代码生成器注释格式</li>
|
||||||
|
@ -115,17 +115,30 @@
|
|||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-caret-right"
|
icon="el-icon-edit"
|
||||||
@click="handleRun(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['monitor:job:changeStatus']"
|
v-hasPermi="['monitor:job:edit']"
|
||||||
>执行一次</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-view"
|
icon="el-icon-delete"
|
||||||
@click="handleView(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['monitor:job:query']"
|
v-hasPermi="['monitor:job:remove']"
|
||||||
>详细</el-button>
|
>删除</el-button>
|
||||||
|
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item command="handleRun" icon="el-icon-caret-right"
|
||||||
|
v-hasPermi="['monitor:job:changeStatus']">执行一次</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="handleView" icon="el-icon-view"
|
||||||
|
v-hasPermi="['monitor:job:query']">任务详细</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="handleJobLog" icon="el-icon-s-operation"
|
||||||
|
v-hasPermi="['monitor:job:query']">调度日志</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -385,6 +398,22 @@ export default {
|
|||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
|
// 更多操作触发
|
||||||
|
handleCommand(command, row) {
|
||||||
|
switch (command) {
|
||||||
|
case "handleRun":
|
||||||
|
this.handleRun(row);
|
||||||
|
break;
|
||||||
|
case "handleView":
|
||||||
|
this.handleView(row);
|
||||||
|
break;
|
||||||
|
case "handleJobLog":
|
||||||
|
this.handleJobLog(row);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
// 任务状态修改
|
// 任务状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
@ -420,8 +449,9 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 任务日志列表查询 */
|
/** 任务日志列表查询 */
|
||||||
handleJobLog() {
|
handleJobLog(row) {
|
||||||
this.$router.push("/job/log");
|
const jobId = row.jobId || 0;
|
||||||
|
this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } })
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
|
@ -94,6 +94,15 @@
|
|||||||
v-hasPermi="['monitor:job:export']"
|
v-hasPermi="['monitor:job:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-close"
|
||||||
|
size="mini"
|
||||||
|
@click="handleClose"
|
||||||
|
>关闭</el-button>
|
||||||
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@ -168,6 +177,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getJob} from "@/api/monitor/job";
|
||||||
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -209,8 +219,17 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
const jobId = this.$route.query.jobId;
|
||||||
this.getDicts("sys_job_status").then(response => {
|
if (jobId !== undefined && jobId != 0) {
|
||||||
|
getJob(jobId).then(response => {
|
||||||
|
this.queryParams.jobName = response.data.jobName;
|
||||||
|
this.queryParams.jobGroup = response.data.jobGroup;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
this.getDicts("sys_common_status").then(response => {
|
||||||
this.statusOptions = response.data;
|
this.statusOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("sys_job_group").then(response => {
|
this.getDicts("sys_job_group").then(response => {
|
||||||
@ -236,6 +255,11 @@ export default {
|
|||||||
jobGroupFormat(row, column) {
|
jobGroupFormat(row, column) {
|
||||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
||||||
},
|
},
|
||||||
|
// 返回按钮
|
||||||
|
handleClose() {
|
||||||
|
this.$store.dispatch("tagsView/delView", this.$route);
|
||||||
|
this.$router.push({ path: "/monitor/job" });
|
||||||
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<router-link :to="'/dict/type/data/' + scope.row.dictId" class="link-type">
|
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
|
||||||
<span>{{ scope.row.dictType }}</span>
|
<span>{{ scope.row.dictType }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
<!-- 添加或修改菜单对话框 -->
|
<!-- 添加或修改菜单对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="上级菜单">
|
<el-form-item label="上级菜单">
|
||||||
@ -144,7 +144,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'F'" label="是否外链">
|
<el-form-item v-if="form.menuType != 'F'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
是否外链
|
||||||
|
</span>
|
||||||
<el-radio-group v-model="form.isFrame">
|
<el-radio-group v-model="form.isFrame">
|
||||||
<el-radio label="0">是</el-radio>
|
<el-radio label="0">是</el-radio>
|
||||||
<el-radio label="1">否</el-radio>
|
<el-radio label="1">否</el-radio>
|
||||||
@ -152,22 +158,46 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'F'" label="路由地址" prop="path">
|
<el-form-item v-if="form.menuType != 'F'" prop="path">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
路由地址
|
||||||
|
</span>
|
||||||
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item label="组件路径" prop="component">
|
<el-form-item prop="component">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
组件路径
|
||||||
|
</span>
|
||||||
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'M'" label="权限标识">
|
<el-form-item v-if="form.menuType != 'M'">
|
||||||
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
权限字符
|
||||||
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'F'" label="显示状态">
|
<el-form-item v-if="form.menuType != 'F'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
显示状态
|
||||||
|
</span>
|
||||||
<el-radio-group v-model="form.visible">
|
<el-radio-group v-model="form.visible">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in visibleOptions"
|
v-for="dict in visibleOptions"
|
||||||
@ -178,7 +208,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'F'" label="菜单状态">
|
<el-form-item v-if="form.menuType != 'F'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
菜单状态
|
||||||
|
</span>
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in statusOptions"
|
||||||
@ -189,7 +225,13 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType == 'C'" label="是否缓存">
|
<el-form-item v-if="form.menuType == 'C'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
是否缓存
|
||||||
|
</span>
|
||||||
<el-radio-group v-model="form.isCache">
|
<el-radio-group v-model="form.isCache">
|
||||||
<el-radio label="0">缓存</el-radio>
|
<el-radio label="0">缓存</el-radio>
|
||||||
<el-radio label="1">不缓存</el-radio>
|
<el-radio label="1">不缓存</el-radio>
|
||||||
|
322
ruoyi-ui/src/views/system/oss/index.vue
Normal file
322
ruoyi-ui/src/views/system/oss/index.vue
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="文件名" prop="fileName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.fileName"
|
||||||
|
placeholder="请输入文件名"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原名" prop="originalName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.originalName"
|
||||||
|
placeholder="请输入原名"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文件后缀" prop="fileSuffix">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.fileSuffix"
|
||||||
|
placeholder="请输入文件后缀"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterangeCreateTime"
|
||||||
|
size="small"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上传人" prop="createBy">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.createBy"
|
||||||
|
placeholder="请输入上传人"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="服务商" prop="service">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.service"
|
||||||
|
placeholder="请输入服务商"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleFile"
|
||||||
|
v-hasPermi="['system:oss:upload']"
|
||||||
|
>上传文件</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleImage"
|
||||||
|
v-hasPermi="['system:oss:upload']"
|
||||||
|
>上传图片</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:oss:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="ossList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="云存储主键" align="center" prop="ossId" v-if="false"/>
|
||||||
|
<el-table-column label="文件名" align="center" prop="fileName" />
|
||||||
|
<el-table-column label="原名" align="center" prop="originalName" />
|
||||||
|
<el-table-column label="文件后缀" align="center" prop="fileSuffix" />
|
||||||
|
<el-table-column label="文件展示" align="center" prop="url">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-image
|
||||||
|
v-if="previewListResource && scope.row.fileSuffix.indexOf('png','jpg','jpeg') > 0"
|
||||||
|
style="width: 100px; height: 100px;"
|
||||||
|
:src="scope.row.url"
|
||||||
|
:preview-src-list="[scope.row.url]"/>
|
||||||
|
<span v-text="scope.row.url"
|
||||||
|
v-if="scope.row.fileSuffix.indexOf('png','jpg','jpeg') < 0 || !previewListResource"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="上传人" align="center" prop="createBy" />
|
||||||
|
<el-table-column label="服务商" align="center" prop="service" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleDownload(scope.row)"
|
||||||
|
v-hasPermi="['system:oss:download']"
|
||||||
|
>下载</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:oss:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改OSS云存储对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="文件名">
|
||||||
|
<fileUpload v-model="form.file" v-if="type === 0"/>
|
||||||
|
<imageUpload v-model="form.file" v-if="type === 1"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listOss, delOss } from "@/api/system/oss";
|
||||||
|
import { downLoadOss } from "@/utils/ossdownload";
|
||||||
|
import { updateConfig } from "@/api/system/config";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Oss",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 导出遮罩层
|
||||||
|
exportLoading: false,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// OSS云存储表格数据
|
||||||
|
ossList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 弹出层标题
|
||||||
|
type: 0,
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 预览列表图片
|
||||||
|
previewListResource: true,
|
||||||
|
// 创建时间时间范围
|
||||||
|
daterangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
fileName: undefined,
|
||||||
|
originalName: undefined,
|
||||||
|
fileSuffix: undefined,
|
||||||
|
url: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
createBy: undefined,
|
||||||
|
service: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
file: [
|
||||||
|
{ required: true, message: "文件不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询OSS云存储列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
this.queryParams.params = {};
|
||||||
|
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||||
|
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||||
|
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||||
|
}
|
||||||
|
this.getConfigKey("sys.oss.previewListResource").then(response => {
|
||||||
|
this.previewListResource = response.msg === undefined ? true : response.msg === 'true';
|
||||||
|
});
|
||||||
|
listOss(this.queryParams).then(response => {
|
||||||
|
this.ossList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
file: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.daterangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.ossId)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 文件按钮操作 */
|
||||||
|
handleFile() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "上传文件";
|
||||||
|
this.type = 0;
|
||||||
|
},
|
||||||
|
/** 图片按钮操作 */
|
||||||
|
handleImage() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "上传图片";
|
||||||
|
this.type = 1;
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 下载按钮操作 */
|
||||||
|
handleDownload(row) {
|
||||||
|
downLoadOss(row.ossId)
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ossIds = row.ossId || this.ids;
|
||||||
|
this.$confirm('是否确认删除OSS云存储编号为"' + ossIds + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delOss(ossIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -139,7 +139,7 @@
|
|||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:role:remove']"
|
v-hasPermi="['system:role:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
|
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
||||||
</span>
|
</span>
|
||||||
@ -164,11 +164,17 @@
|
|||||||
|
|
||||||
<!-- 添加或修改角色配置对话框 -->
|
<!-- 添加或修改角色配置对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="角色名称" prop="roleName">
|
<el-form-item label="角色名称" prop="roleName">
|
||||||
<el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
<el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="权限字符" prop="roleKey">
|
<el-form-item prop="roleKey">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
权限字符
|
||||||
|
</span>
|
||||||
<el-input v-model="form.roleKey" placeholder="请输入权限字符" />
|
<el-input v-model="form.roleKey" placeholder="请输入权限字符" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色顺序" prop="roleSort">
|
<el-form-item label="角色顺序" prop="roleSort">
|
||||||
@ -568,7 +574,7 @@ export default {
|
|||||||
/** 分配用户操作 */
|
/** 分配用户操作 */
|
||||||
handleAuthUser: function(row) {
|
handleAuthUser: function(row) {
|
||||||
const roleId = row.roleId;
|
const roleId = row.roleId;
|
||||||
this.$router.push("/auth/user/" + roleId);
|
this.$router.push("/system/role-auth/user/" + roleId);
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:user:remove']"
|
v-hasPermi="['system:user:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
|
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
<i class="el-icon-d-arrow-right el-icon--right"></i>更多
|
||||||
</span>
|
</span>
|
||||||
@ -242,7 +242,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
||||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" />
|
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -328,15 +328,14 @@
|
|||||||
drag
|
drag
|
||||||
>
|
>
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
将文件拖到此处,或
|
<div class="el-upload__tip text-center" slot="tip">
|
||||||
<em>点击上传</em>
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
|
||||||
|
</div>
|
||||||
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-upload__tip" slot="tip">
|
|
||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
|
||||||
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
|
|
||||||
</div>
|
|
||||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||||
@ -622,7 +621,7 @@ export default {
|
|||||||
/** 分配角色操作 */
|
/** 分配角色操作 */
|
||||||
handleAuthRole: function(row) {
|
handleAuthRole: function(row) {
|
||||||
const userId = row.userId;
|
const userId = row.userId;
|
||||||
this.$router.push("/auth/role/" + userId);
|
this.$router.push("/system/user-auth/role/" + userId);
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="旧密码" prop="oldPassword">
|
<el-form-item label="旧密码" prop="oldPassword">
|
||||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" />
|
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="新密码" prop="newPassword">
|
<el-form-item label="新密码" prop="newPassword">
|
||||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" />
|
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="确认密码" prop="confirmPassword">
|
<el-form-item label="确认密码" prop="confirmPassword">
|
||||||
<el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" />
|
<el-input v-model="user.confirmPassword" placeholder="请确认密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" size="mini" @click="submit">保存</el-button>
|
<el-button type="primary" size="mini" @click="submit">保存</el-button>
|
||||||
|
@ -319,7 +319,7 @@ export default {
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleEditTable(row) {
|
handleEditTable(row) {
|
||||||
const tableId = row.tableId || this.ids[0];
|
const tableId = row.tableId || this.ids[0];
|
||||||
this.$router.push("/gen/edit/" + tableId);
|
this.$router.push("/tool/gen-edit/index/" + tableId);
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>2.5.2</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -230,6 +230,33 @@
|
|||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qiniu</groupId>
|
||||||
|
<artifactId>qiniu-java-sdk</artifactId>
|
||||||
|
<version>${qiniu.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>${aliyun.oss.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qcloud</groupId>
|
||||||
|
<artifactId>cos_api</artifactId>
|
||||||
|
<version>${qcloud.cos.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>${minio.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.core;
|
package com.ruoyi.common.core.mybatisplus.core;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -11,7 +11,6 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义 Service 接口, 实现 数据库实体与 vo 对象转换返回
|
* 自定义 Service 接口, 实现 数据库实体与 vo 对象转换返回
|
||||||
@ -19,225 +18,153 @@ import java.util.stream.Collectors;
|
|||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @since 2021-05-13
|
* @since 2021-05-13
|
||||||
*/
|
*/
|
||||||
public interface IServicePlus<T> extends IService<T> {
|
public interface IServicePlus<T, K> extends IService<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 ID 查询
|
* @param id 主键id
|
||||||
*
|
* @param copyOptions copy条件
|
||||||
* @param kClass vo类型
|
* @return K对象
|
||||||
* @param id 主键ID
|
*/
|
||||||
*/
|
K getVoById(Serializable id, CopyOptions copyOptions);
|
||||||
default <K> K getVoById(Serializable id, Class<K> kClass) {
|
|
||||||
T t = getBaseMapper().selectById(id);
|
|
||||||
return BeanUtil.toBean(t, kClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
default K getVoById(Serializable id) {
|
||||||
* 根据 ID 查询
|
return getVoById(id, new CopyOptions());
|
||||||
*
|
|
||||||
* @param id 主键ID
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @param <K> vo类型
|
|
||||||
*/
|
|
||||||
default <K> K getVoById(Serializable id, Function<T, K> convertor) {
|
|
||||||
T t = getBaseMapper().selectById(id);
|
|
||||||
return convertor.apply(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询(根据ID 批量查询)
|
|
||||||
*
|
|
||||||
* @param kClass vo类型
|
|
||||||
* @param idList 主键ID列表
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVoByIds(Collection<? extends Serializable> idList, Class<K> kClass) {
|
|
||||||
List<T> list = getBaseMapper().selectBatchIds(idList);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return list.stream()
|
|
||||||
.map(any -> BeanUtil.toBean(any, kClass))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询(根据ID 批量查询)
|
|
||||||
*
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @param idList 主键ID列表
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVoByIds(Collection<? extends Serializable> idList,
|
|
||||||
Function<Collection<T>, List<K>> convertor) {
|
|
||||||
List<T> list = getBaseMapper().selectBatchIds(idList);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return convertor.apply(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询(根据 columnMap 条件)
|
|
||||||
*
|
|
||||||
* @param kClass vo类型
|
|
||||||
* @param columnMap 表字段 map 对象
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVoByMap(Map<String, Object> columnMap, Class<K> kClass) {
|
|
||||||
List<T> list = getBaseMapper().selectByMap(columnMap);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return list.stream()
|
|
||||||
.map(any -> BeanUtil.toBean(any, kClass))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询(根据 columnMap 条件)
|
|
||||||
*
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @param columnMap 表字段 map 对象
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVoByMap(Map<String, Object> columnMap,
|
|
||||||
Function<Collection<T>, List<K>> convertor) {
|
|
||||||
List<T> list = getBaseMapper().selectByMap(columnMap);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return convertor.apply(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据 Wrapper,查询一条记录 <br/>
|
|
||||||
* <p>结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")</p>
|
|
||||||
*
|
|
||||||
* @param kClass vo类型
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
|
||||||
default <K> K getVoOne(Wrapper<T> queryWrapper, Class<K> kClass) {
|
|
||||||
return BeanUtil.toBean(getOne(queryWrapper, true), kClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据 Wrapper,查询一条记录 <br/>
|
|
||||||
* <p>结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")</p>
|
|
||||||
*
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
|
||||||
default <K> K getVoOne(Wrapper<T> queryWrapper, Function<T, K> convertor) {
|
|
||||||
return convertor.apply(getOne(queryWrapper, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询列表
|
|
||||||
*
|
|
||||||
* @param kClass vo类型
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVo(Wrapper<T> queryWrapper, Class<K> kClass) {
|
|
||||||
List<T> list = getBaseMapper().selectList(queryWrapper);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return list.stream()
|
|
||||||
.map(any -> BeanUtil.toBean(any, kClass))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询列表
|
|
||||||
*
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVo(Wrapper<T> queryWrapper, Function<Collection<T>, List<K>> convertor) {
|
|
||||||
List<T> list = getBaseMapper().selectList(queryWrapper);
|
|
||||||
if (list == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return convertor.apply(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有
|
|
||||||
*
|
|
||||||
* @param kClass vo类型
|
|
||||||
* @see Wrappers#emptyWrapper()
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVo(Class<K> kClass) {
|
|
||||||
return listVo(Wrappers.emptyWrapper(), kClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有
|
|
||||||
*
|
|
||||||
* @param convertor 转换函数
|
|
||||||
* @see Wrappers#emptyWrapper()
|
|
||||||
*/
|
|
||||||
default <K> List<K> listVo(Function<Collection<T>, List<K>> convertor) {
|
|
||||||
return listVo(Wrappers.emptyWrapper(), convertor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 翻页查询
|
|
||||||
*
|
|
||||||
* @param page 翻页对象
|
|
||||||
* @param queryWrapper 实体对象封装操作类
|
|
||||||
*/
|
|
||||||
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper, Class<K> kClass) {
|
|
||||||
PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper);
|
|
||||||
List<K> volist = result.getRecords().stream()
|
|
||||||
.map(any -> BeanUtil.toBean(any, kClass))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
result.setRecordsVo(volist);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 翻页查询
|
|
||||||
*
|
|
||||||
* @param page 翻页对象
|
|
||||||
* @param queryWrapper 实体对象封装操作类
|
|
||||||
* @param convertor 转换函数
|
|
||||||
*/
|
|
||||||
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper,
|
|
||||||
Function<Collection<T>, List<K>> convertor) {
|
|
||||||
PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper);
|
|
||||||
return result.setRecordsVo(convertor.apply(result.getRecords()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无条件翻页查询
|
|
||||||
*
|
|
||||||
* @param page 翻页对象
|
|
||||||
*/
|
|
||||||
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Class<K> kClass) {
|
|
||||||
return pageVo(page, Wrappers.emptyWrapper(), kClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无条件翻页查询
|
|
||||||
*
|
|
||||||
* @param page 翻页对象
|
|
||||||
* @param convertor 转换函数
|
|
||||||
*/
|
|
||||||
default <K> PagePlus<T, K> pageVo(PagePlus<T, K> page, Function<Collection<T>, List<K>> convertor) {
|
|
||||||
return pageVo(page, Wrappers.emptyWrapper(), convertor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
default boolean saveBatch(Collection<T> entityList) {
|
|
||||||
return saveBatch(entityList, DEFAULT_BATCH_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
default boolean saveOrUpdateBatch(Collection<T> entityList) {
|
* @param convertor 自定义转换器
|
||||||
return saveOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE);
|
*/
|
||||||
|
default K getVoById(Serializable id, Function<T, K> convertor) {
|
||||||
|
return convertor.apply(getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
default boolean updateBatchById(Collection<T> entityList) {
|
* @param idList id列表
|
||||||
return updateBatchById(entityList, DEFAULT_BATCH_SIZE);
|
* @param copyOptions copy条件
|
||||||
|
* @return K对象
|
||||||
|
*/
|
||||||
|
List<K> listVoByIds(Collection<? extends Serializable> idList, CopyOptions copyOptions);
|
||||||
|
|
||||||
|
default List<K> listVoByIds(Collection<? extends Serializable> idList) {
|
||||||
|
return listVoByIds(idList, new CopyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default List<K> listVoByIds(Collection<? extends Serializable> idList,
|
||||||
|
Function<Collection<T>, List<K>> convertor) {
|
||||||
|
List<T> list = getBaseMapper().selectBatchIds(idList);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return convertor.apply(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param columnMap 表字段 map 对象
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @return K对象
|
||||||
|
*/
|
||||||
|
List<K> listVoByMap(Map<String, Object> columnMap, CopyOptions copyOptions);
|
||||||
|
|
||||||
|
default List<K> listVoByMap(Map<String, Object> columnMap) {
|
||||||
|
return listVoByMap(columnMap, new CopyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default List<K> listVoByMap(Map<String, Object> columnMap,
|
||||||
|
Function<Collection<T>, List<K>> convertor) {
|
||||||
|
List<T> list = getBaseMapper().selectByMap(columnMap);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return convertor.apply(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @return K对象
|
||||||
|
*/
|
||||||
|
K getVoOne(Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
||||||
|
|
||||||
|
default K getVoOne(Wrapper<T> queryWrapper) {
|
||||||
|
return getVoOne(queryWrapper, new CopyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default K getVoOne(Wrapper<T> queryWrapper, Function<T, K> convertor) {
|
||||||
|
return convertor.apply(getOne(queryWrapper, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @return K对象
|
||||||
|
*/
|
||||||
|
List<K> listVo(Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
||||||
|
|
||||||
|
default List<K> listVo(Wrapper<T> queryWrapper) {
|
||||||
|
return listVo(queryWrapper, new CopyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default List<K> listVo(Wrapper<T> queryWrapper, Function<Collection<T>, List<K>> convertor) {
|
||||||
|
List<T> list = getBaseMapper().selectList(queryWrapper);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return convertor.apply(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<K> listVo() {
|
||||||
|
return listVo(Wrappers.emptyWrapper());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default List<K> listVo(Function<Collection<T>, List<K>> convertor) {
|
||||||
|
return listVo(Wrappers.emptyWrapper(), convertor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param queryWrapper 查询条件
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @return K对象
|
||||||
|
*/
|
||||||
|
PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper, CopyOptions copyOptions);
|
||||||
|
|
||||||
|
default PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper) {
|
||||||
|
return pageVo(page, queryWrapper, new CopyOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper,
|
||||||
|
Function<Collection<T>, List<K>> convertor) {
|
||||||
|
PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper);
|
||||||
|
return result.setRecordsVo(convertor.apply(result.getRecords()));
|
||||||
|
}
|
||||||
|
|
||||||
|
default PagePlus<T, K> pageVo(PagePlus<T, K> page) {
|
||||||
|
return pageVo(page, Wrappers.emptyWrapper());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param convertor 自定义转换器
|
||||||
|
*/
|
||||||
|
default PagePlus<T, K> pageVo(PagePlus<T, K> page, Function<Collection<T>, List<K>> convertor) {
|
||||||
|
return pageVo(page, Wrappers.emptyWrapper(), convertor);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean saveAll(Collection<T> entityList);
|
boolean saveAll(Collection<T> entityList);
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
package com.ruoyi.common.core.mybatisplus.core;
|
package com.ruoyi.common.core.mybatisplus.core;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.page.PagePlus;
|
||||||
|
import com.ruoyi.common.utils.BeanCopyUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.ResolvableType;
|
import org.springframework.core.ResolvableType;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IServicePlus 实现类
|
* IServicePlus 实现类
|
||||||
@ -15,7 +22,7 @@ import java.util.Collection;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl<M, T> implements IServicePlus<T> {
|
public class ServicePlusImpl<M extends BaseMapperPlus<T>, T, K> extends ServiceImpl<M, T> implements IServicePlus<T, K> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected M baseMapper;
|
protected M baseMapper;
|
||||||
@ -35,6 +42,12 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
|||||||
|
|
||||||
protected Class<T> mapperClass = currentMapperClass();
|
protected Class<T> mapperClass = currentMapperClass();
|
||||||
|
|
||||||
|
protected Class<K> voClass = currentVoClass();
|
||||||
|
|
||||||
|
public Class<K> getVoClass() {
|
||||||
|
return voClass;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<T> currentMapperClass() {
|
protected Class<T> currentMapperClass() {
|
||||||
return (Class<T>) this.getResolvableType().as(ServicePlusImpl.class).getGeneric(0).getType();
|
return (Class<T>) this.getResolvableType().as(ServicePlusImpl.class).getGeneric(0).getType();
|
||||||
@ -45,6 +58,10 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
|||||||
return (Class<T>) this.getResolvableType().as(ServicePlusImpl.class).getGeneric(1).getType();
|
return (Class<T>) this.getResolvableType().as(ServicePlusImpl.class).getGeneric(1).getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Class<K> currentVoClass() {
|
||||||
|
return (Class<K>) this.getResolvableType().as(ServicePlusImpl.class).getGeneric(2).getType();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ResolvableType getResolvableType() {
|
protected ResolvableType getResolvableType() {
|
||||||
return ResolvableType.forClass(ClassUtils.getUserClass(getClass()));
|
return ResolvableType.forClass(ClassUtils.getUserClass(getClass()));
|
||||||
@ -76,6 +93,21 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
|||||||
return super.updateBatchById(entityList, batchSize);
|
return super.updateBatchById(entityList, batchSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveBatch(Collection<T> entityList) {
|
||||||
|
return saveBatch(entityList, DEFAULT_BATCH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateBatch(Collection<T> entityList) {
|
||||||
|
return saveOrUpdateBatch(entityList, DEFAULT_BATCH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateBatchById(Collection<T> entityList) {
|
||||||
|
return updateBatchById(entityList, DEFAULT_BATCH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单sql批量插入( 全量填充 无视数据库默认值 )
|
* 单sql批量插入( 全量填充 无视数据库默认值 )
|
||||||
* 适用于无脑插入
|
* 适用于无脑插入
|
||||||
@ -85,4 +117,83 @@ public class ServicePlusImpl<M extends BaseMapperPlus<T>, T> extends ServiceImpl
|
|||||||
return baseMapper.insertAll(entityList) == entityList.size();
|
return baseMapper.insertAll(entityList) == entityList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 ID 查询
|
||||||
|
*
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public K getVoById(Serializable id, CopyOptions copyOptions) {
|
||||||
|
T t = getBaseMapper().selectById(id);
|
||||||
|
return BeanCopyUtils.oneCopy(t, copyOptions, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询(根据ID 批量查询)
|
||||||
|
*
|
||||||
|
* @param idList 主键ID列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<K> listVoByIds(Collection<? extends Serializable> idList, CopyOptions copyOptions) {
|
||||||
|
List<T> list = getBaseMapper().selectBatchIds(idList);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询(根据 columnMap 条件)
|
||||||
|
*
|
||||||
|
* @param columnMap 表字段 map 对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<K> listVoByMap(Map<String, Object> columnMap, CopyOptions copyOptions) {
|
||||||
|
List<T> list = getBaseMapper().selectByMap(columnMap);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 Wrapper,查询一条记录 <br/>
|
||||||
|
* <p>结果集,如果是多个会抛出异常,随机取一条加上限制条件 wrapper.last("LIMIT 1")</p>
|
||||||
|
*
|
||||||
|
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public K getVoOne(Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
||||||
|
T t = getOne(queryWrapper, true);
|
||||||
|
return BeanCopyUtils.oneCopy(t, copyOptions, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*
|
||||||
|
* @param queryWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.query.QueryWrapper}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<K> listVo(Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
||||||
|
List<T> list = getBaseMapper().selectList(queryWrapper);
|
||||||
|
if (list == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BeanCopyUtils.listCopy(list, copyOptions, voClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 翻页查询
|
||||||
|
*
|
||||||
|
* @param page 翻页对象
|
||||||
|
* @param queryWrapper 实体对象封装操作类
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PagePlus<T, K> pageVo(PagePlus<T, K> page, Wrapper<T> queryWrapper, CopyOptions copyOptions) {
|
||||||
|
PagePlus<T, K> result = getBaseMapper().selectPage(page, queryWrapper);
|
||||||
|
List<K> volist = BeanCopyUtils.listCopy(result.getRecords(), copyOptions, voClass);
|
||||||
|
result.setRecordsVo(volist);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.common.core.validate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验分组 add
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface AddGroup {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.common.core.validate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验分组 edit
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface EditGroup {
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.copier.BeanCopier;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bean深拷贝工具
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class BeanCopyUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单对象基于class创建拷贝
|
||||||
|
*
|
||||||
|
* @param source 数据来源实体
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @param desc 描述对象 转换后的对象
|
||||||
|
* @return desc
|
||||||
|
*/
|
||||||
|
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, Class<V> desc) {
|
||||||
|
V v = ReflectUtil.newInstanceIfPossible(desc);
|
||||||
|
return oneCopy(source, copyOptions, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单对象基于对象创建拷贝
|
||||||
|
*
|
||||||
|
* @param source 数据来源实体
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @param desc 转换后的对象
|
||||||
|
* @return desc
|
||||||
|
*/
|
||||||
|
public static <T, V> V oneCopy(T source, CopyOptions copyOptions, V desc) {
|
||||||
|
return BeanCopier.create(source, desc, copyOptions).copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表对象基于class创建拷贝
|
||||||
|
*
|
||||||
|
* @param sourceList 数据来源实体列表
|
||||||
|
* @param copyOptions copy条件
|
||||||
|
* @param desc 描述对象 转换后的对象
|
||||||
|
* @return desc
|
||||||
|
*/
|
||||||
|
public static <T, V> List<V> listCopy(List<T> sourceList, CopyOptions copyOptions, Class<V> desc) {
|
||||||
|
return sourceList.stream()
|
||||||
|
.map(source -> oneCopy(source, copyOptions, desc))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +0,0 @@
|
|||||||
package com.ruoyi.common.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字符串工具类
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|
||||||
/** 空字符串 */
|
|
||||||
private static final String NULLSTR = "";
|
|
||||||
|
|
||||||
/** 下划线 */
|
|
||||||
private static final char SEPARATOR = '_';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为http(s)://开头
|
|
||||||
*
|
|
||||||
* @param link 链接
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public static boolean ishttp(String link) {
|
|
||||||
return StrUtil.startWithAny(link, Constants.HTTP, Constants.HTTPS);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表添加对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试单表添加对象")
|
|
||||||
public class TestDemoAddBo {
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@ApiModelProperty("排序号")
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
@NotBlank(message = "key键不能为空")
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
@NotBlank(message = "值不能为空")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表编辑对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试单表编辑对象")
|
|
||||||
public class TestDemoEditBo {
|
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@ApiModelProperty("排序号")
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
@NotBlank(message = "key键不能为空")
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
@NotBlank(message = "值不能为空")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表分页查询对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel("测试单表分页查询对象")
|
|
||||||
public class TestDemoQueryBo extends BaseEntity {
|
|
||||||
|
|
||||||
/** 分页大小 */
|
|
||||||
@ApiModelProperty("分页大小")
|
|
||||||
private Integer pageSize;
|
|
||||||
/** 当前页数 */
|
|
||||||
@ApiModelProperty("当前页数")
|
|
||||||
private Integer pageNum;
|
|
||||||
/** 排序列 */
|
|
||||||
@ApiModelProperty("排序列")
|
|
||||||
private String orderByColumn;
|
|
||||||
/** 排序的方向desc或者asc */
|
|
||||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
|
||||||
private String isAsc;
|
|
||||||
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
private String testKey;
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表添加对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试树表添加对象")
|
|
||||||
public class TestTreeAddBo {
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
@ApiModelProperty("父id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
@NotBlank(message = "树节点名不能为空")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表编辑对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试树表编辑对象")
|
|
||||||
public class TestTreeEditBo {
|
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
@ApiModelProperty("父id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
@NotBlank(message = "树节点名不能为空")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表分页查询对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel("测试树表分页查询对象")
|
|
||||||
public class TestTreeQueryBo extends BaseEntity {
|
|
||||||
|
|
||||||
/** 分页大小 */
|
|
||||||
@ApiModelProperty("分页大小")
|
|
||||||
private Integer pageSize;
|
|
||||||
/** 当前页数 */
|
|
||||||
@ApiModelProperty("当前页数")
|
|
||||||
private Integer pageNum;
|
|
||||||
/** 排序列 */
|
|
||||||
@ApiModelProperty("排序列")
|
|
||||||
private String orderByColumn;
|
|
||||||
/** 排序的方向desc或者asc */
|
|
||||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
|
||||||
private String isAsc;
|
|
||||||
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +1,17 @@
|
|||||||
package com.ruoyi.demo.controller;
|
package com.ruoyi.demo.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
import com.ruoyi.demo.domain.bo.TestDemoBo;
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
|
||||||
import com.ruoyi.demo.service.ITestDemoService;
|
import com.ruoyi.demo.service.ITestDemoService;
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -28,8 +29,9 @@ import java.util.List;
|
|||||||
* 测试单表Controller
|
* 测试单表Controller
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
@Api(value = "测试单表控制器", tags = {"测试单表管理"})
|
@Api(value = "测试单表控制器", tags = {"测试单表管理"})
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@ -44,18 +46,28 @@ public class TestDemoController extends BaseController {
|
|||||||
@ApiOperation("查询测试单表列表")
|
@ApiOperation("查询测试单表列表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:list')")
|
@PreAuthorize("@ss.hasPermi('demo:demo:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<TestDemoVo> list(@Validated TestDemoQueryBo bo) {
|
public TableDataInfo<TestDemoVo> list(@Validated TestDemoBo bo) {
|
||||||
return iTestDemoService.queryPageList(bo);
|
return iTestDemoService.queryPageList(bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 自定义分页查询
|
||||||
|
*/
|
||||||
|
@ApiOperation("自定义分页查询")
|
||||||
|
@PreAuthorize("@ss.hasPermi('demo:demo:list')")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public TableDataInfo<TestDemoVo> page(@Validated TestDemoBo bo) {
|
||||||
|
return iTestDemoService.customPageList(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* 导出测试单表列表
|
* 导出测试单表列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("导出测试单表列表")
|
@ApiOperation("导出测试单表列表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:export')")
|
@PreAuthorize("@ss.hasPermi('demo:demo:export')")
|
||||||
@Log(title = "测试单表", businessType = BusinessType.EXPORT)
|
@Log(title = "测试单表", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult<TestDemoVo> export(@Validated TestDemoQueryBo bo) {
|
public AjaxResult<TestDemoVo> export(@Validated TestDemoBo bo) {
|
||||||
List<TestDemoVo> list = iTestDemoService.queryList(bo);
|
List<TestDemoVo> list = iTestDemoService.queryList(bo);
|
||||||
ExcelUtil<TestDemoVo> util = new ExcelUtil<TestDemoVo>(TestDemoVo.class);
|
ExcelUtil<TestDemoVo> util = new ExcelUtil<TestDemoVo>(TestDemoVo.class);
|
||||||
return util.exportExcel(list, "测试单表");
|
return util.exportExcel(list, "测试单表");
|
||||||
@ -78,9 +90,10 @@ public class TestDemoController extends BaseController {
|
|||||||
@ApiOperation("新增测试单表")
|
@ApiOperation("新增测试单表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:add')")
|
@PreAuthorize("@ss.hasPermi('demo:demo:add')")
|
||||||
@Log(title = "测试单表", businessType = BusinessType.INSERT)
|
@Log(title = "测试单表", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public AjaxResult<Void> add(@Validated @RequestBody TestDemoAddBo bo) {
|
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody TestDemoBo bo) {
|
||||||
return toAjax(iTestDemoService.insertByAddBo(bo) ? 1 : 0);
|
return toAjax(iTestDemoService.insertByBo(bo) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,9 +102,10 @@ public class TestDemoController extends BaseController {
|
|||||||
@ApiOperation("修改测试单表")
|
@ApiOperation("修改测试单表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:edit')")
|
@PreAuthorize("@ss.hasPermi('demo:demo:edit')")
|
||||||
@Log(title = "测试单表", businessType = BusinessType.UPDATE)
|
@Log(title = "测试单表", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody TestDemoEditBo bo) {
|
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody TestDemoBo bo) {
|
||||||
return toAjax(iTestDemoService.updateByEditBo(bo) ? 1 : 0);
|
return toAjax(iTestDemoService.updateByBo(bo) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package com.ruoyi.demo.controller;
|
package com.ruoyi.demo.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
import com.ruoyi.demo.domain.bo.TestTreeBo;
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
import com.ruoyi.demo.domain.vo.TestTreeVo;
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.service.ITestTreeService;
|
import com.ruoyi.demo.service.ITestTreeService;
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -27,8 +28,9 @@ import java.util.List;
|
|||||||
* 测试树表Controller
|
* 测试树表Controller
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
|
@Validated
|
||||||
@Api(value = "测试树表控制器", tags = {"测试树表管理"})
|
@Api(value = "测试树表控制器", tags = {"测试树表管理"})
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@ -43,8 +45,9 @@ public class TestTreeController extends BaseController {
|
|||||||
@ApiOperation("查询测试树表列表")
|
@ApiOperation("查询测试树表列表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:list')")
|
@PreAuthorize("@ss.hasPermi('demo:tree:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult<List<TestTreeVo>> list(@Validated TestTreeQueryBo bo) {
|
public AjaxResult<List<TestTreeVo>> list(@Validated TestTreeBo bo) {
|
||||||
return AjaxResult.success(iTestTreeService.queryList(bo));
|
List<TestTreeVo> list = iTestTreeService.queryList(bo);
|
||||||
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +57,7 @@ public class TestTreeController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('demo:tree:export')")
|
@PreAuthorize("@ss.hasPermi('demo:tree:export')")
|
||||||
@Log(title = "测试树表", businessType = BusinessType.EXPORT)
|
@Log(title = "测试树表", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public AjaxResult<TestTreeVo> export(@Validated TestTreeQueryBo bo) {
|
public AjaxResult<TestTreeVo> export(@Validated TestTreeBo bo) {
|
||||||
List<TestTreeVo> list = iTestTreeService.queryList(bo);
|
List<TestTreeVo> list = iTestTreeService.queryList(bo);
|
||||||
ExcelUtil<TestTreeVo> util = new ExcelUtil<TestTreeVo>(TestTreeVo.class);
|
ExcelUtil<TestTreeVo> util = new ExcelUtil<TestTreeVo>(TestTreeVo.class);
|
||||||
return util.exportExcel(list, "测试树表");
|
return util.exportExcel(list, "测试树表");
|
||||||
@ -77,9 +80,10 @@ public class TestTreeController extends BaseController {
|
|||||||
@ApiOperation("新增测试树表")
|
@ApiOperation("新增测试树表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:add')")
|
@PreAuthorize("@ss.hasPermi('demo:tree:add')")
|
||||||
@Log(title = "测试树表", businessType = BusinessType.INSERT)
|
@Log(title = "测试树表", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public AjaxResult<Void> add(@Validated @RequestBody TestTreeAddBo bo) {
|
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody TestTreeBo bo) {
|
||||||
return toAjax(iTestTreeService.insertByAddBo(bo) ? 1 : 0);
|
return toAjax(iTestTreeService.insertByBo(bo) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,9 +92,10 @@ public class TestTreeController extends BaseController {
|
|||||||
@ApiOperation("修改测试树表")
|
@ApiOperation("修改测试树表")
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:edit')")
|
@PreAuthorize("@ss.hasPermi('demo:tree:edit')")
|
||||||
@Log(title = "测试树表", businessType = BusinessType.UPDATE)
|
@Log(title = "测试树表", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody TestTreeEditBo bo) {
|
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody TestTreeBo bo) {
|
||||||
return toAjax(iTestTreeService.updateByEditBo(bo) ? 1 : 0);
|
return toAjax(iTestTreeService.updateByBo(bo) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ import java.util.Date;
|
|||||||
* 测试单表对象 test_demo
|
* 测试单表对象 test_demo
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -32,43 +32,66 @@ public class TestDemo implements Serializable {
|
|||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 部门id */
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户id */
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 排序号 */
|
/**
|
||||||
@OrderBy(isDesc = false, sort = 1)
|
* 排序号
|
||||||
|
*/
|
||||||
|
@OrderBy(isDesc = false, sort = 1)
|
||||||
private Long orderNum;
|
private Long orderNum;
|
||||||
|
|
||||||
/** key键 */
|
/**
|
||||||
|
* key键
|
||||||
|
*/
|
||||||
private String testKey;
|
private String testKey;
|
||||||
|
|
||||||
/** 值 */
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/** 版本 */
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
@Version
|
@Version
|
||||||
private Long version;
|
private Long version;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 创建人 */
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/** 更新时间 */
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/** 更新人 */
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
/** 删除标志 */
|
/**
|
||||||
|
* 删除标志
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
private Long delFlag;
|
private Long delFlag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.ruoyi.demo.domain;
|
package com.ruoyi.demo.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -14,7 +12,7 @@ import java.util.Date;
|
|||||||
* 测试树表对象 test_tree
|
* 测试树表对象 test_tree
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -25,44 +23,65 @@ public class TestTree implements Serializable {
|
|||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
@TableId(value = "id")
|
@TableId(value = "id")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 父id */
|
/**
|
||||||
|
* 父id
|
||||||
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/** 部门id */
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户id */
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 树节点名 */
|
/**
|
||||||
|
* 树节点名
|
||||||
|
*/
|
||||||
private String treeName;
|
private String treeName;
|
||||||
|
|
||||||
/** 版本 */
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
@Version
|
@Version
|
||||||
private Long version;
|
private Long version;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 创建人 */
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/** 更新时间 */
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/** 更新人 */
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
/** 删除标志 */
|
/**
|
||||||
|
* 删除标志
|
||||||
|
*/
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Long delFlag;
|
private Long delFlag;
|
||||||
|
|
||||||
|
94
ruoyi/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java
Normal file
94
ruoyi/src/main/java/com/ruoyi/demo/domain/bo/TestDemoBo.java
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package com.ruoyi.demo.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试单表业务对象 test_demo
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2021-07-26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel("测试单表业务对象")
|
||||||
|
public class TestDemoBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
@NotNull(message = "部门id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序号")
|
||||||
|
@NotNull(message = "排序号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("key键")
|
||||||
|
@NotBlank(message = "key键不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String testKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("值")
|
||||||
|
@NotBlank(message = "值不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页大小
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("分页大小")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前页数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序列
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序列")
|
||||||
|
private String orderByColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序的方向desc或者asc
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
|
private String isAsc;
|
||||||
|
|
||||||
|
}
|
79
ruoyi/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java
Normal file
79
ruoyi/src/main/java/com/ruoyi/demo/domain/bo/TestTreeBo.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package com.ruoyi.demo.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试树表业务对象 test_tree
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2021-07-26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel("测试树表业务对象")
|
||||||
|
public class TestTreeBo extends TreeEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("部门id")
|
||||||
|
@NotNull(message = "部门id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树节点名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("树节点名")
|
||||||
|
@NotBlank(message = "树节点名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String treeName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页大小
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("分页大小")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前页数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序列
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序列")
|
||||||
|
private String orderByColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序的方向desc或者asc
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
|
private String isAsc;
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,9 @@
|
|||||||
package com.ruoyi.demo.vo;
|
package com.ruoyi.demo.domain.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -15,7 +12,7 @@ import java.util.Date;
|
|||||||
* 测试单表视图对象 test_demo
|
* 测试单表视图对象 test_demo
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("测试单表视图对象")
|
@ApiModel("测试单表视图对象")
|
||||||
@ -24,57 +21,70 @@ public class TestDemoVo {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
* 如果是自定义id 或者 雪花id
|
*/
|
||||||
* 需要增加序列化为字符串注解 因为Long到前端会失真
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 部门id */
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
@Excel(name = "部门id")
|
@Excel(name = "部门id")
|
||||||
@ApiModelProperty("部门id")
|
@ApiModelProperty("部门id")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户id */
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
@Excel(name = "用户id")
|
@Excel(name = "用户id")
|
||||||
@ApiModelProperty("用户id")
|
@ApiModelProperty("用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 排序号 */
|
/**
|
||||||
|
* 排序号
|
||||||
|
*/
|
||||||
@Excel(name = "排序号")
|
@Excel(name = "排序号")
|
||||||
@ApiModelProperty("排序号")
|
@ApiModelProperty("排序号")
|
||||||
private Long orderNum;
|
private Long orderNum;
|
||||||
|
|
||||||
/** key键 */
|
/**
|
||||||
|
* key键
|
||||||
|
*/
|
||||||
@Excel(name = "key键")
|
@Excel(name = "key键")
|
||||||
@ApiModelProperty("key键")
|
@ApiModelProperty("key键")
|
||||||
private String testKey;
|
private String testKey;
|
||||||
|
|
||||||
/** 值 */
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
@Excel(name = "值")
|
@Excel(name = "值")
|
||||||
@ApiModelProperty("值")
|
@ApiModelProperty("值")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 创建人 */
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
@Excel(name = "创建人")
|
@Excel(name = "创建人")
|
||||||
@ApiModelProperty("创建人")
|
@ApiModelProperty("创建人")
|
||||||
private String createBy;
|
private String createBy;
|
||||||
|
|
||||||
/** 更新时间 */
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("更新时间")
|
@ApiModelProperty("更新时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/** 更新人 */
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
@Excel(name = "更新人")
|
@Excel(name = "更新人")
|
||||||
@ApiModelProperty("更新人")
|
@ApiModelProperty("更新人")
|
||||||
private String updateBy;
|
private String updateBy;
|
@ -1,13 +1,9 @@
|
|||||||
package com.ruoyi.demo.vo;
|
package com.ruoyi.demo.domain.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +12,7 @@ import java.util.Date;
|
|||||||
* 测试树表视图对象 test_tree
|
* 测试树表视图对象 test_tree
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("测试树表视图对象")
|
@ApiModel("测试树表视图对象")
|
||||||
@ -24,34 +20,44 @@ public class TestTreeVo {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
@ApiModelProperty("主键")
|
@ApiModelProperty("主键")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 父id */
|
/**
|
||||||
|
* 父id
|
||||||
|
*/
|
||||||
@Excel(name = "父id")
|
@Excel(name = "父id")
|
||||||
@ApiModelProperty("父id")
|
@ApiModelProperty("父id")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/** 部门id */
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
@Excel(name = "部门id")
|
@Excel(name = "部门id")
|
||||||
@ApiModelProperty("部门id")
|
@ApiModelProperty("部门id")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户id */
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
@Excel(name = "用户id")
|
@Excel(name = "用户id")
|
||||||
@ApiModelProperty("用户id")
|
@ApiModelProperty("用户id")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 树节点名 */
|
/**
|
||||||
|
* 树节点名
|
||||||
|
*/
|
||||||
@Excel(name = "树节点名")
|
@Excel(name = "树节点名")
|
||||||
@ApiModelProperty("树节点名")
|
@ApiModelProperty("树节点名")
|
||||||
private String treeName;
|
private String treeName;
|
||||||
|
|
||||||
/** 创建时间 */
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("创建时间")
|
@ApiModelProperty("创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
@ -1,18 +1,24 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
package com.ruoyi.demo.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
import com.ruoyi.demo.domain.TestDemo;
|
||||||
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
import org.apache.ibatis.annotations.CacheNamespace;
|
import org.apache.ibatis.annotations.CacheNamespace;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试单表Mapper接口
|
* 测试单表Mapper接口
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||||
public interface TestDemoMapper extends BaseMapperPlus<TestDemo> {
|
public interface TestDemoMapper extends BaseMapperPlus<TestDemo> {
|
||||||
|
|
||||||
|
Page<TestDemoVo> customPageList(@Param("page") Page<TestDemo> page, @Param("ew") Wrapper<TestDemo> wrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,8 @@ import com.ruoyi.demo.domain.TestTree;
|
|||||||
* 测试树表Mapper接口
|
* 测试树表Mapper接口
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
//@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
|
||||||
public interface TestTreeMapper extends BaseMapperPlus<TestTree> {
|
public interface TestTreeMapper extends BaseMapperPlus<TestTree> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.ruoyi.demo.service;
|
package com.ruoyi.demo.service;
|
||||||
|
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
import com.ruoyi.demo.domain.TestDemo;
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
import com.ruoyi.demo.domain.bo.TestDemoBo;
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
@ -15,9 +13,9 @@ import java.util.List;
|
|||||||
* 测试单表Service接口
|
* 测试单表Service接口
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
public interface ITestDemoService extends IServicePlus<TestDemo> {
|
public interface ITestDemoService extends IServicePlus<TestDemo, TestDemoVo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单个
|
* 查询单个
|
||||||
@ -28,25 +26,31 @@ public interface ITestDemoService extends IServicePlus<TestDemo> {
|
|||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
*/
|
*/
|
||||||
TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo);
|
TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 自定义分页查询
|
||||||
|
*/
|
||||||
|
TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
*/
|
*/
|
||||||
List<TestDemoVo> queryList(TestDemoQueryBo bo);
|
List<TestDemoVo> queryList(TestDemoBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据新增业务对象插入测试单表
|
* 根据新增业务对象插入测试单表
|
||||||
* @param bo 测试单表新增业务对象
|
* @param bo 测试单表新增业务对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean insertByAddBo(TestDemoAddBo bo);
|
Boolean insertByBo(TestDemoBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据编辑业务对象修改测试单表
|
* 根据编辑业务对象修改测试单表
|
||||||
* @param bo 测试单表编辑业务对象
|
* @param bo 测试单表编辑业务对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateByEditBo(TestDemoEditBo bo);
|
Boolean updateByBo(TestDemoBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验并删除数据
|
* 校验并删除数据
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.ruoyi.demo.service;
|
package com.ruoyi.demo.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
import com.ruoyi.demo.domain.TestTree;
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
import com.ruoyi.demo.domain.vo.TestTreeVo;
|
||||||
|
import com.ruoyi.demo.domain.bo.TestTreeBo;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -14,9 +12,9 @@ import java.util.List;
|
|||||||
* 测试树表Service接口
|
* 测试树表Service接口
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
public interface ITestTreeService extends IServicePlus<TestTree> {
|
public interface ITestTreeService extends IServicePlus<TestTree, TestTreeVo> {
|
||||||
/**
|
/**
|
||||||
* 查询单个
|
* 查询单个
|
||||||
* @return
|
* @return
|
||||||
@ -26,21 +24,21 @@ public interface ITestTreeService extends IServicePlus<TestTree> {
|
|||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
*/
|
*/
|
||||||
List<TestTreeVo> queryList(TestTreeQueryBo bo);
|
List<TestTreeVo> queryList(TestTreeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据新增业务对象插入测试树表
|
* 根据新增业务对象插入测试树表
|
||||||
* @param bo 测试树表新增业务对象
|
* @param bo 测试树表新增业务对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean insertByAddBo(TestTreeAddBo bo);
|
Boolean insertByBo(TestTreeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据编辑业务对象修改测试树表
|
* 根据编辑业务对象修改测试树表
|
||||||
* @param bo 测试树表编辑业务对象
|
* @param bo 测试树表编辑业务对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateByEditBo(TestTreeEditBo bo);
|
Boolean updateByBo(TestTreeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验并删除数据
|
* 校验并删除数据
|
||||||
|
@ -4,18 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.common.core.page.PagePlus;
|
import com.ruoyi.common.core.page.PagePlus;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
import com.ruoyi.demo.domain.TestDemo;
|
||||||
|
import com.ruoyi.demo.domain.bo.TestDemoBo;
|
||||||
|
import com.ruoyi.demo.domain.vo.TestDemoVo;
|
||||||
import com.ruoyi.demo.mapper.TestDemoMapper;
|
import com.ruoyi.demo.mapper.TestDemoMapper;
|
||||||
import com.ruoyi.demo.service.ITestDemoService;
|
import com.ruoyi.demo.service.ITestDemoService;
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -26,30 +25,40 @@ import java.util.Map;
|
|||||||
* 测试单表Service业务层处理
|
* 测试单表Service业务层处理
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDemo> implements ITestDemoService {
|
public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDemo, TestDemoVo> implements ITestDemoService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestDemoVo queryById(Long id) {
|
public TestDemoVo queryById(Long id) {
|
||||||
return getVoById(id, TestDemoVo.class);
|
return getVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
@DataScope(isUser = true)
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo) {
|
public TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo) {
|
||||||
PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), TestDemoVo.class);
|
PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
||||||
|
return PageUtils.buildDataInfo(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义分页查询
|
||||||
|
*/
|
||||||
|
@DataScope(isUser = true)
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo) {
|
||||||
|
Page<TestDemoVo> result = baseMapper.customPageList(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||||
return PageUtils.buildDataInfo(result);
|
return PageUtils.buildDataInfo(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
@DataScope(isUser = true)
|
||||||
@Override
|
@Override
|
||||||
public List<TestDemoVo> queryList(TestDemoQueryBo bo) {
|
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
||||||
return listVo(buildQueryWrapper(bo), TestDemoVo.class);
|
return listVo(buildQueryWrapper(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoQueryBo bo) {
|
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
Object dataScope = params.get("dataScope");
|
Object dataScope = params.get("dataScope");
|
||||||
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
||||||
@ -63,14 +72,14 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByAddBo(TestDemoAddBo bo) {
|
public Boolean insertByBo(TestDemoBo bo) {
|
||||||
TestDemo add = BeanUtil.toBean(bo, TestDemo.class);
|
TestDemo add = BeanUtil.toBean(bo, TestDemo.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
return save(add);
|
return save(add);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByEditBo(TestDemoEditBo bo) {
|
public Boolean updateByBo(TestDemoBo bo) {
|
||||||
TestDemo update = BeanUtil.toBean(bo, TestDemo.class);
|
TestDemo update = BeanUtil.toBean(bo, TestDemo.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return updateById(update);
|
return updateById(update);
|
||||||
|
@ -6,13 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
import com.ruoyi.demo.domain.TestTree;
|
||||||
|
import com.ruoyi.demo.domain.bo.TestTreeBo;
|
||||||
|
import com.ruoyi.demo.domain.vo.TestTreeVo;
|
||||||
import com.ruoyi.demo.mapper.TestTreeMapper;
|
import com.ruoyi.demo.mapper.TestTreeMapper;
|
||||||
import com.ruoyi.demo.service.ITestTreeService;
|
import com.ruoyi.demo.service.ITestTreeService;
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -23,24 +21,24 @@ import java.util.Map;
|
|||||||
* 测试树表Service业务层处理
|
* 测试树表Service业务层处理
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2021-05-30
|
* @date 2021-07-26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTree> implements ITestTreeService {
|
public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTree, TestTreeVo> implements ITestTreeService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TestTreeVo queryById(Long id) {
|
public TestTreeVo queryById(Long id) {
|
||||||
return getVoById(id, TestTreeVo.class);
|
return getVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @DataSource(DataSourceType.SLAVE) // 切换从库查询
|
// @DataSource(DataSourceType.SLAVE) // 切换从库查询
|
||||||
@DataScope(isUser = true)
|
@DataScope(isUser = true)
|
||||||
@Override
|
@Override
|
||||||
public List<TestTreeVo> queryList(TestTreeQueryBo bo) {
|
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
||||||
return listVo(buildQueryWrapper(bo), TestTreeVo.class);
|
return listVo(buildQueryWrapper(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeQueryBo bo) {
|
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
Object dataScope = params.get("dataScope");
|
Object dataScope = params.get("dataScope");
|
||||||
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
||||||
@ -53,14 +51,14 @@ public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTre
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByAddBo(TestTreeAddBo bo) {
|
public Boolean insertByBo(TestTreeBo bo) {
|
||||||
TestTree add = BeanUtil.toBean(bo, TestTree.class);
|
TestTree add = BeanUtil.toBean(bo, TestTree.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
return save(add);
|
return save(add);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByEditBo(TestTreeEditBo bo) {
|
public Boolean updateByBo(TestTreeBo bo) {
|
||||||
TestTree update = BeanUtil.toBean(bo, TestTree.class);
|
TestTree update = BeanUtil.toBean(bo, TestTree.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return updateById(update);
|
return updateById(update);
|
||||||
|
@ -65,7 +65,7 @@ public class SysLoginService
|
|||||||
// 验证码开关
|
// 验证码开关
|
||||||
if (captchaOnOff)
|
if (captchaOnOff)
|
||||||
{
|
{
|
||||||
validateCapcha(username, code, uuid, request);
|
validateCaptcha(username, code, uuid, request);
|
||||||
}
|
}
|
||||||
// 用户验证
|
// 用户验证
|
||||||
Authentication authentication = null;
|
Authentication authentication = null;
|
||||||
@ -103,7 +103,7 @@ public class SysLoginService
|
|||||||
* @param uuid 唯一标识
|
* @param uuid 唯一标识
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public void validateCapcha(String username, String code, String uuid, HttpServletRequest request) {
|
public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
|
||||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||||
String captcha = redisCache.getCacheObject(verifyKey);
|
String captcha = redisCache.getCacheObject(verifyKey);
|
||||||
redisCache.deleteObject(verifyKey);
|
redisCache.deleteObject(verifyKey);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.generator.service;
|
package com.ruoyi.generator.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.generator.domain.GenTableColumn;
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
import com.ruoyi.generator.mapper.GenTableColumnMapper;
|
import com.ruoyi.generator.mapper.GenTableColumnMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class GenTableColumnServiceImpl extends ServicePlusImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService {
|
public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务字段列表
|
* 查询业务字段列表
|
||||||
|
@ -6,9 +6,9 @@ import cn.hutool.core.lang.Validator;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.GenConstants;
|
import com.ruoyi.common.constant.GenConstants;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.CustomException;
|
import com.ruoyi.common.exception.CustomException;
|
||||||
import com.ruoyi.common.utils.JsonUtils;
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
@ -35,7 +35,10 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
@ -47,7 +50,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTable> implements IGenTableService {
|
public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> implements IGenTableService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GenTableColumnMapper genTableColumnMapper;
|
private GenTableColumnMapper genTableColumnMapper;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.generator.service;
|
package com.ruoyi.generator.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.generator.domain.GenTableColumn;
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface IGenTableColumnService extends IServicePlus<GenTableColumn> {
|
public interface IGenTableColumnService extends IService<GenTableColumn> {
|
||||||
/**
|
/**
|
||||||
* 查询业务字段列表
|
* 查询业务字段列表
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.generator.service;
|
package com.ruoyi.generator.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.generator.domain.GenTable;
|
import com.ruoyi.generator.domain.GenTable;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface IGenTableService extends IServicePlus<GenTable> {
|
public interface IGenTableService extends IService<GenTable> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable);
|
TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable);
|
||||||
|
@ -132,9 +132,7 @@ public class VelocityUtils
|
|||||||
List<String> templates = new ArrayList<String>();
|
List<String> templates = new ArrayList<String>();
|
||||||
templates.add("vm/java/domain.java.vm");
|
templates.add("vm/java/domain.java.vm");
|
||||||
templates.add("vm/java/vo.java.vm");
|
templates.add("vm/java/vo.java.vm");
|
||||||
templates.add("vm/java/queryBo.java.vm");
|
templates.add("vm/java/bo.java.vm");
|
||||||
templates.add("vm/java/addBo.java.vm");
|
|
||||||
templates.add("vm/java/editBo.java.vm");
|
|
||||||
templates.add("vm/java/mapper.java.vm");
|
templates.add("vm/java/mapper.java.vm");
|
||||||
templates.add("vm/java/service.java.vm");
|
templates.add("vm/java/service.java.vm");
|
||||||
templates.add("vm/java/serviceImpl.java.vm");
|
templates.add("vm/java/serviceImpl.java.vm");
|
||||||
@ -184,20 +182,12 @@ public class VelocityUtils
|
|||||||
}
|
}
|
||||||
if (template.contains("vo.java.vm"))
|
if (template.contains("vo.java.vm"))
|
||||||
{
|
{
|
||||||
fileName = StrUtil.format("{}/vo/{}Vo.java", javaPath, className);
|
fileName = StrUtil.format("{}/domain/vo/{}Vo.java", javaPath, className);
|
||||||
}
|
|
||||||
if (template.contains("queryBo.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StrUtil.format("{}/bo/{}QueryBo.java", javaPath, className);
|
|
||||||
}
|
|
||||||
if (template.contains("addBo.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StrUtil.format("{}/bo/{}AddBo.java", javaPath, className);
|
|
||||||
}
|
|
||||||
if (template.contains("editBo.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StrUtil.format("{}/bo/{}EditBo.java", javaPath, className);
|
|
||||||
}
|
}
|
||||||
|
if (template.contains("bo.java.vm"))
|
||||||
|
{
|
||||||
|
fileName = StrUtil.format("{}/domain/bo/{}Bo.java", javaPath, className);
|
||||||
|
}
|
||||||
if (template.contains("sub-domain.java.vm") && StrUtil.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
if (template.contains("sub-domain.java.vm") && StrUtil.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
||||||
{
|
{
|
||||||
fileName = StrUtil.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
fileName = StrUtil.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.oss.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储常量
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class CloudConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置KEY
|
||||||
|
*/
|
||||||
|
public final static String CLOUD_STORAGE_CONFIG_KEY = "sys.oss.cloudStorageService";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预览列表资源开关Key
|
||||||
|
*/
|
||||||
|
public final static String PEREVIEW_LIST_RESOURCE_KEY = "sys.oss.previewListResource";
|
||||||
|
|
||||||
|
}
|
26
ruoyi/src/main/java/com/ruoyi/oss/entity/UploadResult.java
Normal file
26
ruoyi/src/main/java/com/ruoyi/oss/entity/UploadResult.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.oss.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传返回体
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class UploadResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String filename;
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.oss.enumd;
|
||||||
|
|
||||||
|
import com.ruoyi.oss.service.impl.AliyunCloudStorageServiceImpl;
|
||||||
|
import com.ruoyi.oss.service.impl.MinioCloudStorageServiceImpl;
|
||||||
|
import com.ruoyi.oss.service.impl.QcloudCloudStorageServiceImpl;
|
||||||
|
import com.ruoyi.oss.service.impl.QiniuCloudStorageServiceImpl;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储服务商枚举
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum CloudServiceEnumd {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛云
|
||||||
|
*/
|
||||||
|
QINIU("qiniu", QiniuCloudStorageServiceImpl.class),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云
|
||||||
|
*/
|
||||||
|
ALIYUN("aliyun", AliyunCloudStorageServiceImpl.class),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云
|
||||||
|
*/
|
||||||
|
QCLOUD("qcloud", QcloudCloudStorageServiceImpl.class),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio
|
||||||
|
*/
|
||||||
|
MINIO("minio", MinioCloudStorageServiceImpl.class);
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
private final Class<?> serviceClass;
|
||||||
|
|
||||||
|
public static Class<?> getServiceClass(String value) {
|
||||||
|
for (CloudServiceEnumd clazz : values()) {
|
||||||
|
if (clazz.getValue().equals(value)) {
|
||||||
|
return clazz.getServiceClass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
51
ruoyi/src/main/java/com/ruoyi/oss/enumd/PolicyType.java
Normal file
51
ruoyi/src/main/java/com/ruoyi/oss/enumd/PolicyType.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
* Author: Chill 庄骞 (smallchill@163.com)
|
||||||
|
*/
|
||||||
|
package com.ruoyi.oss.enumd;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio策略配置
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PolicyType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只读
|
||||||
|
*/
|
||||||
|
READ("read-only"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只写
|
||||||
|
*/
|
||||||
|
WRITE("write-only"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读写
|
||||||
|
*/
|
||||||
|
READ_WRITE("read-write");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final String type;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.oss.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS异常类
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class OssException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public OssException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
45
ruoyi/src/main/java/com/ruoyi/oss/factory/OssFactory.java
Normal file
45
ruoyi/src/main/java/com/ruoyi/oss/factory/OssFactory.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package com.ruoyi.oss.factory;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.oss.constant.CloudConstant;
|
||||||
|
import com.ruoyi.oss.enumd.CloudServiceEnumd;
|
||||||
|
import com.ruoyi.oss.service.ICloudStorageService;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传Factory
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class OssFactory {
|
||||||
|
|
||||||
|
private static ISysConfigService sysConfigService;
|
||||||
|
|
||||||
|
static {
|
||||||
|
OssFactory.sysConfigService = SpringUtils.getBean(ISysConfigService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, ICloudStorageService> SERVICES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static ICloudStorageService instance() {
|
||||||
|
String type = sysConfigService.selectConfigByKey(CloudConstant.CLOUD_STORAGE_CONFIG_KEY);
|
||||||
|
return instance(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ICloudStorageService instance(String type) {
|
||||||
|
ICloudStorageService service = SERVICES.get(type);
|
||||||
|
if (service == null) {
|
||||||
|
service = (ICloudStorageService) SpringUtils.getBean(CloudServiceEnumd.getServiceClass(type));
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(String type, ICloudStorageService iCloudStorageService) {
|
||||||
|
Assert.notNull(type, "type can't be null");
|
||||||
|
SERVICES.put(type, iCloudStorageService);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,187 @@
|
|||||||
|
package com.ruoyi.oss.properties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS云存储 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "cloud-storage")
|
||||||
|
public class CloudStorageProperties {
|
||||||
|
|
||||||
|
private Boolean previewListImage;
|
||||||
|
|
||||||
|
private QiniuProperties qiniu;
|
||||||
|
|
||||||
|
private AliyunProperties aliyun;
|
||||||
|
|
||||||
|
private QcloudProperties qcloud;
|
||||||
|
|
||||||
|
private MinioProperties minio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class AliyunProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云绑定的域名
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云路径前缀
|
||||||
|
*/
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云AccessKeyId
|
||||||
|
*/
|
||||||
|
private String accessKeyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云AccessKeySecret
|
||||||
|
*/
|
||||||
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云BucketName
|
||||||
|
*/
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minio 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class MinioProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio域名
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio ACCESS_KEY
|
||||||
|
*/
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio SECRET_KEY
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio 存储空间名
|
||||||
|
*/
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云COS 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class QcloudProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云绑定的域名
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云路径前缀
|
||||||
|
*/
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云SecretId
|
||||||
|
*/
|
||||||
|
private String secretId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云SecretKey
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云BucketName
|
||||||
|
*/
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛是否使用https
|
||||||
|
*/
|
||||||
|
private Boolean isHttps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云COS所属地区
|
||||||
|
*/
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛云 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class QiniuProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛绑定的域名
|
||||||
|
*/
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛路径前缀
|
||||||
|
*/
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛ACCESS_KEY
|
||||||
|
*/
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛SECRET_KEY
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛存储空间名
|
||||||
|
*/
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛存储区域
|
||||||
|
*/
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛是否使用https
|
||||||
|
*/
|
||||||
|
private Boolean isHttps;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.ruoyi.oss.service;
|
||||||
|
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储服务接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface ICloudStorageService {
|
||||||
|
|
||||||
|
void createBucket();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务商类型
|
||||||
|
*/
|
||||||
|
String getServiceType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*
|
||||||
|
* @param prefix 前缀
|
||||||
|
* @param suffix 后缀
|
||||||
|
* @return 返回上传路径
|
||||||
|
*/
|
||||||
|
String getPath(String prefix, String suffix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
*
|
||||||
|
* @param data 文件字节数组
|
||||||
|
* @param path 文件路径,包含文件名
|
||||||
|
* @return 返回http地址
|
||||||
|
*/
|
||||||
|
UploadResult upload(byte[] data, String path, String contentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件删除
|
||||||
|
*
|
||||||
|
* @param path 文件路径,包含文件名
|
||||||
|
*/
|
||||||
|
void delete(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
*
|
||||||
|
* @param data 文件字节数组
|
||||||
|
* @param suffix 后缀
|
||||||
|
* @return 返回http地址
|
||||||
|
*/
|
||||||
|
UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
*
|
||||||
|
* @param inputStream 字节流
|
||||||
|
* @param path 文件路径,包含文件名
|
||||||
|
* @return 返回http地址
|
||||||
|
*/
|
||||||
|
UploadResult upload(InputStream inputStream, String path, String contentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传
|
||||||
|
*
|
||||||
|
* @param inputStream 字节流
|
||||||
|
* @param suffix 后缀
|
||||||
|
* @return 返回http地址
|
||||||
|
*/
|
||||||
|
UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
||||||
|
|
||||||
|
String getEndpointLink();
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.ruoyi.oss.service.abstractd;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
import com.ruoyi.oss.service.ICloudStorageService;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储(支持七牛、阿里云、腾讯云、minio)
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public abstract class AbstractCloudStorageService implements ICloudStorageService, InitializingBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void createBucket();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract String getServiceType();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPath(String prefix, String suffix) {
|
||||||
|
// 生成uuid
|
||||||
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
|
// 文件路径
|
||||||
|
String path = DateUtil.format(new Date(), "yyyyMMdd") + "/" + uuid;
|
||||||
|
if (StrUtil.isNotBlank(prefix)) {
|
||||||
|
path = prefix + "/" + path;
|
||||||
|
}
|
||||||
|
return path + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract UploadResult upload(byte[] data, String path, String contentType);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void delete(String path);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
|
byte[] data = IoUtil.readBytes(inputStream);
|
||||||
|
return this.upload(data, path, contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void afterPropertiesSet() throws Exception;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract String getEndpointLink();
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
package com.ruoyi.oss.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.aliyun.oss.ClientConfiguration;
|
||||||
|
import com.aliyun.oss.OSSClient;
|
||||||
|
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||||
|
import com.aliyun.oss.model.CannedAccessControlList;
|
||||||
|
import com.aliyun.oss.model.CreateBucketRequest;
|
||||||
|
import com.aliyun.oss.model.ObjectMetadata;
|
||||||
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
import com.ruoyi.oss.enumd.CloudServiceEnumd;
|
||||||
|
import com.ruoyi.oss.exception.OssException;
|
||||||
|
import com.ruoyi.oss.factory.OssFactory;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties.AliyunProperties;
|
||||||
|
import com.ruoyi.oss.service.abstractd.AbstractCloudStorageService;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云存储
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Lazy
|
||||||
|
@Service
|
||||||
|
public class AliyunCloudStorageServiceImpl extends AbstractCloudStorageService implements InitializingBean {
|
||||||
|
|
||||||
|
private final OSSClient client;
|
||||||
|
private final AliyunProperties properties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AliyunCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||||
|
this.properties = properties.getAliyun();
|
||||||
|
try {
|
||||||
|
ClientConfiguration configuration = new ClientConfiguration();
|
||||||
|
DefaultCredentialProvider credentialProvider = new DefaultCredentialProvider(
|
||||||
|
this.properties.getAccessKeyId(),
|
||||||
|
this.properties.getAccessKeySecret());
|
||||||
|
client = new OSSClient(this.properties.getEndpoint(), credentialProvider, configuration);
|
||||||
|
createBucket();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("阿里云存储配置错误! 请检查系统配置!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createBucket() {
|
||||||
|
try {
|
||||||
|
String bucketName = properties.getBucketName();
|
||||||
|
if (client.doesBucketExist(bucketName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
||||||
|
createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
|
||||||
|
client.createBucket(createBucketRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("创建Bucket失败, 请核对阿里云配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServiceType() {
|
||||||
|
return CloudServiceEnumd.ALIYUN.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
|
try {
|
||||||
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
metadata.setContentType(contentType);
|
||||||
|
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请检查阿里云配置信息");
|
||||||
|
}
|
||||||
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(String path) {
|
||||||
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
|
try {
|
||||||
|
client.deleteObject(properties.getBucketName(), path);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请检查阿里云配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
OssFactory.register(getServiceType(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEndpointLink() {
|
||||||
|
String endpoint = properties.getEndpoint();
|
||||||
|
StringBuilder sb = new StringBuilder(endpoint);
|
||||||
|
if (StrUtil.containsAnyIgnoreCase(endpoint, "http://")) {
|
||||||
|
sb.insert(7, properties.getBucketName() + ".");
|
||||||
|
} else if (StrUtil.containsAnyIgnoreCase(endpoint, "https://")) {
|
||||||
|
sb.insert(8, properties.getBucketName() + ".");
|
||||||
|
} else {
|
||||||
|
throw new OssException("Endpoint配置错误");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,195 @@
|
|||||||
|
package com.ruoyi.oss.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
import com.ruoyi.oss.enumd.CloudServiceEnumd;
|
||||||
|
import com.ruoyi.oss.enumd.PolicyType;
|
||||||
|
import com.ruoyi.oss.exception.OssException;
|
||||||
|
import com.ruoyi.oss.factory.OssFactory;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties.MinioProperties;
|
||||||
|
import com.ruoyi.oss.service.abstractd.AbstractCloudStorageService;
|
||||||
|
import io.minio.*;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* minio存储
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Lazy
|
||||||
|
@Service
|
||||||
|
public class MinioCloudStorageServiceImpl extends AbstractCloudStorageService implements InitializingBean {
|
||||||
|
|
||||||
|
private final MinioClient minioClient;
|
||||||
|
private final MinioProperties properties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public MinioCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||||
|
this.properties = properties.getMinio();
|
||||||
|
try {
|
||||||
|
minioClient = MinioClient.builder()
|
||||||
|
.endpoint(this.properties.getEndpoint())
|
||||||
|
.credentials(this.properties.getAccessKey(), this.properties.getSecretKey())
|
||||||
|
.build();
|
||||||
|
createBucket();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("Minio存储配置错误! 请检查系统配置!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createBucket() {
|
||||||
|
try {
|
||||||
|
String bucketName = properties.getBucketName();
|
||||||
|
boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
||||||
|
if (exists) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 不存在就创建桶
|
||||||
|
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||||
|
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder()
|
||||||
|
.bucket(bucketName)
|
||||||
|
.config(getPolicy(bucketName, PolicyType.READ))
|
||||||
|
.build());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("创建Bucket失败, 请核对Minio配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServiceType() {
|
||||||
|
return CloudServiceEnumd.MINIO.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
|
try {
|
||||||
|
minioClient.putObject(PutObjectArgs.builder()
|
||||||
|
.bucket(properties.getBucketName())
|
||||||
|
.object(path)
|
||||||
|
.contentType(StrUtil.blankToDefault(contentType, MediaType.APPLICATION_OCTET_STREAM_VALUE))
|
||||||
|
.stream(inputStream, inputStream.available(), -1)
|
||||||
|
.build());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请核对Minio配置信息");
|
||||||
|
}
|
||||||
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(String path) {
|
||||||
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
|
try {
|
||||||
|
minioClient.removeObject(RemoveObjectArgs.builder()
|
||||||
|
.bucket(properties.getBucketName())
|
||||||
|
.object(path)
|
||||||
|
.build());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
|
return upload(data, getPath("", suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
|
return upload(inputStream, getPath("", suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
OssFactory.register(getServiceType(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEndpointLink() {
|
||||||
|
return properties.getEndpoint() + "/" + properties.getBucketName();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPolicy(String bucketName, PolicyType policyType) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("{\n");
|
||||||
|
builder.append(" \"Statement\": [\n");
|
||||||
|
builder.append(" {\n");
|
||||||
|
builder.append(" \"Action\": [\n");
|
||||||
|
if (policyType == PolicyType.WRITE) {
|
||||||
|
builder.append(" \"s3:GetBucketLocation\",\n");
|
||||||
|
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
||||||
|
} else if (policyType == PolicyType.READ_WRITE) {
|
||||||
|
builder.append(" \"s3:GetBucketLocation\",\n");
|
||||||
|
builder.append(" \"s3:ListBucket\",\n");
|
||||||
|
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
|
||||||
|
} else {
|
||||||
|
builder.append(" \"s3:GetBucketLocation\"\n");
|
||||||
|
}
|
||||||
|
builder.append(" ],\n");
|
||||||
|
builder.append(" \"Effect\": \"Allow\",\n");
|
||||||
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
|
builder.append(bucketName);
|
||||||
|
builder.append("\"\n");
|
||||||
|
builder.append(" },\n");
|
||||||
|
if (PolicyType.READ.equals(policyType)) {
|
||||||
|
builder.append(" {\n");
|
||||||
|
builder.append(" \"Action\": [\n");
|
||||||
|
builder.append(" \"s3:ListBucket\"\n");
|
||||||
|
builder.append(" ],\n");
|
||||||
|
builder.append(" \"Effect\": \"Deny\",\n");
|
||||||
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
|
builder.append(bucketName);
|
||||||
|
builder.append("\"\n");
|
||||||
|
builder.append(" },\n");
|
||||||
|
}
|
||||||
|
builder.append(" {\n");
|
||||||
|
builder.append(" \"Action\": ");
|
||||||
|
switch (policyType) {
|
||||||
|
case WRITE:
|
||||||
|
builder.append("[\n");
|
||||||
|
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
||||||
|
builder.append(" \"s3:DeleteObject\",\n");
|
||||||
|
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
||||||
|
builder.append(" \"s3:PutObject\"\n");
|
||||||
|
builder.append(" ],\n");
|
||||||
|
break;
|
||||||
|
case READ_WRITE:
|
||||||
|
builder.append("[\n");
|
||||||
|
builder.append(" \"s3:AbortMultipartUpload\",\n");
|
||||||
|
builder.append(" \"s3:DeleteObject\",\n");
|
||||||
|
builder.append(" \"s3:GetObject\",\n");
|
||||||
|
builder.append(" \"s3:ListMultipartUploadParts\",\n");
|
||||||
|
builder.append(" \"s3:PutObject\"\n");
|
||||||
|
builder.append(" ],\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
builder.append("\"s3:GetObject\",\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
builder.append(" \"Effect\": \"Allow\",\n");
|
||||||
|
builder.append(" \"Principal\": \"*\",\n");
|
||||||
|
builder.append(" \"Resource\": \"arn:aws:s3:::");
|
||||||
|
builder.append(bucketName);
|
||||||
|
builder.append("/*\"\n");
|
||||||
|
builder.append(" }\n");
|
||||||
|
builder.append(" ],\n");
|
||||||
|
builder.append(" \"Version\": \"2012-10-17\"\n");
|
||||||
|
builder.append("}\n");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
package com.ruoyi.oss.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.qcloud.cos.COSClient;
|
||||||
|
import com.qcloud.cos.ClientConfig;
|
||||||
|
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||||
|
import com.qcloud.cos.auth.COSCredentials;
|
||||||
|
import com.qcloud.cos.http.HttpProtocol;
|
||||||
|
import com.qcloud.cos.model.*;
|
||||||
|
import com.qcloud.cos.region.Region;
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
import com.ruoyi.oss.enumd.CloudServiceEnumd;
|
||||||
|
import com.ruoyi.oss.exception.OssException;
|
||||||
|
import com.ruoyi.oss.factory.OssFactory;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties.QcloudProperties;
|
||||||
|
import com.ruoyi.oss.service.abstractd.AbstractCloudStorageService;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云存储
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Lazy
|
||||||
|
@Service
|
||||||
|
public class QcloudCloudStorageServiceImpl extends AbstractCloudStorageService implements InitializingBean {
|
||||||
|
|
||||||
|
private final COSClient client;
|
||||||
|
private final QcloudProperties properties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public QcloudCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||||
|
this.properties = properties.getQcloud();
|
||||||
|
try {
|
||||||
|
COSCredentials credentials = new BasicCOSCredentials(
|
||||||
|
this.properties.getSecretId(),
|
||||||
|
this.properties.getSecretKey());
|
||||||
|
// 初始化客户端配置
|
||||||
|
ClientConfig clientConfig = new ClientConfig();
|
||||||
|
// 设置bucket所在的区域,华南:gz 华北:tj 华东:sh
|
||||||
|
clientConfig.setRegion(new Region(this.properties.getRegion()));
|
||||||
|
if (this.properties.getIsHttps()) {
|
||||||
|
clientConfig.setHttpProtocol(HttpProtocol.https);
|
||||||
|
} else {
|
||||||
|
clientConfig.setHttpProtocol(HttpProtocol.http);
|
||||||
|
}
|
||||||
|
client = new COSClient(credentials, clientConfig);
|
||||||
|
createBucket();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("腾讯云存储配置错误! 请检查系统配置!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createBucket() {
|
||||||
|
try {
|
||||||
|
String bucketName = properties.getBucketName();
|
||||||
|
if (client.doesBucketExist(bucketName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
|
||||||
|
createBucketRequest.setCannedAcl(CannedAccessControlList.PublicRead);
|
||||||
|
client.createBucket(createBucketRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("创建Bucket失败, 请核对腾讯云配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServiceType() {
|
||||||
|
return CloudServiceEnumd.QCLOUD.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
|
return upload(new ByteArrayInputStream(data), path, contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(InputStream inputStream, String path, String contentType) {
|
||||||
|
try {
|
||||||
|
ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
metadata.setContentType(contentType);
|
||||||
|
client.putObject(new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请检查腾讯云配置信息");
|
||||||
|
}
|
||||||
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(String path) {
|
||||||
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
|
try {
|
||||||
|
client.deleteObject(new DeleteObjectRequest(properties.getBucketName(), path));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请检腾讯云查配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
OssFactory.register(getServiceType(),this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEndpointLink() {
|
||||||
|
String endpoint = properties.getEndpoint();
|
||||||
|
StringBuilder sb = new StringBuilder(endpoint);
|
||||||
|
if (StrUtil.containsAnyIgnoreCase(endpoint, "http://")) {
|
||||||
|
sb.insert(7, properties.getBucketName() + ".");
|
||||||
|
} else if (StrUtil.containsAnyIgnoreCase(endpoint, "https://")) {
|
||||||
|
sb.insert(8, properties.getBucketName() + ".");
|
||||||
|
} else {
|
||||||
|
throw new OssException("Endpoint配置错误");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,145 @@
|
|||||||
|
package com.ruoyi.oss.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import com.qiniu.http.Response;
|
||||||
|
import com.qiniu.storage.BucketManager;
|
||||||
|
import com.qiniu.storage.Configuration;
|
||||||
|
import com.qiniu.storage.Region;
|
||||||
|
import com.qiniu.storage.UploadManager;
|
||||||
|
import com.qiniu.util.Auth;
|
||||||
|
import com.ruoyi.oss.entity.UploadResult;
|
||||||
|
import com.ruoyi.oss.enumd.CloudServiceEnumd;
|
||||||
|
import com.ruoyi.oss.exception.OssException;
|
||||||
|
import com.ruoyi.oss.factory.OssFactory;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties;
|
||||||
|
import com.ruoyi.oss.properties.CloudStorageProperties.QiniuProperties;
|
||||||
|
import com.ruoyi.oss.service.abstractd.AbstractCloudStorageService;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛云存储
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Lazy
|
||||||
|
@Service
|
||||||
|
public class QiniuCloudStorageServiceImpl extends AbstractCloudStorageService implements InitializingBean {
|
||||||
|
|
||||||
|
private final UploadManager uploadManager;
|
||||||
|
private final BucketManager bucketManager;
|
||||||
|
private final String token;
|
||||||
|
private final QiniuProperties properties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public QiniuCloudStorageServiceImpl(CloudStorageProperties properties) {
|
||||||
|
this.properties = properties.getQiniu();
|
||||||
|
try {
|
||||||
|
Configuration config = new Configuration(getRegion(this.properties.getRegion()));
|
||||||
|
// https设置
|
||||||
|
config.useHttpsDomains = false;
|
||||||
|
if (this.properties.getIsHttps() != null) {
|
||||||
|
config.useHttpsDomains = this.properties.getIsHttps();
|
||||||
|
}
|
||||||
|
uploadManager = new UploadManager(config);
|
||||||
|
Auth auth = Auth.create(
|
||||||
|
this.properties.getAccessKey(),
|
||||||
|
this.properties.getSecretKey());
|
||||||
|
String bucketName = this.properties.getBucketName();
|
||||||
|
token = auth.uploadToken(bucketName);
|
||||||
|
bucketManager = new BucketManager(auth, config);
|
||||||
|
|
||||||
|
if (!ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
||||||
|
bucketManager.createBucket(bucketName, this.properties.getRegion());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("七牛云存储配置错误! 请检查系统配置!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createBucket() {
|
||||||
|
try {
|
||||||
|
String bucketName = properties.getBucketName();
|
||||||
|
if (ArrayUtil.contains(bucketManager.buckets(), bucketName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bucketManager.createBucket(bucketName, properties.getRegion());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("创建Bucket失败, 请核对七牛云配置信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getServiceType() {
|
||||||
|
return CloudServiceEnumd.QINIU.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult upload(byte[] data, String path, String contentType) {
|
||||||
|
try {
|
||||||
|
Response res = uploadManager.put(data, path, token, null, contentType, false);
|
||||||
|
if (!res.isOK()) {
|
||||||
|
throw new RuntimeException("上传七牛出错:" + res.toString());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException("上传文件失败,请核对七牛配置信息");
|
||||||
|
}
|
||||||
|
return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(String path) {
|
||||||
|
try {
|
||||||
|
path = path.replace(getEndpointLink() + "/", "");
|
||||||
|
Response res = bucketManager.delete(properties.getBucketName(), path);
|
||||||
|
if (!res.isOK()) {
|
||||||
|
throw new RuntimeException("删除七牛文件出错:" + res.toString());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||||
|
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) {
|
||||||
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
OssFactory.register(getServiceType(),this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEndpointLink() {
|
||||||
|
return properties.getDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Region getRegion(String region) {
|
||||||
|
switch (region) {
|
||||||
|
case "z0":
|
||||||
|
return Region.region0();
|
||||||
|
case "z1":
|
||||||
|
return Region.region1();
|
||||||
|
case "z2":
|
||||||
|
return Region.region2();
|
||||||
|
case "na0":
|
||||||
|
return Region.regionNa0();
|
||||||
|
case "as0":
|
||||||
|
return Region.regionAs0();
|
||||||
|
default:
|
||||||
|
return Region.autoRegion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.quartz.service;
|
package com.ruoyi.quartz.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.quartz.domain.SysJobLog;
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysJobLogService extends IServicePlus<SysJobLog> {
|
public interface ISysJobLogService extends IService<SysJobLog> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysJobLog> selectPageJobLogList(SysJobLog jobLog);
|
TableDataInfo<SysJobLog> selectPageJobLogList(SysJobLog jobLog);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.quartz.service;
|
package com.ruoyi.quartz.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.job.TaskException;
|
import com.ruoyi.common.exception.job.TaskException;
|
||||||
import com.ruoyi.quartz.domain.SysJob;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysJobService extends IServicePlus<SysJob> {
|
public interface ISysJobService extends IService<SysJob> {
|
||||||
/**
|
/**
|
||||||
* 获取quartz调度器的计划任务
|
* 获取quartz调度器的计划任务
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,7 @@ package com.ruoyi.quartz.service.impl;
|
|||||||
import cn.hutool.core.lang.Validator;
|
import cn.hutool.core.lang.Validator;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
import com.ruoyi.quartz.domain.SysJobLog;
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
@ -21,7 +21,7 @@ import java.util.Map;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysJobLogServiceImpl extends ServicePlusImpl<SysJobLogMapper, SysJobLog> implements ISysJobLogService {
|
public class SysJobLogServiceImpl extends ServiceImpl<SysJobLogMapper, SysJobLog> implements ISysJobLogService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysJobLog> selectPageJobLogList(SysJobLog jobLog) {
|
public TableDataInfo<SysJobLog> selectPageJobLogList(SysJobLog jobLog) {
|
||||||
|
@ -2,8 +2,8 @@ package com.ruoyi.quartz.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.constant.ScheduleConstants;
|
import com.ruoyi.common.constant.ScheduleConstants;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.job.TaskException;
|
import com.ruoyi.common.exception.job.TaskException;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysJobServiceImpl extends ServicePlusImpl<SysJobMapper, SysJob> implements ISysJobService {
|
public class SysJobServiceImpl extends ServiceImpl<SysJobMapper, SysJob> implements ISysJobService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private Scheduler scheduler;
|
private Scheduler scheduler;
|
||||||
|
|
||||||
|
@ -0,0 +1,114 @@
|
|||||||
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.exception.CustomException;
|
||||||
|
import com.ruoyi.common.utils.file.FileUtils;
|
||||||
|
import com.ruoyi.system.domain.bo.SysOssBo;
|
||||||
|
import com.ruoyi.system.domain.SysOss;
|
||||||
|
import com.ruoyi.system.service.ISysOssService;
|
||||||
|
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传 控制层
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "OSS云存储控制器", tags = {"OSS云存储管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/oss")
|
||||||
|
public class SysOssController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysOssService iSysOssService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询OSS云存储列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询OSS云存储列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:oss:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysOssVo> list(@Validated SysOssBo bo) {
|
||||||
|
return iSysOssService.queryPageList(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传OSS云存储
|
||||||
|
*/
|
||||||
|
@ApiOperation("上传OSS云存储")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
|
||||||
|
})
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:oss:upload')")
|
||||||
|
@Log(title = "OSS云存储", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
throw new CustomException("上传文件不能为空");
|
||||||
|
}
|
||||||
|
SysOss oss = iSysOssService.upload(file);
|
||||||
|
Map<String, String> map = new HashMap<>(2);
|
||||||
|
map.put("url", oss.getUrl());
|
||||||
|
map.put("fileName", oss.getFileName());
|
||||||
|
return AjaxResult.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("下载OSS云存储")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:oss:download')")
|
||||||
|
@GetMapping("/download/{ossId}")
|
||||||
|
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||||
|
SysOss sysOss = iSysOssService.getById(ossId);
|
||||||
|
if (sysOss == null) {
|
||||||
|
throw new CustomException("文件数据不存在!");
|
||||||
|
}
|
||||||
|
response.reset();
|
||||||
|
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
|
FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(sysOss.getOriginalName(), StandardCharsets.UTF_8));
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
||||||
|
long data = HttpUtil.download(sysOss.getUrl(), response.getOutputStream(), false);
|
||||||
|
response.setContentLength(Convert.toInt(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除OSS云存储
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除OSS云存储")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
|
||||||
|
@Log(title = "OSS云存储" , businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ossIds}")
|
||||||
|
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ossIds) {
|
||||||
|
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
ruoyi/src/main/java/com/ruoyi/system/domain/SysOss.java
Normal file
80
ruoyi/src/main/java/com/ruoyi/system/domain/SysOss.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS云存储对象
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_oss")
|
||||||
|
public class SysOss implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "oss_id", type = IdType.AUTO)
|
||||||
|
private Long ossId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原名
|
||||||
|
*/
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀名
|
||||||
|
*/
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传人
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务商
|
||||||
|
*/
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
}
|
67
ruoyi/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java
Normal file
67
ruoyi/src/main/java/com/ruoyi/system/domain/bo/SysOssBo.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS云存储分页查询对象 sys_oss
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel("OSS云存储分页查询对象")
|
||||||
|
public class SysOssBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页大小
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("分页大小")
|
||||||
|
private Integer pageSize;
|
||||||
|
/**
|
||||||
|
* 当前页数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer pageNum;
|
||||||
|
/**
|
||||||
|
* 排序列
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序列")
|
||||||
|
private String orderByColumn;
|
||||||
|
/**
|
||||||
|
* 排序的方向desc或者asc
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
|
private String isAsc;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("文件名")
|
||||||
|
private String fileName;
|
||||||
|
/**
|
||||||
|
* 原名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("原名")
|
||||||
|
private String originalName;
|
||||||
|
/**
|
||||||
|
* 文件后缀名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("文件后缀名")
|
||||||
|
private String fileSuffix;
|
||||||
|
/**
|
||||||
|
* URL地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("URL地址")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 服务商
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("服务商")
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
}
|
69
ruoyi/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java
Normal file
69
ruoyi/src/main/java/com/ruoyi/system/domain/vo/SysOssVo.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSS云存储视图对象 sys_oss
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("OSS云存储视图对象")
|
||||||
|
public class SysOssVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储主键
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("云存储主键")
|
||||||
|
private Long ossId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("文件名")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("原名")
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("文件后缀名")
|
||||||
|
private String fileSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("URL地址")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("上传人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务商
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("服务商")
|
||||||
|
private String service;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
|
import com.ruoyi.system.domain.SysOss;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传 数据层
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface SysOssMapper extends BaseMapperPlus<SysOss> {
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysConfigService extends IServicePlus<SysConfig> {
|
public interface ISysConfigService extends IService<SysConfig> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysConfig> selectPageConfigList(SysConfig config);
|
TableDataInfo<SysConfig> selectPageConfigList(SysConfig config);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.TreeSelect;
|
import com.ruoyi.common.core.domain.TreeSelect;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysDeptService extends IServicePlus<SysDept> {
|
public interface ISysDeptService extends IService<SysDept> {
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysDictDataService extends IServicePlus<SysDictData> {
|
public interface ISysDictDataService extends IService<SysDictData> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData);
|
TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysDictTypeService extends IServicePlus<SysDictType> {
|
public interface ISysDictTypeService extends IService<SysDictType> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType);
|
TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysLogininforService extends IServicePlus<SysLogininfor> {
|
public interface ISysLogininforService extends IService<SysLogininfor> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysLogininfor> selectPageLogininforList(SysLogininfor logininfor);
|
TableDataInfo<SysLogininfor> selectPageLogininforList(SysLogininfor logininfor);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.TreeSelect;
|
import com.ruoyi.common.core.domain.TreeSelect;
|
||||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.system.domain.vo.RouterVo;
|
import com.ruoyi.system.domain.vo.RouterVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,7 +13,7 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysMenuService extends IServicePlus<SysMenu> {
|
public interface ISysMenuService extends IService<SysMenu> {
|
||||||
/**
|
/**
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysNoticeService extends IServicePlus<SysNotice> {
|
public interface ISysNoticeService extends IService<SysNotice> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice);
|
TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysOperLogService extends IServicePlus<SysOperLog> {
|
public interface ISysOperLogService extends IService<SysOperLog> {
|
||||||
|
|
||||||
TableDataInfo<SysOperLog> selectPageOperLogList(SysOperLog operLog);
|
TableDataInfo<SysOperLog> selectPageOperLogList(SysOperLog operLog);
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysOssBo;
|
||||||
|
import com.ruoyi.system.domain.SysOss;
|
||||||
|
import com.ruoyi.system.domain.vo.SysOssVo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传 服务层
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface ISysOssService extends IServicePlus<SysOss, SysOssVo> {
|
||||||
|
|
||||||
|
TableDataInfo<SysOssVo> queryPageList(SysOssBo sysOss);
|
||||||
|
|
||||||
|
SysOss upload(MultipartFile file);
|
||||||
|
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysPostService extends IServicePlus<SysPost> {
|
public interface ISysPostService extends IService<SysPost> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysPost> selectPagePostList(SysPost post);
|
TableDataInfo<SysPost> selectPagePostList(SysPost post);
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -14,7 +13,7 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysRoleService extends IServicePlus<SysRole> {
|
public interface ISysRoleService extends IService<SysRole> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysRole> selectPageRoleList(SysRole role);
|
TableDataInfo<SysRole> selectPageRoleList(SysRole role);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysUserService extends IServicePlus<SysUser> {
|
public interface ISysUserService extends IService<SysUser> {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysUser> selectPageUserList(SysUser user);
|
TableDataInfo<SysUser> selectPageUserList(SysUser user);
|
||||||
|
@ -4,10 +4,10 @@ import cn.hutool.core.convert.Convert;
|
|||||||
import cn.hutool.core.lang.Validator;
|
import cn.hutool.core.lang.Validator;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.annotation.DataSource;
|
import com.ruoyi.common.annotation.DataSource;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
import com.ruoyi.common.enums.DataSourceType;
|
import com.ruoyi.common.enums.DataSourceType;
|
||||||
@ -31,7 +31,7 @@ import java.util.Map;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
@ -98,6 +98,7 @@ public class SysConfigServiceImpl extends ServicePlusImpl<SysConfigMapper, SysCo
|
|||||||
*
|
*
|
||||||
* @return true开启,false关闭
|
* @return true开启,false关闭
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean selectCaptchaOnOff() {
|
public boolean selectCaptchaOnOff() {
|
||||||
String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff");
|
String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff");
|
||||||
if (StrUtil.isEmpty(captchaOnOff)) {
|
if (StrUtil.isEmpty(captchaOnOff)) {
|
||||||
|
@ -4,13 +4,13 @@ import cn.hutool.core.convert.Convert;
|
|||||||
import cn.hutool.core.lang.Validator;
|
import cn.hutool.core.lang.Validator;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.TreeSelect;
|
import com.ruoyi.common.core.domain.TreeSelect;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.exception.CustomException;
|
import com.ruoyi.common.exception.CustomException;
|
||||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||||
@ -30,7 +30,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept> implements ISysDeptService {
|
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements ISysDeptService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleMapper roleMapper;
|
private SysRoleMapper roleMapper;
|
||||||
|
@ -2,8 +2,8 @@ package com.ruoyi.system.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.DictUtils;
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
@ -11,7 +11,6 @@ import com.ruoyi.system.mapper.SysDictDataMapper;
|
|||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,7 +19,7 @@ import java.util.List;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService {
|
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) {
|
public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData) {
|
||||||
@ -84,10 +83,10 @@ public class SysDictDataServiceImpl extends ServicePlusImpl<SysDictDataMapper, S
|
|||||||
public void deleteDictDataByIds(Long[] dictCodes) {
|
public void deleteDictDataByIds(Long[] dictCodes) {
|
||||||
for (Long dictCode : dictCodes) {
|
for (Long dictCode : dictCodes) {
|
||||||
SysDictData data = selectDictDataById(dictCode);
|
SysDictData data = selectDictDataById(dictCode);
|
||||||
|
removeById(dictCode);
|
||||||
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType());
|
||||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
}
|
}
|
||||||
baseMapper.deleteBatchIds(Arrays.asList(dictCodes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,10 +5,10 @@ import cn.hutool.core.lang.Validator;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.exception.CustomException;
|
import com.ruoyi.common.exception.CustomException;
|
||||||
import com.ruoyi.common.utils.DictUtils;
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
@ -31,7 +31,7 @@ import java.util.Map;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
|
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictDataMapper dictDataMapper;
|
private SysDictDataMapper dictDataMapper;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user