mirror of https://github.com/elunez/eladmin
1.7版本发布,详情查看版本说明
parent
1402e5845d
commit
9f43851efb
35
README.md
35
README.md
|
@ -1,17 +1,18 @@
|
|||
# eladmin
|
||||
|
||||
项目基于 Spring Boot 2.1.0 、 Spring boot Jpa、 Spring Security、redis、Vue的前后端分离的权限管理系统,项目采用分模块开发方式, 权限控制采用 RBAC(Role-Based Access Control,基于角色的访问控制),前端菜单支持动态路由
|
||||
项目基于 Spring Boot 2.1.0 、 Spring boot Jpa、 Spring Security、redis、Vue的前后端分离的权限管理系统,项目采用分模块开发方式, 权限控制采用 RBAC(Role-Based Access Control,基于角色的访问控制),支持数据字典、数据权限管理、前端菜单支持动态路由
|
||||
|
||||
#### 前端源码
|
||||
eladmin-qt和eladmin-qd只是命名方式的区别,无其他区别
|
||||
- 码云:[https://gitee.com/elunez/eladmin-qt](https://gitee.com/elunez/eladmin-qt)
|
||||
- github:[https://github.com/elunez/eladmin-qd](https://github.com/elunez/eladmin-qd)
|
||||
#### 项目源码
|
||||
|
||||
#### eladmin开发文档
|
||||
[http://docs.auauz.net/#/](http://docs.auauz.net/#/)
|
||||
| | 后端源码 | 前端源码 |
|
||||
|--- |--- | --- |
|
||||
| github | https://github.com/elunez/eladmin | https://github.com/elunez/eladmin-qd |
|
||||
| 码云 | https://github.com/elunez/eladmin | https://gitee.com/elunez/eladmin-qt |
|
||||
#### 开发文档
|
||||
[https://docs.auauz.net/#/](https://docs.auauz.net/#/)
|
||||
|
||||
#### 预览地址
|
||||
[http://auauz.net](http://auauz.net)
|
||||
[https://auauz.net](https://auauz.net)
|
||||
|
||||
##### 用户账号密码
|
||||
|
||||
|
@ -23,7 +24,7 @@ eladmin-qt和eladmin-qd只是命名方式的区别,无其他区别
|
|||
|
||||
- JDK:8
|
||||
- IDE:IntelliJ IDEA (后端)
|
||||
- IDE:JetBrains WebStorm (前端)
|
||||
- IDE:JetBrains WebStorm(前端)
|
||||
- 依赖管理:Maven
|
||||
- 数据库:MySQL 5.5.59
|
||||
|
||||
|
@ -31,19 +32,21 @@ eladmin-qt和eladmin-qd只是命名方式的区别,无其他区别
|
|||
```
|
||||
- 系统管理
|
||||
- 用户管理 提供用户的相关配置
|
||||
- 角色管理 角色菜单进行权限的分配
|
||||
- Swagger文档 localhost:8000/swagger-ui.html
|
||||
- 角色管理 对权限与菜单进行分配
|
||||
- 权限管理 权限细化到接口
|
||||
- 菜单管理 已实现菜单动态路由,后端可配置化,支持多级菜单
|
||||
- 定时任务 整合Quartz做定时任务,加入任务日志,任务运行情况一目了然
|
||||
- 代码生成 高灵活度一键生成前后端代码,减少百分之80左右的工作任务
|
||||
- 部门管理与岗位管理
|
||||
- 字典管理 应广大码友的要求加入字典管理
|
||||
- 系统监控
|
||||
- 操作日志 使用apo记录用户操作日志
|
||||
- 异常日志 记录操作过程中的异常,并且提供查看异常的堆栈信息
|
||||
- 系统缓存 使用jedis将缓存操作可视化,并提供对redis的基本操作,可根据需求自行扩展
|
||||
- 实时控制台 实时打印logback日志,来自微强迫症患者的精心配色,更好的监控系统的运行状态
|
||||
- SQL监控 采用druid 监控数据库访问性能,默认用户名admin,密码123456
|
||||
- 三方工具
|
||||
- 系统工具
|
||||
- 定时任务 整合Quartz做定时任务,加入任务日志,任务运行情况一目了然
|
||||
- 代码生成 高灵活度一键生成前后端代码,减少百分之80左右的工作任务
|
||||
- 接口文档 使用的是 swagger-ui
|
||||
- 邮件工具 配合富文本,发送html格式的邮件
|
||||
- SM.MS免费图床 挺好用的一个图床,作为公共图片上传使用
|
||||
- 七牛云存储 这个就不多说了
|
||||
|
@ -51,6 +54,7 @@ eladmin-qt和eladmin-qd只是命名方式的区别,无其他区别
|
|||
- 组件管理
|
||||
- 图标库 系统图标来自 https://www.iconfont.cn/
|
||||
- 富文本 集成wangEditor富文本
|
||||
- Markdown编辑器与Yaml编辑器
|
||||
```
|
||||
#### 项目结构
|
||||
```
|
||||
|
@ -133,8 +137,7 @@ eladmin-qt和eladmin-qd只是命名方式的区别,无其他区别
|
|||
|
||||
| 微信 | 支付宝 |
|
||||
|--- | --- |
|
||||
|  |  |
|
||||
|
||||
|  |  |
|
||||
#### 反馈交流
|
||||
|
||||
- QQ交流群:891137268
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
import java.time.Duration;
|
||||
|
@ -31,6 +30,7 @@ import java.time.Duration;
|
|||
@Slf4j
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
// 自动配置
|
||||
@ConditionalOnClass(RedisOperations.class)
|
||||
@EnableConfigurationProperties(RedisProperties.class)
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
@ -91,6 +91,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|||
// value值的序列化采用fastJsonRedisSerializer
|
||||
template.setValueSerializer(fastJsonRedisSerializer);
|
||||
template.setHashValueSerializer(fastJsonRedisSerializer);
|
||||
|
||||
// 全局开启AutoType,不建议使用
|
||||
// ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
|
||||
// 建议使用这种方式,小范围指定白名单
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SwaggerConfig {
|
|||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("elune 接口文档")
|
||||
.version("1.5")
|
||||
.version("1.7")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,6 @@ public class EncryptUtils {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(encryptPassword("e10adc3949ba59abbe56e057f20f883e"));
|
||||
System.out.println(encryptPassword("123456"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package me.zhengjie.utils;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-01-08
|
||||
*/
|
||||
@Configuration
|
||||
public class ThreadPoolUtil {
|
||||
|
||||
@Bean
|
||||
public ExecutorService getThreadPool(){
|
||||
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("thread-call-runner-%d").build();
|
||||
int size = 2;
|
||||
ExecutorService executorService = new ThreadPoolExecutor(size,size,0L, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>(),namedThreadFactory);
|
||||
return executorService;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
|||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class LogAspect {
|
||||
public class DataScopeAspect {
|
||||
|
||||
@Autowired
|
||||
private LogService logService;
|
|
@ -2,6 +2,7 @@ package me.zhengjie.rest;
|
|||
|
||||
import me.zhengjie.domain.Log;
|
||||
import me.zhengjie.service.query.LogQueryService;
|
||||
import me.zhengjie.utils.SecurityContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -29,6 +30,13 @@ public class LogController {
|
|||
return new ResponseEntity(logQueryService.queryAll(log,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/logs/user")
|
||||
public ResponseEntity getUserLogs(Log log, Pageable pageable){
|
||||
log.setLogType("INFO");
|
||||
log.setUsername(SecurityContextHolder.getUserDetails().getUsername());
|
||||
return new ResponseEntity(logQueryService.queryAll(log,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/logs/error")
|
||||
@PreAuthorize("hasAnyRole('ADMIN')")
|
||||
public ResponseEntity getErrorLogs(Log log, Pageable pageable){
|
||||
|
|
|
@ -10,7 +10,6 @@ import me.zhengjie.utils.StringUtils;
|
|||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
|
@ -29,9 +28,6 @@ public class LogServiceImpl implements LogService {
|
|||
@Autowired
|
||||
private LogRepository logRepository;
|
||||
|
||||
@Value("${jwt.header}")
|
||||
private String tokenHeader;
|
||||
|
||||
private final String LOGINPATH = "login";
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,477 +1,633 @@
|
|||
/*
|
||||
Navicat Premium Data Transfer
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : localhost
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50562
|
||||
Source Host : localhost:3306
|
||||
Source Schema : eladmin
|
||||
Source Server : localhost
|
||||
Source Server Version : 50562
|
||||
Source Host : localhost:3306
|
||||
Source Database : eladmin
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50562
|
||||
File Encoding : 65001
|
||||
Target Server Type : MYSQL
|
||||
Target Server Version : 50562
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 15/03/2019 14:54:39
|
||||
Date: 2019-04-11 11:11:09
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for alipay_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `alipay_config`;
|
||||
CREATE TABLE `alipay_config` (
|
||||
CREATE TABLE `alipay_config` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`app_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用ID',
|
||||
`charset` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编码',
|
||||
`format` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型 固定格式json',
|
||||
`gateway_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网关地址',
|
||||
`notify_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '异步回调',
|
||||
`private_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '私钥',
|
||||
`public_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '公钥',
|
||||
`return_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '回调地址',
|
||||
`sign_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '签名方式',
|
||||
`sys_service_provider_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '商户号',
|
||||
`app_id` varchar(255) DEFAULT NULL COMMENT '应用ID',
|
||||
`charset` varchar(255) DEFAULT NULL COMMENT '编码',
|
||||
`format` varchar(255) DEFAULT NULL COMMENT '类型 固定格式json',
|
||||
`gateway_url` varchar(255) DEFAULT NULL COMMENT '网关地址',
|
||||
`notify_url` varchar(255) DEFAULT NULL COMMENT '异步回调',
|
||||
`private_key` text COMMENT '私钥',
|
||||
`public_key` text COMMENT '公钥',
|
||||
`return_url` varchar(255) DEFAULT NULL COMMENT '回调地址',
|
||||
`sign_type` varchar(255) DEFAULT NULL COMMENT '签名方式',
|
||||
`sys_service_provider_id` varchar(255) DEFAULT NULL COMMENT '商户号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of alipay_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `alipay_config` VALUES (1, '2016091700532697', 'utf-8', 'JSON', 'https://openapi.alipaydev.com/gateway.do', 'http://api.auauz.net/api/aliPay/notify', 'MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5js8sInU10AJ0cAQ8UMMyXrQ+oHZEkVt5lBwsStmTJ7YikVYgbskx1YYEXTojRsWCb+SH/kDmDU4pK/u91SJ4KFCRMF2411piYuXU/jF96zKrADznYh/zAraqT6hvAIVtQAlMHN53nx16rLzZ/8jDEkaSwT7+HvHiS+7sxSojnu/3oV7BtgISoUNstmSe8WpWHOaWv19xyS+Mce9MY4BfseFhzTICUymUQdd/8hXA28/H6osUfAgsnxAKv7Wil3aJSgaJczWuflYOve0dJ3InZkhw5Cvr0atwpk8YKBQjy5CdkoHqvkOcIB+cYHXJKzOE5tqU7inSwVbHzOLQ3XbnAgMBAAECggEAVJp5eT0Ixg1eYSqFs9568WdetUNCSUchNxDBu6wxAbhUgfRUGZuJnnAll63OCTGGck+EGkFh48JjRcBpGoeoHLL88QXlZZbC/iLrea6gcDIhuvfzzOffe1RcZtDFEj9hlotg8dQj1tS0gy9pN9g4+EBH7zeu+fyv+qb2e/v1l6FkISXUjpkD7RLQr3ykjiiEw9BpeKb7j5s7Kdx1NNIzhkcQKNqlk8JrTGDNInbDM6inZfwwIO2R1DHinwdfKWkvOTODTYa2MoAvVMFT9Bec9FbLpoWp7ogv1JMV9svgrcF9XLzANZ/OQvkbe9TV9GWYvIbxN6qwQioKCWO4GPnCAQKBgQDgW5MgfhX8yjXqoaUy/d1VjI8dHeIyw8d+OBAYwaxRSlCfyQ+tieWcR2HdTzPca0T0GkWcKZm0ei5xRURgxt4DUDLXNh26HG0qObbtLJdu/AuBUuCqgOiLqJ2f1uIbrz6OZUHns+bT/jGW2Ws8+C13zTCZkZt9CaQsrp3QOGDx5wKBgQDTul39hp3ZPwGNFeZdkGoUoViOSd5Lhowd5wYMGAEXWRLlU8z+smT5v0POz9JnIbCRchIY2FAPKRdVTICzmPk2EPJFxYTcwaNbVqL6lN7J2IlXXMiit5QbiLauo55w7plwV6LQmKm9KV7JsZs5XwqF7CEovI7GevFzyD3w+uizAQKBgC3LY1eRhOlpWOIAhpjG6qOoohmeXOphvdmMlfSHq6WYFqbWwmV4rS5d/6LNpNdL6fItXqIGd8I34jzql49taCmi+A2nlR/E559j0mvM20gjGDIYeZUz5MOE8k+K6/IcrhcgofgqZ2ZED1ksHdB/E8DNWCswZl16V1FrfvjeWSNnAoGAMrBplCrIW5xz+J0Hm9rZKrs+AkK5D4fUv8vxbK/KgxZ2KaUYbNm0xv39c+PZUYuFRCz1HDGdaSPDTE6WeWjkMQd5mS6ikl9hhpqFRkyh0d0fdGToO9yLftQKOGE/q3XUEktI1XvXF0xyPwNgUCnq0QkpHyGVZPtGFxwXiDvpvgECgYA5PoB+nY8iDiRaJNko9w0hL4AeKogwf+4TbCw+KWVEn6jhuJa4LFTdSqp89PktQaoVpwv92el/AhYjWOl/jVCm122f9b7GyoelbjMNolToDwe5pF5RnSpEuDdLy9MfE8LnE3PlbE7E5BipQ3UjSebkgNboLHH/lNZA5qvEtvbfvQ==', 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAut9evKRuHJ/2QNfDlLwvN/S8l9hRAgPbb0u61bm4AtzaTGsLeMtScetxTWJnVvAVpMS9luhEJjt+Sbk5TNLArsgzzwARgaTKOLMT1TvWAK5EbHyI+eSrc3s7Awe1VYGwcubRFWDm16eQLv0k7iqiw+4mweHSz/wWyvBJVgwLoQ02btVtAQErCfSJCOmt0Q/oJQjj08YNRV4EKzB19+f5A+HQVAKy72dSybTzAK+3FPtTtNen/+b5wGeat7c32dhYHnGorPkPeXLtsqqUTp1su5fMfd4lElNdZaoCI7osZxWWUo17vBCZnyeXc9fk0qwD9mK6yRAxNbrY72Xx5VqIqwIDAQAB', 'http://api.auauz.net/api/aliPay/return', 'RSA2', '2088102176044281');
|
||||
INSERT INTO `alipay_config` VALUES ('1', '2016091700532697', 'utf-8', 'JSON', 'https://openapi.alipaydev.com/gateway.do', 'http://api.auauz.net/api/aliPay/notify', 'MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5js8sInU10AJ0cAQ8UMMyXrQ+oHZEkVt5lBwsStmTJ7YikVYgbskx1YYEXTojRsWCb+SH/kDmDU4pK/u91SJ4KFCRMF2411piYuXU/jF96zKrADznYh/zAraqT6hvAIVtQAlMHN53nx16rLzZ/8jDEkaSwT7+HvHiS+7sxSojnu/3oV7BtgISoUNstmSe8WpWHOaWv19xyS+Mce9MY4BfseFhzTICUymUQdd/8hXA28/H6osUfAgsnxAKv7Wil3aJSgaJczWuflYOve0dJ3InZkhw5Cvr0atwpk8YKBQjy5CdkoHqvkOcIB+cYHXJKzOE5tqU7inSwVbHzOLQ3XbnAgMBAAECggEAVJp5eT0Ixg1eYSqFs9568WdetUNCSUchNxDBu6wxAbhUgfRUGZuJnnAll63OCTGGck+EGkFh48JjRcBpGoeoHLL88QXlZZbC/iLrea6gcDIhuvfzzOffe1RcZtDFEj9hlotg8dQj1tS0gy9pN9g4+EBH7zeu+fyv+qb2e/v1l6FkISXUjpkD7RLQr3ykjiiEw9BpeKb7j5s7Kdx1NNIzhkcQKNqlk8JrTGDNInbDM6inZfwwIO2R1DHinwdfKWkvOTODTYa2MoAvVMFT9Bec9FbLpoWp7ogv1JMV9svgrcF9XLzANZ/OQvkbe9TV9GWYvIbxN6qwQioKCWO4GPnCAQKBgQDgW5MgfhX8yjXqoaUy/d1VjI8dHeIyw8d+OBAYwaxRSlCfyQ+tieWcR2HdTzPca0T0GkWcKZm0ei5xRURgxt4DUDLXNh26HG0qObbtLJdu/AuBUuCqgOiLqJ2f1uIbrz6OZUHns+bT/jGW2Ws8+C13zTCZkZt9CaQsrp3QOGDx5wKBgQDTul39hp3ZPwGNFeZdkGoUoViOSd5Lhowd5wYMGAEXWRLlU8z+smT5v0POz9JnIbCRchIY2FAPKRdVTICzmPk2EPJFxYTcwaNbVqL6lN7J2IlXXMiit5QbiLauo55w7plwV6LQmKm9KV7JsZs5XwqF7CEovI7GevFzyD3w+uizAQKBgC3LY1eRhOlpWOIAhpjG6qOoohmeXOphvdmMlfSHq6WYFqbWwmV4rS5d/6LNpNdL6fItXqIGd8I34jzql49taCmi+A2nlR/E559j0mvM20gjGDIYeZUz5MOE8k+K6/IcrhcgofgqZ2ZED1ksHdB/E8DNWCswZl16V1FrfvjeWSNnAoGAMrBplCrIW5xz+J0Hm9rZKrs+AkK5D4fUv8vxbK/KgxZ2KaUYbNm0xv39c+PZUYuFRCz1HDGdaSPDTE6WeWjkMQd5mS6ikl9hhpqFRkyh0d0fdGToO9yLftQKOGE/q3XUEktI1XvXF0xyPwNgUCnq0QkpHyGVZPtGFxwXiDvpvgECgYA5PoB+nY8iDiRaJNko9w0hL4AeKogwf+4TbCw+KWVEn6jhuJa4LFTdSqp89PktQaoVpwv92el/AhYjWOl/jVCm122f9b7GyoelbjMNolToDwe5pF5RnSpEuDdLy9MfE8LnE3PlbE7E5BipQ3UjSebkgNboLHH/lNZA5qvEtvbfvQ==', 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAut9evKRuHJ/2QNfDlLwvN/S8l9hRAgPbb0u61bm4AtzaTGsLeMtScetxTWJnVvAVpMS9luhEJjt+Sbk5TNLArsgzzwARgaTKOLMT1TvWAK5EbHyI+eSrc3s7Awe1VYGwcubRFWDm16eQLv0k7iqiw+4mweHSz/wWyvBJVgwLoQ02btVtAQErCfSJCOmt0Q/oJQjj08YNRV4EKzB19+f5A+HQVAKy72dSybTzAK+3FPtTtNen/+b5wGeat7c32dhYHnGorPkPeXLtsqqUTp1su5fMfd4lElNdZaoCI7osZxWWUo17vBCZnyeXc9fk0qwD9mK6yRAxNbrY72Xx5VqIqwIDAQAB', 'http://api.auauz.net/api/aliPay/return', 'RSA2', '2088102176044281');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dept
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `dept`;
|
||||
CREATE TABLE `dept` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`pid` bigint(20) NOT NULL COMMENT '上级部门',
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`enabled` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dept
|
||||
-- ----------------------------
|
||||
INSERT INTO `dept` VALUES ('1', 'eladmin', '0', '2019-03-25 09:14:05', '');
|
||||
INSERT INTO `dept` VALUES ('2', '研发部', '7', '2019-03-25 09:15:32', '');
|
||||
INSERT INTO `dept` VALUES ('5', '运维部', '7', '2019-03-25 09:20:44', '');
|
||||
INSERT INTO `dept` VALUES ('6', '测试部', '8', '2019-03-25 09:52:18', '');
|
||||
INSERT INTO `dept` VALUES ('7', '华南分部', '1', '2019-03-25 11:04:50', '');
|
||||
INSERT INTO `dept` VALUES ('8', '华北分部', '1', '2019-03-25 11:04:53', '');
|
||||
INSERT INTO `dept` VALUES ('9', '财务部', '7', '2019-03-25 11:05:34', '');
|
||||
INSERT INTO `dept` VALUES ('10', '行政部', '8', '2019-03-25 11:05:58', '');
|
||||
INSERT INTO `dept` VALUES ('11', '人事部', '8', '2019-03-25 11:07:58', '');
|
||||
INSERT INTO `dept` VALUES ('12', '市场部', '7', '2019-03-25 11:10:24', '\0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dict
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `dict`;
|
||||
CREATE TABLE `dict` (
|
||||
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL COMMENT '字典名称',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dict
|
||||
-- ----------------------------
|
||||
INSERT INTO `dict` VALUES ('1', 'user_status', '用户状态');
|
||||
INSERT INTO `dict` VALUES ('4', 'dept_status', '部门状态');
|
||||
INSERT INTO `dict` VALUES ('5', 'job_status', '岗位状态');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dict_detail
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `dict_detail`;
|
||||
CREATE TABLE `dict_detail` (
|
||||
`id` bigint(11) NOT NULL AUTO_INCREMENT,
|
||||
`label` varchar(255) NOT NULL COMMENT '字典标签',
|
||||
`value` varchar(255) NOT NULL COMMENT '字典值',
|
||||
`sort` varchar(255) DEFAULT NULL COMMENT '排序',
|
||||
`dict_id` bigint(11) DEFAULT NULL COMMENT '字典id',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FK5tpkputc6d9nboxojdbgnpmyb` (`dict_id`),
|
||||
CONSTRAINT `FK5tpkputc6d9nboxojdbgnpmyb` FOREIGN KEY (`dict_id`) REFERENCES `dict` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of dict_detail
|
||||
-- ----------------------------
|
||||
INSERT INTO `dict_detail` VALUES ('1', '激活', 'true', '1', '1');
|
||||
INSERT INTO `dict_detail` VALUES ('2', '锁定', 'false', '2', '1');
|
||||
INSERT INTO `dict_detail` VALUES ('11', '正常', 'true', '1', '4');
|
||||
INSERT INTO `dict_detail` VALUES ('12', '停用', 'false', '2', '4');
|
||||
INSERT INTO `dict_detail` VALUES ('13', '正常', 'true', '1', '5');
|
||||
INSERT INTO `dict_detail` VALUES ('14', '停用', 'false', '2', '5');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for email_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `email_config`;
|
||||
CREATE TABLE `email_config` (
|
||||
CREATE TABLE `email_config` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`from_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收件人',
|
||||
`host` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮件服务器SMTP地址',
|
||||
`pass` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
|
||||
`port` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口',
|
||||
`user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发件者用户名',
|
||||
`from_user` varchar(255) DEFAULT NULL COMMENT '收件人',
|
||||
`host` varchar(255) DEFAULT NULL COMMENT '邮件服务器SMTP地址',
|
||||
`pass` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
`port` varchar(255) DEFAULT NULL COMMENT '端口',
|
||||
`user` varchar(255) DEFAULT NULL COMMENT '发件者用户名',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for gen_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `gen_config`;
|
||||
CREATE TABLE `gen_config` (
|
||||
CREATE TABLE `gen_config` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`author` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '作者',
|
||||
`cover` bit(1) NULL DEFAULT NULL COMMENT '是否覆盖',
|
||||
`module_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模块名称',
|
||||
`pack` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '至于哪个包下',
|
||||
`path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '前端代码生成的路径',
|
||||
`api_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`author` varchar(255) DEFAULT NULL COMMENT '作者',
|
||||
`cover` bit(1) DEFAULT NULL COMMENT '是否覆盖',
|
||||
`module_name` varchar(255) DEFAULT NULL COMMENT '模块名称',
|
||||
`pack` varchar(255) DEFAULT NULL COMMENT '至于哪个包下',
|
||||
`path` varchar(255) DEFAULT NULL COMMENT '前端代码生成的路径',
|
||||
`api_path` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of gen_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `gen_config` VALUES (1, 'jie', b'0', 'eladmin-system', 'me.zhengjie.modules.test', 'E:\\workspace\\my-workspace\\eladmin-qt\\src\\views\\system\\test', 'E:\\workspace\\my-workspace\\eladmin-qt\\src\\api');
|
||||
INSERT INTO `gen_config` VALUES ('1', 'jie', '\0', 'eladmin-system', 'me.zhengjie.modules.system', 'E:\\workspace\\me\\eladmin-qt\\src\\views\\system\\dictDetail', 'E:\\workspace\\me\\eladmin-qt\\src\\api');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for job
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `job`;
|
||||
CREATE TABLE `job` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`enabled` bit(1) NOT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`sort` bigint(20) NOT NULL,
|
||||
`dept_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `FKmvhj0rogastlctflsxf1d6k3i` (`dept_id`),
|
||||
CONSTRAINT `FKmvhj0rogastlctflsxf1d6k3i` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of job
|
||||
-- ----------------------------
|
||||
INSERT INTO `job` VALUES ('2', '董事长秘书', '', '2019-03-29 14:01:30', '2', '1');
|
||||
INSERT INTO `job` VALUES ('8', '人事专员', '', '2019-03-29 14:52:28', '3', '11');
|
||||
INSERT INTO `job` VALUES ('10', '产品经理', '\0', '2019-03-29 14:55:51', '4', '2');
|
||||
INSERT INTO `job` VALUES ('11', '全栈开发', '', '2019-03-31 13:39:30', '6', '2');
|
||||
INSERT INTO `job` VALUES ('12', '软件测试', '', '2019-03-31 13:39:43', '5', '2');
|
||||
INSERT INTO `job` VALUES ('19', '董事长', '', '2019-03-31 14:58:15', '1', '1');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `log`;
|
||||
CREATE TABLE `log` (
|
||||
CREATE TABLE `log` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`create_time` datetime NULL DEFAULT NULL,
|
||||
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`exception_detail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`log_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`params` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`request_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`time` bigint(20) NULL DEFAULT NULL,
|
||||
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`description` varchar(255) DEFAULT NULL,
|
||||
`exception_detail` text,
|
||||
`log_type` varchar(255) DEFAULT NULL,
|
||||
`method` varchar(255) DEFAULT NULL,
|
||||
`params` text,
|
||||
`request_ip` varchar(255) DEFAULT NULL,
|
||||
`time` bigint(20) DEFAULT NULL,
|
||||
`username` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4954 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of log
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for menu
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `menu`;
|
||||
CREATE TABLE `menu` (
|
||||
CREATE TABLE `menu` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`i_frame` bit(1) NULL DEFAULT NULL COMMENT '是否外链',
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单名称',
|
||||
`component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组件',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`i_frame` bit(1) DEFAULT NULL COMMENT '是否外链',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '菜单名称',
|
||||
`component` varchar(255) DEFAULT NULL COMMENT '组件',
|
||||
`pid` bigint(20) NOT NULL COMMENT '上级菜单ID',
|
||||
`sort` bigint(20) NOT NULL COMMENT '排序',
|
||||
`icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标',
|
||||
`path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接地址',
|
||||
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
|
||||
`path` varchar(255) DEFAULT NULL COMMENT '链接地址',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `menu` VALUES (1, '2018-12-18 15:11:29', b'0', '系统管理', NULL, 0, 1, 'system', 'system');
|
||||
INSERT INTO `menu` VALUES (2, '2018-12-18 15:14:44', b'0', '用户管理', 'system/user/index', 1, 2, 'peoples', 'user');
|
||||
INSERT INTO `menu` VALUES (3, '2018-12-18 15:16:07', b'0', '角色管理', 'system/role/index', 1, 3, 'role', 'role');
|
||||
INSERT INTO `menu` VALUES (4, '2018-12-18 15:16:45', b'0', '权限管理', 'system/permission/index', 1, 4, 'permission', 'permission');
|
||||
INSERT INTO `menu` VALUES (5, '2018-12-18 15:17:28', b'0', '菜单管理', 'system/menu/index', 1, 5, 'menu', 'menu');
|
||||
INSERT INTO `menu` VALUES (6, '2018-12-18 15:17:48', b'0', '系统监控', NULL, 0, 10, 'monitor', 'monitor');
|
||||
INSERT INTO `menu` VALUES (7, '2018-12-18 15:18:26', b'0', '操作日志', 'monitor/log/index', 6, 11, 'log', 'logs');
|
||||
INSERT INTO `menu` VALUES (8, '2018-12-18 15:19:01', b'0', '系统缓存', 'monitor/redis/index', 6, 13, 'redis', 'redis');
|
||||
INSERT INTO `menu` VALUES (9, '2018-12-18 15:19:34', b'1', 'SQL监控', NULL, 6, 14, 'sqlMonitor', 'http://api.auauz.net/druid');
|
||||
INSERT INTO `menu` VALUES (10, '2018-12-19 13:38:16', b'0', '组件管理', NULL, 0, 50, 'zujian', 'components');
|
||||
INSERT INTO `menu` VALUES (11, '2018-12-19 13:38:49', b'0', '图标库', 'components/IconSelect', 10, 51, 'icon', 'icon');
|
||||
INSERT INTO `menu` VALUES (12, '2018-12-24 20:37:35', b'0', '实时控制台', 'monitor/log/msg', 6, 15, 'codeConsole', 'msg');
|
||||
INSERT INTO `menu` VALUES (13, '2018-12-27 10:11:26', b'0', '三方工具', '', 0, 30, 'tools', 'tools');
|
||||
INSERT INTO `menu` VALUES (14, '2018-12-27 10:13:09', b'0', '邮件工具', 'tools/email/index', 13, 31, 'email', 'email');
|
||||
INSERT INTO `menu` VALUES (15, '2018-12-27 11:58:25', b'0', '富文本', 'components/Editor', 10, 52, 'fwb', 'tinymce');
|
||||
INSERT INTO `menu` VALUES (16, '2018-12-28 09:36:53', b'0', 'SM.MS图床', 'tools/picture/index', 13, 32, 'image', 'pictures');
|
||||
INSERT INTO `menu` VALUES (17, '2018-12-28 15:09:49', b'1', '项目地址', '', 0, 0, 'github', 'https://github.com/elunez/eladmin');
|
||||
INSERT INTO `menu` VALUES (18, '2018-12-31 11:12:15', b'0', '七牛云存储', 'tools/qiniu/index', 13, 33, 'qiniu', 'qiniu');
|
||||
INSERT INTO `menu` VALUES (19, '2018-12-31 14:52:38', b'0', '支付宝工具', 'tools/aliPay/index', 13, 34, 'alipay', 'aliPay');
|
||||
INSERT INTO `menu` VALUES (21, '2019-01-04 16:22:03', b'0', '多级菜单', '', 0, 900, 'menu', 'nested');
|
||||
INSERT INTO `menu` VALUES (22, '2019-01-04 16:23:29', b'0', '二级菜单1', 'nested/menu1/index', 21, 999, 'menu', 'menu1');
|
||||
INSERT INTO `menu` VALUES (23, '2019-01-04 16:23:57', b'0', '二级菜单2', 'nested/menu2/index', 21, 999, 'menu', 'menu2');
|
||||
INSERT INTO `menu` VALUES (24, '2019-01-04 16:24:48', b'0', '三级菜单1', 'nested/menu1/menu1-1', 22, 999, 'menu', 'menu1-1');
|
||||
INSERT INTO `menu` VALUES (27, '2019-01-07 17:27:32', b'0', '三级菜单2', 'nested/menu1/menu1-2', 22, 999, 'menu', 'menu1-2');
|
||||
INSERT INTO `menu` VALUES (28, '2019-01-07 20:34:40', b'0', '定时任务', 'system/timing/index', 1, 6, 'timing', 'timing');
|
||||
INSERT INTO `menu` VALUES (30, '2019-01-11 15:45:55', b'0', '代码生成', 'generator/index', 1, 8, 'dev', 'generator');
|
||||
INSERT INTO `menu` VALUES (32, '2019-01-13 13:49:03', b'0', '异常日志', 'monitor/log/errorLog', 6, 12, 'error', 'errorLog');
|
||||
INSERT INTO `menu` VALUES (33, '2019-03-08 13:46:44', b'0', 'Markdown', 'components/MarkDown', 10, 53, 'markdown', 'markdown');
|
||||
INSERT INTO `menu` VALUES (34, '2019-03-08 15:49:40', b'0', 'Yaml编辑器', 'components/YamlEdit', 10, 54, 'dev', 'yaml');
|
||||
INSERT INTO `menu` VALUES ('1', '2018-12-18 15:11:29', '\0', '系统管理', null, '0', '1', 'system', 'system');
|
||||
INSERT INTO `menu` VALUES ('2', '2018-12-18 15:14:44', '\0', '用户管理', 'system/user/index', '1', '2', 'peoples', 'user');
|
||||
INSERT INTO `menu` VALUES ('3', '2018-12-18 15:16:07', '\0', '角色管理', 'system/role/index', '1', '3', 'role', 'role');
|
||||
INSERT INTO `menu` VALUES ('4', '2018-12-18 15:16:45', '\0', '权限管理', 'system/permission/index', '1', '4', 'permission', 'permission');
|
||||
INSERT INTO `menu` VALUES ('5', '2018-12-18 15:17:28', '\0', '菜单管理', 'system/menu/index', '1', '5', 'menu', 'menu');
|
||||
INSERT INTO `menu` VALUES ('6', '2018-12-18 15:17:48', '\0', '系统监控', null, '0', '10', 'monitor', 'monitor');
|
||||
INSERT INTO `menu` VALUES ('7', '2018-12-18 15:18:26', '\0', '操作日志', 'monitor/log/index', '6', '11', 'log', 'logs');
|
||||
INSERT INTO `menu` VALUES ('8', '2018-12-18 15:19:01', '\0', '系统缓存', 'monitor/redis/index', '6', '13', 'redis', 'redis');
|
||||
INSERT INTO `menu` VALUES ('9', '2018-12-18 15:19:34', '\0', 'SQL监控', 'monitor/sql/index', '6', '14', 'sqlMonitor', 'druid');
|
||||
INSERT INTO `menu` VALUES ('10', '2018-12-19 13:38:16', '\0', '组件管理', null, '0', '50', 'zujian', 'components');
|
||||
INSERT INTO `menu` VALUES ('11', '2018-12-19 13:38:49', '\0', '图标库', 'components/IconSelect', '10', '51', 'icon', 'icon');
|
||||
INSERT INTO `menu` VALUES ('12', '2018-12-24 20:37:35', '\0', '实时控制台', 'monitor/log/msg', '6', '16', 'codeConsole', 'msg');
|
||||
INSERT INTO `menu` VALUES ('14', '2018-12-27 10:13:09', '\0', '邮件工具', 'tools/email/index', '36', '24', 'email', 'email');
|
||||
INSERT INTO `menu` VALUES ('15', '2018-12-27 11:58:25', '\0', '富文本', 'components/Editor', '10', '52', 'fwb', 'tinymce');
|
||||
INSERT INTO `menu` VALUES ('16', '2018-12-28 09:36:53', '\0', '图床管理', 'tools/picture/index', '36', '25', 'image', 'pictures');
|
||||
INSERT INTO `menu` VALUES ('17', '2018-12-28 15:09:49', '', '项目地址', '', '0', '0', 'github', 'https://github.com/elunez/eladmin');
|
||||
INSERT INTO `menu` VALUES ('18', '2018-12-31 11:12:15', '\0', '七牛云存储', 'tools/qiniu/index', '36', '26', 'qiniu', 'qiniu');
|
||||
INSERT INTO `menu` VALUES ('19', '2018-12-31 14:52:38', '\0', '支付宝工具', 'tools/aliPay/index', '36', '27', 'alipay', 'aliPay');
|
||||
INSERT INTO `menu` VALUES ('21', '2019-01-04 16:22:03', '\0', '多级菜单', '', '0', '900', 'menu', 'nested');
|
||||
INSERT INTO `menu` VALUES ('22', '2019-01-04 16:23:29', '\0', '二级菜单1', 'nested/menu1/index', '21', '999', 'menu', 'menu1');
|
||||
INSERT INTO `menu` VALUES ('23', '2019-01-04 16:23:57', '\0', '二级菜单2', 'nested/menu2/index', '21', '999', 'menu', 'menu2');
|
||||
INSERT INTO `menu` VALUES ('24', '2019-01-04 16:24:48', '\0', '三级菜单1', 'nested/menu1/menu1-1', '22', '999', 'menu', 'menu1-1');
|
||||
INSERT INTO `menu` VALUES ('27', '2019-01-07 17:27:32', '\0', '三级菜单2', 'nested/menu1/menu1-2', '22', '999', 'menu', 'menu1-2');
|
||||
INSERT INTO `menu` VALUES ('28', '2019-01-07 20:34:40', '\0', '定时任务', 'system/timing/index', '36', '21', 'timing', 'timing');
|
||||
INSERT INTO `menu` VALUES ('30', '2019-01-11 15:45:55', '\0', '代码生成', 'generator/index', '36', '22', 'dev', 'generator');
|
||||
INSERT INTO `menu` VALUES ('32', '2019-01-13 13:49:03', '\0', '异常日志', 'monitor/log/errorLog', '6', '12', 'error', 'errorLog');
|
||||
INSERT INTO `menu` VALUES ('33', '2019-03-08 13:46:44', '\0', 'Markdown', 'components/MarkDown', '10', '53', 'markdown', 'markdown');
|
||||
INSERT INTO `menu` VALUES ('34', '2019-03-08 15:49:40', '\0', 'Yaml编辑器', 'components/YamlEdit', '10', '54', 'dev', 'yaml');
|
||||
INSERT INTO `menu` VALUES ('35', '2019-03-25 09:46:00', '\0', '部门管理', 'system/dept/index', '1', '6', 'dept', 'dept');
|
||||
INSERT INTO `menu` VALUES ('36', '2019-03-29 10:57:35', '\0', '系统工具', '', '0', '20', 'sys-tools', 'sys-tools');
|
||||
INSERT INTO `menu` VALUES ('37', '2019-03-29 13:51:18', '\0', '岗位管理', 'system/job/index', '1', '7', 'Steve-Jobs', 'job');
|
||||
INSERT INTO `menu` VALUES ('38', '2019-03-29 19:57:53', '\0', '接口文档', 'tools/swagger/index', '36', '23', 'swagger', 'swagger2');
|
||||
INSERT INTO `menu` VALUES ('39', '2019-04-10 11:49:04', '\0', '字典管理', 'system/dict/index', '1', '8', 'dictionary', 'dict');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for permission
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `permission`;
|
||||
CREATE TABLE `permission` (
|
||||
CREATE TABLE `permission` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '别名',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称',
|
||||
`alias` varchar(255) DEFAULT NULL COMMENT '别名',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '名称',
|
||||
`pid` int(11) NOT NULL COMMENT '上级权限',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of permission
|
||||
-- ----------------------------
|
||||
INSERT INTO `permission` VALUES (1, '超级管理员', '2018-12-03 12:27:48', 'ADMIN', 0);
|
||||
INSERT INTO `permission` VALUES (2, '用户管理', '2018-12-03 12:28:19', 'USER_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (3, '用户查询', '2018-12-03 12:31:35', 'USER_SELECT', 2);
|
||||
INSERT INTO `permission` VALUES (4, '用户创建', '2018-12-03 12:31:35', 'USER_CREATE', 2);
|
||||
INSERT INTO `permission` VALUES (5, '用户编辑', '2018-12-03 12:31:35', 'USER_EDIT', 2);
|
||||
INSERT INTO `permission` VALUES (6, '用户删除', '2018-12-03 12:31:35', 'USER_DELETE', 2);
|
||||
INSERT INTO `permission` VALUES (7, '角色管理', '2018-12-03 12:28:19', 'ROLES_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (8, '角色查询', '2018-12-03 12:31:35', 'ROLES_SELECT', 7);
|
||||
INSERT INTO `permission` VALUES (10, '角色创建', '2018-12-09 20:10:16', 'ROLES_CREATE', 7);
|
||||
INSERT INTO `permission` VALUES (11, '角色编辑', '2018-12-09 20:10:42', 'ROLES_EDIT', 7);
|
||||
INSERT INTO `permission` VALUES (12, '角色删除', '2018-12-09 20:11:07', 'ROLES_DELETE', 7);
|
||||
INSERT INTO `permission` VALUES (13, '权限管理', '2018-12-09 20:11:37', 'PERMISSION_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (14, '权限查询', '2018-12-09 20:11:55', 'PERMISSION_SELECT', 13);
|
||||
INSERT INTO `permission` VALUES (15, '权限创建', '2018-12-09 20:14:10', 'PERMISSION_CREATE', 13);
|
||||
INSERT INTO `permission` VALUES (16, '权限编辑', '2018-12-09 20:15:44', 'PERMISSION_EDIT', 13);
|
||||
INSERT INTO `permission` VALUES (17, '权限删除', '2018-12-09 20:15:59', 'PERMISSION_DELETE', 13);
|
||||
INSERT INTO `permission` VALUES (18, '缓存管理', '2018-12-17 13:53:25', 'REDIS_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (19, '新增缓存', '2018-12-17 13:53:44', 'REDIS_CREATE', 18);
|
||||
INSERT INTO `permission` VALUES (20, '缓存查询', '2018-12-17 13:54:07', 'REDIS_SELECT', 18);
|
||||
INSERT INTO `permission` VALUES (21, '缓存编辑', '2018-12-17 13:54:26', 'REDIS_EDIT', 18);
|
||||
INSERT INTO `permission` VALUES (22, '缓存删除', '2018-12-17 13:55:04', 'REDIS_DELETE', 18);
|
||||
INSERT INTO `permission` VALUES (23, '图床管理', '2018-12-27 20:31:49', 'PICTURE_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (24, '查询图片', '2018-12-27 20:32:04', 'PICTURE_SELECT', 23);
|
||||
INSERT INTO `permission` VALUES (25, '上传图片', '2018-12-27 20:32:24', 'PICTURE_UPLOAD', 23);
|
||||
INSERT INTO `permission` VALUES (26, '删除图片', '2018-12-27 20:32:45', 'PICTURE_DELETE', 23);
|
||||
INSERT INTO `permission` VALUES (29, '菜单管理', '2018-12-28 17:34:31', 'MENU_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (30, '菜单查询', '2018-12-28 17:34:41', 'MENU_SELECT', 29);
|
||||
INSERT INTO `permission` VALUES (31, '菜单创建', '2018-12-28 17:34:52', 'MENU_CREATE', 29);
|
||||
INSERT INTO `permission` VALUES (32, '菜单编辑', '2018-12-28 17:35:20', 'MENU_EDIT', 29);
|
||||
INSERT INTO `permission` VALUES (33, '菜单删除', '2018-12-28 17:35:29', 'MENU_DELETE', 29);
|
||||
INSERT INTO `permission` VALUES (35, '定时任务管理', '2019-01-08 14:59:57', 'JOB_ALL', 0);
|
||||
INSERT INTO `permission` VALUES (36, '任务查询', '2019-01-08 15:00:09', 'JOB_SELECT', 35);
|
||||
INSERT INTO `permission` VALUES (37, '任务创建', '2019-01-08 15:00:20', 'JOB_CREATE', 35);
|
||||
INSERT INTO `permission` VALUES (38, '任务编辑', '2019-01-08 15:00:33', 'JOB_EDIT', 35);
|
||||
INSERT INTO `permission` VALUES (39, '任务删除', '2019-01-08 15:01:13', 'JOB_DELETE', 35);
|
||||
INSERT INTO `permission` VALUES ('1', '超级管理员', '2018-12-03 12:27:48', 'ADMIN', '0');
|
||||
INSERT INTO `permission` VALUES ('2', '用户管理', '2018-12-03 12:28:19', 'USER_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('3', '用户查询', '2018-12-03 12:31:35', 'USER_SELECT', '2');
|
||||
INSERT INTO `permission` VALUES ('4', '用户创建', '2018-12-03 12:31:35', 'USER_CREATE', '2');
|
||||
INSERT INTO `permission` VALUES ('5', '用户编辑', '2018-12-03 12:31:35', 'USER_EDIT', '2');
|
||||
INSERT INTO `permission` VALUES ('6', '用户删除', '2018-12-03 12:31:35', 'USER_DELETE', '2');
|
||||
INSERT INTO `permission` VALUES ('7', '角色管理', '2018-12-03 12:28:19', 'ROLES_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('8', '角色查询', '2018-12-03 12:31:35', 'ROLES_SELECT', '7');
|
||||
INSERT INTO `permission` VALUES ('10', '角色创建', '2018-12-09 20:10:16', 'ROLES_CREATE', '7');
|
||||
INSERT INTO `permission` VALUES ('11', '角色编辑', '2018-12-09 20:10:42', 'ROLES_EDIT', '7');
|
||||
INSERT INTO `permission` VALUES ('12', '角色删除', '2018-12-09 20:11:07', 'ROLES_DELETE', '7');
|
||||
INSERT INTO `permission` VALUES ('13', '权限管理', '2018-12-09 20:11:37', 'PERMISSION_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('14', '权限查询', '2018-12-09 20:11:55', 'PERMISSION_SELECT', '13');
|
||||
INSERT INTO `permission` VALUES ('15', '权限创建', '2018-12-09 20:14:10', 'PERMISSION_CREATE', '13');
|
||||
INSERT INTO `permission` VALUES ('16', '权限编辑', '2018-12-09 20:15:44', 'PERMISSION_EDIT', '13');
|
||||
INSERT INTO `permission` VALUES ('17', '权限删除', '2018-12-09 20:15:59', 'PERMISSION_DELETE', '13');
|
||||
INSERT INTO `permission` VALUES ('18', '缓存管理', '2018-12-17 13:53:25', 'REDIS_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('19', '新增缓存', '2018-12-17 13:53:44', 'REDIS_CREATE', '18');
|
||||
INSERT INTO `permission` VALUES ('20', '缓存查询', '2018-12-17 13:54:07', 'REDIS_SELECT', '18');
|
||||
INSERT INTO `permission` VALUES ('21', '缓存编辑', '2018-12-17 13:54:26', 'REDIS_EDIT', '18');
|
||||
INSERT INTO `permission` VALUES ('22', '缓存删除', '2018-12-17 13:55:04', 'REDIS_DELETE', '18');
|
||||
INSERT INTO `permission` VALUES ('23', '图床管理', '2018-12-27 20:31:49', 'PICTURE_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('24', '查询图片', '2018-12-27 20:32:04', 'PICTURE_SELECT', '23');
|
||||
INSERT INTO `permission` VALUES ('25', '上传图片', '2018-12-27 20:32:24', 'PICTURE_UPLOAD', '23');
|
||||
INSERT INTO `permission` VALUES ('26', '删除图片', '2018-12-27 20:32:45', 'PICTURE_DELETE', '23');
|
||||
INSERT INTO `permission` VALUES ('29', '菜单管理', '2018-12-28 17:34:31', 'MENU_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('30', '菜单查询', '2018-12-28 17:34:41', 'MENU_SELECT', '29');
|
||||
INSERT INTO `permission` VALUES ('31', '菜单创建', '2018-12-28 17:34:52', 'MENU_CREATE', '29');
|
||||
INSERT INTO `permission` VALUES ('32', '菜单编辑', '2018-12-28 17:35:20', 'MENU_EDIT', '29');
|
||||
INSERT INTO `permission` VALUES ('33', '菜单删除', '2018-12-28 17:35:29', 'MENU_DELETE', '29');
|
||||
INSERT INTO `permission` VALUES ('35', '定时任务管理', '2019-01-08 14:59:57', 'JOB_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('36', '任务查询', '2019-01-08 15:00:09', 'JOB_SELECT', '35');
|
||||
INSERT INTO `permission` VALUES ('37', '任务创建', '2019-01-08 15:00:20', 'JOB_CREATE', '35');
|
||||
INSERT INTO `permission` VALUES ('38', '任务编辑', '2019-01-08 15:00:33', 'JOB_EDIT', '35');
|
||||
INSERT INTO `permission` VALUES ('39', '任务删除', '2019-01-08 15:01:13', 'JOB_DELETE', '35');
|
||||
INSERT INTO `permission` VALUES ('40', '部门管理', '2019-03-29 17:06:55', 'DEPT_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('41', '部门查询', '2019-03-29 17:07:09', 'DEPT_SELECT', '40');
|
||||
INSERT INTO `permission` VALUES ('42', '部门创建', '2019-03-29 17:07:29', 'DEPT_CREATE', '40');
|
||||
INSERT INTO `permission` VALUES ('43', '部门编辑', '2019-03-29 17:07:52', 'DEPT_EDIT', '40');
|
||||
INSERT INTO `permission` VALUES ('44', '部门删除', '2019-03-29 17:08:14', 'DEPT_DELETE', '40');
|
||||
INSERT INTO `permission` VALUES ('45', '岗位管理', '2019-03-29 17:08:52', 'USERJOB_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('46', '岗位查询', '2019-03-29 17:10:27', 'USERJOB_SELECT', '45');
|
||||
INSERT INTO `permission` VALUES ('47', '岗位创建', '2019-03-29 17:10:55', 'USERJOB_CREATE', '45');
|
||||
INSERT INTO `permission` VALUES ('48', '岗位编辑', '2019-03-29 17:11:08', 'USERJOB_EDIT', '45');
|
||||
INSERT INTO `permission` VALUES ('49', '岗位删除', '2019-03-29 17:11:19', 'USERJOB_DELETE', '45');
|
||||
INSERT INTO `permission` VALUES ('50', '字典管理', '2019-04-10 16:24:51', 'DICT_ALL', '0');
|
||||
INSERT INTO `permission` VALUES ('51', '字典查询', '2019-04-10 16:25:16', 'DICT_SELECT', '50');
|
||||
INSERT INTO `permission` VALUES ('52', '字典创建', '2019-04-10 16:25:29', 'DICT_CREATE', '50');
|
||||
INSERT INTO `permission` VALUES ('53', '字典编辑', '2019-04-10 16:27:19', 'DICT_EDIT', '50');
|
||||
INSERT INTO `permission` VALUES ('54', '字典删除', '2019-04-10 16:27:30', 'DICT_DELETE', '50');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for picture
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `picture`;
|
||||
CREATE TABLE `picture` (
|
||||
CREATE TABLE `picture` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '上传日期',
|
||||
`delete_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '删除的URL',
|
||||
`filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片名称',
|
||||
`height` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片高度',
|
||||
`size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片大小',
|
||||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片地址',
|
||||
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名称',
|
||||
`width` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图片宽度',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '上传日期',
|
||||
`delete_url` varchar(255) DEFAULT NULL COMMENT '删除的URL',
|
||||
`filename` varchar(255) DEFAULT NULL COMMENT '图片名称',
|
||||
`height` varchar(255) DEFAULT NULL COMMENT '图片高度',
|
||||
`size` varchar(255) DEFAULT NULL COMMENT '图片大小',
|
||||
`url` varchar(255) DEFAULT NULL COMMENT '图片地址',
|
||||
`username` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||
`width` varchar(255) DEFAULT NULL COMMENT '图片宽度',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qiniu_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qiniu_config`;
|
||||
CREATE TABLE `qiniu_config` (
|
||||
CREATE TABLE `qiniu_config` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`access_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'accessKey',
|
||||
`bucket` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Bucket 识别符',
|
||||
`host` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '外链域名',
|
||||
`secret_key` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'secretKey',
|
||||
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '空间类型',
|
||||
`zone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机房',
|
||||
`access_key` text COMMENT 'accessKey',
|
||||
`bucket` varchar(255) DEFAULT NULL COMMENT 'Bucket 识别符',
|
||||
`host` varchar(255) NOT NULL COMMENT '外链域名',
|
||||
`secret_key` text COMMENT 'secretKey',
|
||||
`type` varchar(255) DEFAULT NULL COMMENT '空间类型',
|
||||
`zone` varchar(255) DEFAULT NULL COMMENT '机房',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for qiniu_content
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `qiniu_content`;
|
||||
CREATE TABLE `qiniu_content` (
|
||||
CREATE TABLE `qiniu_content` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`bucket` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Bucket 识别符',
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名称',
|
||||
`size` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件大小',
|
||||
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件类型:私有或公开',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '上传或同步的时间',
|
||||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件url',
|
||||
`bucket` varchar(255) DEFAULT NULL COMMENT 'Bucket 识别符',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '文件名称',
|
||||
`size` varchar(255) DEFAULT NULL COMMENT '文件大小',
|
||||
`type` varchar(255) DEFAULT NULL COMMENT '文件类型:私有或公开',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '上传或同步的时间',
|
||||
`url` varchar(255) DEFAULT NULL COMMENT '文件url',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for quartz_job
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `quartz_job`;
|
||||
CREATE TABLE `quartz_job` (
|
||||
CREATE TABLE `quartz_job` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`bean_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Spring Bean名称',
|
||||
`cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'cron 表达式',
|
||||
`is_pause` bit(1) NULL DEFAULT NULL COMMENT '状态:1暂停、0启用',
|
||||
`job_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务名称',
|
||||
`method_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方法名称',
|
||||
`params` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数',
|
||||
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '创建或更新日期',
|
||||
`bean_name` varchar(255) DEFAULT NULL COMMENT 'Spring Bean名称',
|
||||
`cron_expression` varchar(255) DEFAULT NULL COMMENT 'cron 表达式',
|
||||
`is_pause` bit(1) DEFAULT NULL COMMENT '状态:1暂停、0启用',
|
||||
`job_name` varchar(255) DEFAULT NULL COMMENT '任务名称',
|
||||
`method_name` varchar(255) DEFAULT NULL COMMENT '方法名称',
|
||||
`params` varchar(255) DEFAULT NULL COMMENT '参数',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '创建或更新日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of quartz_job
|
||||
-- ----------------------------
|
||||
INSERT INTO `quartz_job` VALUES (1, 'visitsTask', '0 0 0 * * ?', b'0', '更新访客记录', 'run', NULL, '每日0点创建新的访客记录', '2019-01-08 14:53:31');
|
||||
INSERT INTO `quartz_job` VALUES (2, 'testTask', '0/5 * * * * ?', b'1', '测试1', 'run1', 'test', '带参测试,多参使用json', '2019-01-13 14:20:50');
|
||||
INSERT INTO `quartz_job` VALUES (3, 'testTask', '0/5 * * * * ?', b'1', '测试', 'run', '', '不带参测试', '2019-03-04 15:22:55');
|
||||
INSERT INTO `quartz_job` VALUES ('1', 'visitsTask', '0 0 0 * * ?', '\0', '更新访客记录', 'run', null, '每日0点创建新的访客记录', '2019-01-08 14:53:31');
|
||||
INSERT INTO `quartz_job` VALUES ('2', 'testTask', '0/5 * * * * ?', '', '测试1', 'run1', 'test', '带参测试,多参使用json', '2019-01-13 14:20:50');
|
||||
INSERT INTO `quartz_job` VALUES ('3', 'testTask', '0/5 * * * * ?', '', '测试', 'run', '', '不带参测试', '2019-04-09 16:16:44');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for quartz_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `quartz_log`;
|
||||
CREATE TABLE `quartz_log` (
|
||||
CREATE TABLE `quartz_log` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`baen_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`create_time` datetime NULL DEFAULT NULL,
|
||||
`cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`exception_detail` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
|
||||
`is_success` bit(1) NULL DEFAULT NULL,
|
||||
`job_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`method_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`params` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`time` bigint(20) NULL DEFAULT NULL,
|
||||
`baen_name` varchar(255) DEFAULT NULL,
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`cron_expression` varchar(255) DEFAULT NULL,
|
||||
`exception_detail` text,
|
||||
`is_success` bit(1) DEFAULT NULL,
|
||||
`job_name` varchar(255) DEFAULT NULL,
|
||||
`method_name` varchar(255) DEFAULT NULL,
|
||||
`params` varchar(255) DEFAULT NULL,
|
||||
`time` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of quartz_log
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `role`;
|
||||
CREATE TABLE `role` (
|
||||
CREATE TABLE `role` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
|
||||
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`data_scope` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of role
|
||||
-- ----------------------------
|
||||
INSERT INTO `role` VALUES (1, '2018-11-23 11:04:37', '管理员', '系统所有权');
|
||||
INSERT INTO `role` VALUES (2, '2018-11-23 13:09:06', '普通用户', '用于测试菜单与权限');
|
||||
INSERT INTO `role` VALUES ('1', '2018-11-23 11:04:37', '管理员', '系统所有权', '全部');
|
||||
INSERT INTO `role` VALUES ('2', '2018-11-23 13:09:06', '普通用户', '用于测试菜单与权限', '自定义');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles_depts
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles_depts`;
|
||||
CREATE TABLE `roles_depts` (
|
||||
`role_id` bigint(20) NOT NULL,
|
||||
`dept_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`role_id`,`dept_id`),
|
||||
KEY `FK7qg6itn5ajdoa9h9o78v9ksur` (`dept_id`),
|
||||
CONSTRAINT `FK7qg6itn5ajdoa9h9o78v9ksur` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`),
|
||||
CONSTRAINT `FKrg1ci4cxxfbja0sb0pddju7k` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles_depts
|
||||
-- ----------------------------
|
||||
INSERT INTO `roles_depts` VALUES ('2', '7');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles_menus
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles_menus`;
|
||||
CREATE TABLE `roles_menus` (
|
||||
CREATE TABLE `roles_menus` (
|
||||
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
|
||||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||||
PRIMARY KEY (`menu_id`, `role_id`) USING BTREE,
|
||||
INDEX `FKcngg2qadojhi3a651a5adkvbq`(`role_id`) USING BTREE,
|
||||
CONSTRAINT `FKcngg2qadojhi3a651a5adkvbq` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `FKq1knxf8ykt26we8k331naabjx` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
PRIMARY KEY (`menu_id`,`role_id`) USING BTREE,
|
||||
KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE,
|
||||
CONSTRAINT `FKcngg2qadojhi3a651a5adkvbq` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FKq1knxf8ykt26we8k331naabjx` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles_menus
|
||||
-- ----------------------------
|
||||
INSERT INTO `roles_menus` VALUES (1, 1);
|
||||
INSERT INTO `roles_menus` VALUES (2, 1);
|
||||
INSERT INTO `roles_menus` VALUES (3, 1);
|
||||
INSERT INTO `roles_menus` VALUES (4, 1);
|
||||
INSERT INTO `roles_menus` VALUES (5, 1);
|
||||
INSERT INTO `roles_menus` VALUES (6, 1);
|
||||
INSERT INTO `roles_menus` VALUES (7, 1);
|
||||
INSERT INTO `roles_menus` VALUES (8, 1);
|
||||
INSERT INTO `roles_menus` VALUES (9, 1);
|
||||
INSERT INTO `roles_menus` VALUES (10, 1);
|
||||
INSERT INTO `roles_menus` VALUES (11, 1);
|
||||
INSERT INTO `roles_menus` VALUES (12, 1);
|
||||
INSERT INTO `roles_menus` VALUES (13, 1);
|
||||
INSERT INTO `roles_menus` VALUES (14, 1);
|
||||
INSERT INTO `roles_menus` VALUES (15, 1);
|
||||
INSERT INTO `roles_menus` VALUES (16, 1);
|
||||
INSERT INTO `roles_menus` VALUES (17, 1);
|
||||
INSERT INTO `roles_menus` VALUES (18, 1);
|
||||
INSERT INTO `roles_menus` VALUES (19, 1);
|
||||
INSERT INTO `roles_menus` VALUES (21, 1);
|
||||
INSERT INTO `roles_menus` VALUES (22, 1);
|
||||
INSERT INTO `roles_menus` VALUES (23, 1);
|
||||
INSERT INTO `roles_menus` VALUES (24, 1);
|
||||
INSERT INTO `roles_menus` VALUES (27, 1);
|
||||
INSERT INTO `roles_menus` VALUES (28, 1);
|
||||
INSERT INTO `roles_menus` VALUES (30, 1);
|
||||
INSERT INTO `roles_menus` VALUES (32, 1);
|
||||
INSERT INTO `roles_menus` VALUES (33, 1);
|
||||
INSERT INTO `roles_menus` VALUES (34, 1);
|
||||
INSERT INTO `roles_menus` VALUES (1, 2);
|
||||
INSERT INTO `roles_menus` VALUES (2, 2);
|
||||
INSERT INTO `roles_menus` VALUES (3, 2);
|
||||
INSERT INTO `roles_menus` VALUES (4, 2);
|
||||
INSERT INTO `roles_menus` VALUES (5, 2);
|
||||
INSERT INTO `roles_menus` VALUES (6, 2);
|
||||
INSERT INTO `roles_menus` VALUES (8, 2);
|
||||
INSERT INTO `roles_menus` VALUES (10, 2);
|
||||
INSERT INTO `roles_menus` VALUES (11, 2);
|
||||
INSERT INTO `roles_menus` VALUES (12, 2);
|
||||
INSERT INTO `roles_menus` VALUES (13, 2);
|
||||
INSERT INTO `roles_menus` VALUES (14, 2);
|
||||
INSERT INTO `roles_menus` VALUES (15, 2);
|
||||
INSERT INTO `roles_menus` VALUES (16, 2);
|
||||
INSERT INTO `roles_menus` VALUES (17, 2);
|
||||
INSERT INTO `roles_menus` VALUES (19, 2);
|
||||
INSERT INTO `roles_menus` VALUES (21, 2);
|
||||
INSERT INTO `roles_menus` VALUES (22, 2);
|
||||
INSERT INTO `roles_menus` VALUES (23, 2);
|
||||
INSERT INTO `roles_menus` VALUES (24, 2);
|
||||
INSERT INTO `roles_menus` VALUES (27, 2);
|
||||
INSERT INTO `roles_menus` VALUES (28, 2);
|
||||
INSERT INTO `roles_menus` VALUES (33, 2);
|
||||
INSERT INTO `roles_menus` VALUES (34, 2);
|
||||
INSERT INTO `roles_menus` VALUES ('1', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('2', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('3', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('4', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('5', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('6', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('7', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('8', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('9', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('10', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('11', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('12', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('14', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('15', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('16', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('17', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('18', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('19', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('21', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('22', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('23', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('24', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('27', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('28', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('30', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('32', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('33', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('34', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('35', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('36', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('37', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('38', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('39', '1');
|
||||
INSERT INTO `roles_menus` VALUES ('1', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('2', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('3', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('4', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('5', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('6', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('10', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('11', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('12', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('15', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('16', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('17', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('18', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('19', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('21', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('22', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('23', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('24', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('27', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('33', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('34', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('35', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('36', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('37', '2');
|
||||
INSERT INTO `roles_menus` VALUES ('38', '2');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles_permissions
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles_permissions`;
|
||||
CREATE TABLE `roles_permissions` (
|
||||
CREATE TABLE `roles_permissions` (
|
||||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||||
`permission_id` bigint(20) NOT NULL COMMENT '权限ID',
|
||||
PRIMARY KEY (`role_id`, `permission_id`) USING BTREE,
|
||||
INDEX `FKboeuhl31go7wer3bpy6so7exi`(`permission_id`) USING BTREE,
|
||||
CONSTRAINT `FK4hrolwj4ned5i7qe8kyiaak6m` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `FKboeuhl31go7wer3bpy6so7exi` FOREIGN KEY (`permission_id`) REFERENCES `permission` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
PRIMARY KEY (`role_id`,`permission_id`) USING BTREE,
|
||||
KEY `FKboeuhl31go7wer3bpy6so7exi` (`permission_id`) USING BTREE,
|
||||
CONSTRAINT `FK4hrolwj4ned5i7qe8kyiaak6m` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FKboeuhl31go7wer3bpy6so7exi` FOREIGN KEY (`permission_id`) REFERENCES `permission` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles_permissions
|
||||
-- ----------------------------
|
||||
INSERT INTO `roles_permissions` VALUES (1, 1);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 3);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 8);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 14);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 20);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 23);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 24);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 25);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 26);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 30);
|
||||
INSERT INTO `roles_permissions` VALUES (2, 36);
|
||||
INSERT INTO `roles_permissions` VALUES ('1', '1');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '3');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '4');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '8');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '14');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '23');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '24');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '25');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '26');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '30');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '41');
|
||||
INSERT INTO `roles_permissions` VALUES ('2', '46');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
CREATE TABLE `user` (
|
||||
CREATE TABLE `user` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
|
||||
`enabled` bigint(20) NULL DEFAULT NULL COMMENT '状态:1启用、0禁用',
|
||||
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
|
||||
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
|
||||
`last_password_reset_time` datetime NULL DEFAULT NULL COMMENT '最后修改密码的日期',
|
||||
`avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
|
||||
`enabled` bigint(20) DEFAULT NULL COMMENT '状态:1启用、0禁用',
|
||||
`password` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
`username` varchar(255) DEFAULT NULL COMMENT '用户名',
|
||||
`last_password_reset_time` datetime DEFAULT NULL COMMENT '最后修改密码的日期',
|
||||
`dept_id` bigint(20) DEFAULT NULL,
|
||||
`phone` varchar(255) DEFAULT NULL,
|
||||
`job_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `UK_kpubos9gc2cvtkb0thktkbkes`(`email`) USING BTREE,
|
||||
UNIQUE INDEX `username`(`username`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
UNIQUE KEY `UK_kpubos9gc2cvtkb0thktkbkes` (`email`) USING BTREE,
|
||||
UNIQUE KEY `username` (`username`) USING BTREE,
|
||||
KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`),
|
||||
KEY `FKfftoc2abhot8f2wu6cl9a5iky` (`job_id`),
|
||||
CONSTRAINT `FK5rwmryny6jthaaxkogownknqp` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`),
|
||||
CONSTRAINT `FKfftoc2abhot8f2wu6cl9a5iky` FOREIGN KEY (`job_id`) REFERENCES `job` (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
-- ----------------------------
|
||||
INSERT INTO `user` VALUES (1, 'https://i.loli.net/2019/03/12/5c87788a4ffca.jpg', '2018-08-23 09:11:56', 'zhengjie@tom.com', 1, '14e1b600b1fd579f47433b88e8d85291', 'admin', '2019-01-17 09:53:21');
|
||||
INSERT INTO `user` VALUES (3, 'https://i.loli.net/2019/03/12/5c87788a4ffca.jpg', '2018-12-27 20:05:26', 'test@qq.com', 1, '14e1b600b1fd579f47433b88e8d85291', 'test', NULL);
|
||||
INSERT INTO `user` VALUES ('1', 'https://i.loli.net/2019/04/04/5ca5b971e1548.jpeg', '2018-08-23 09:11:56', 'admin@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'admin', '2019-04-04 16:00:46', '2', '18888888888', '11');
|
||||
INSERT INTO `user` VALUES ('3', 'https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg', '2018-12-27 20:05:26', 'test@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'test', '2019-04-01 09:15:24', '2', '17777777777', '12');
|
||||
INSERT INTO `user` VALUES ('5', 'https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg', '2019-04-02 10:07:12', 'hr@eladmin.net', '1', 'e10adc3949ba59abbe56e057f20f883e', 'hr', null, '11', '15555555555', '8');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for users_roles
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `users_roles`;
|
||||
CREATE TABLE `users_roles` (
|
||||
CREATE TABLE `users_roles` (
|
||||
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
|
||||
PRIMARY KEY (`user_id`, `role_id`) USING BTREE,
|
||||
INDEX `FKq4eq273l04bpu4efj0jd0jb98`(`role_id`) USING BTREE,
|
||||
CONSTRAINT `users_roles_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `users_roles_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
PRIMARY KEY (`user_id`,`role_id`) USING BTREE,
|
||||
KEY `FKq4eq273l04bpu4efj0jd0jb98` (`role_id`) USING BTREE,
|
||||
CONSTRAINT `users_roles_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `users_roles_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of users_roles
|
||||
-- ----------------------------
|
||||
INSERT INTO `users_roles` VALUES (1, 1);
|
||||
INSERT INTO `users_roles` VALUES (3, 2);
|
||||
INSERT INTO `users_roles` VALUES ('1', '1');
|
||||
INSERT INTO `users_roles` VALUES ('3', '2');
|
||||
INSERT INTO `users_roles` VALUES ('5', '2');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for verification_code
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `verification_code`;
|
||||
CREATE TABLE `verification_code` (
|
||||
CREATE TABLE `verification_code` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验证码',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`status` bit(1) NULL DEFAULT NULL COMMENT '状态:1有效、0过期',
|
||||
`type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验证码类型:email或者短信',
|
||||
`value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收邮箱或者手机号码',
|
||||
`scenes` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '业务名称:如重置邮箱、重置密码等',
|
||||
`code` varchar(255) DEFAULT NULL COMMENT '验证码',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`status` bit(1) DEFAULT NULL COMMENT '状态:1有效、0过期',
|
||||
`type` varchar(255) DEFAULT NULL COMMENT '验证码类型:email或者短信',
|
||||
`value` varchar(255) DEFAULT NULL COMMENT '接收邮箱或者手机号码',
|
||||
`scenes` varchar(255) DEFAULT NULL COMMENT '业务名称:如重置邮箱、重置密码等',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for visits
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `visits`;
|
||||
CREATE TABLE `visits` (
|
||||
CREATE TABLE `visits` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`create_time` datetime NULL DEFAULT NULL,
|
||||
`date` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`ip_counts` bigint(20) NULL DEFAULT NULL,
|
||||
`pv_counts` bigint(20) NULL DEFAULT NULL,
|
||||
`week_day` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `UK_11aksgq87euk9bcyeesfs4vtp`(`date`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
`create_time` datetime DEFAULT NULL,
|
||||
`date` varchar(255) DEFAULT NULL,
|
||||
`ip_counts` bigint(20) DEFAULT NULL,
|
||||
`pv_counts` bigint(20) DEFAULT NULL,
|
||||
`week_day` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `UK_11aksgq87euk9bcyeesfs4vtp` (`date`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
-- ----------------------------
|
||||
-- Records of visits
|
||||
-- ----------------------------
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
package me.zhengjie.config;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.modules.system.service.DeptService;
|
||||
import me.zhengjie.modules.system.service.RoleService;
|
||||
import me.zhengjie.modules.system.service.UserService;
|
||||
import me.zhengjie.utils.SecurityContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 数据权限配置
|
||||
* @author jie
|
||||
* @date 2019-4-1
|
||||
*/
|
||||
@Component
|
||||
public class DataScope {
|
||||
|
||||
private final String[] scopeType = {"全部","本级","自定义"};
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
public Set<Long> getDeptIds() {
|
||||
|
||||
User user = userService.findByName(SecurityContextHolder.getUserDetails().getUsername());
|
||||
|
||||
// 用于存储部门id
|
||||
Set<Long> deptIds = new HashSet<>();
|
||||
|
||||
// 查询用户角色
|
||||
List<Role> roleSet = roleService.findByUsers_Id(user.getId());
|
||||
|
||||
for (Role role : roleSet) {
|
||||
|
||||
if (scopeType[0].equals(role.getDataScope())) {
|
||||
return new HashSet<>() ;
|
||||
}
|
||||
|
||||
// 存储本级的数据权限
|
||||
if (scopeType[1].equals(role.getDataScope())) {
|
||||
deptIds.add(user.getDept().getId());
|
||||
}
|
||||
|
||||
// 存储自定义的数据权限
|
||||
if (scopeType[2].equals(role.getDataScope())) {
|
||||
Set<Dept> deptList = role.getDepts();
|
||||
for (Dept dept : deptList) {
|
||||
deptIds.add(dept.getId());
|
||||
List<Dept> deptChildren = deptService.findByPid(dept.getId());
|
||||
if (deptChildren != null && deptChildren.size() != 0) {
|
||||
deptIds.addAll(getDeptChildren(deptChildren));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
|
||||
public List<Long> getDeptChildren(List<Dept> deptList) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
deptList.forEach(dept -> {
|
||||
if (dept!=null && dept.getEnabled()){
|
||||
List<Dept> depts = deptService.findByPid(dept.getId());
|
||||
if(deptList!=null && deptList.size()!=0){
|
||||
list.addAll(getDeptChildren(depts));
|
||||
}
|
||||
list.add(dept.getId());
|
||||
}
|
||||
}
|
||||
);
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -11,14 +11,13 @@ import java.util.Date;
|
|||
/**
|
||||
* 定义Logfilter拦截输出日志
|
||||
* @author jie
|
||||
* @reference https://cloud.tencent.com/developer/article/1096792
|
||||
* @date 2018-12-24
|
||||
*/
|
||||
public class LogFilter extends Filter<ILoggingEvent>{
|
||||
|
||||
@Override
|
||||
public FilterReply decide(ILoggingEvent event) {
|
||||
String exception = "";
|
||||
IThrowableProxy iThrowableProxy1 = event.getThrowableProxy();
|
||||
LogMessage loggerMessage = new LogMessage(
|
||||
event.getFormattedMessage(),
|
||||
DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())),
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
|
||||
/**
|
||||
* 创建一个阻塞队列,作为日志系统输出的日志的一个临时载体
|
||||
* @author jie
|
||||
* @author https://cloud.tencent.com/developer/article/1096792
|
||||
* @date 2018-12-24
|
||||
*/
|
||||
public class LoggerQueue {
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
package me.zhengjie.modules.monitor.config;
|
||||
|
||||
import me.zhengjie.modules.monitor.service.VisitsService;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 初始化站点统计
|
||||
* @author jie
|
||||
*/
|
||||
@Configuration
|
||||
public class VisitsInitialization {
|
||||
@Component
|
||||
public class VisitsInitialization implements ApplicationRunner {
|
||||
|
||||
public VisitsInitialization(VisitsService visitsService){
|
||||
@Autowired
|
||||
private VisitsService visitsService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
System.out.println("--------------- 初始化站点统计,如果存在今日统计则跳过 ---------------");
|
||||
visitsService.save();
|
||||
System.out.println("--------------- 初始化站点统计完成 ---------------");
|
||||
|
|
|
@ -9,10 +9,12 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
|||
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* 配置WebSocket消息代理端点,即stomp服务端
|
||||
* @author jie
|
||||
* @reference https://cloud.tencent.com/developer/article/1096792
|
||||
* @date 2018-12-24
|
||||
*/
|
||||
@Slf4j
|
||||
|
@ -22,8 +24,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
|||
@Autowired
|
||||
private SimpMessagingTemplate messagingTemplate;
|
||||
|
||||
@Autowired
|
||||
private ExecutorService executorService;
|
||||
private ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
|
||||
@Override
|
||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 郑杰
|
||||
* @author https://cloud.tencent.com/developer/article/1096792
|
||||
* @date 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
|
|
|
@ -82,7 +82,7 @@ public class RedisServiceImpl implements RedisService {
|
|||
Jedis jedis = null;
|
||||
try{
|
||||
jedis = pool.getResource();
|
||||
jedis.flushDB();
|
||||
jedis.flushAll();
|
||||
}finally{
|
||||
if(null != jedis){
|
||||
jedis.close(); // 释放资源还给连接池
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,14 +7,12 @@ import me.zhengjie.modules.quartz.service.QuartzJobService;
|
|||
import me.zhengjie.utils.SpringContextHolder;
|
||||
import me.zhengjie.utils.ThrowableUtil;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.Scheduler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
|
@ -25,13 +23,9 @@ import java.util.concurrent.Future;
|
|||
@Async
|
||||
public class ExecutionJob extends QuartzJobBean {
|
||||
|
||||
@Resource(name = "scheduler")
|
||||
private Scheduler scheduler;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private ExecutorService executorService;
|
||||
private ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) {
|
||||
|
|
|
@ -110,9 +110,8 @@ public class QuartzManage {
|
|||
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId());
|
||||
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
|
||||
// 如果不存在则创建一个定时任务
|
||||
if(trigger == null){
|
||||
if(trigger == null)
|
||||
addJob(quartzJob);
|
||||
}
|
||||
JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId());
|
||||
scheduler.resumeJob(jobKey);
|
||||
} catch (Exception e){
|
||||
|
@ -131,9 +130,8 @@ public class QuartzManage {
|
|||
TriggerKey triggerKey = TriggerKey.triggerKey(JOB_NAME + quartzJob.getId());
|
||||
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
|
||||
// 如果不存在则创建一个定时任务
|
||||
if(trigger == null){
|
||||
if(trigger == null)
|
||||
addJob(quartzJob);
|
||||
}
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put(QuartzJob.JOB_KEY, quartzJob);
|
||||
JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId());
|
||||
|
|
|
@ -93,12 +93,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
|
||||
.antMatchers( HttpMethod.POST,"/auth/"+loginPath).permitAll()
|
||||
.antMatchers("/websocket/**").permitAll()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
|
||||
// 支付宝回调
|
||||
.antMatchers("/api/aliPay/return").anonymous()
|
||||
.antMatchers("/api/aliPay/notify").anonymous()
|
||||
|
||||
// 系统监控
|
||||
.antMatchers("/actuator/**").anonymous()
|
||||
|
||||
// swagger start
|
||||
.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
|
@ -110,8 +111,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.antMatchers("/test/**").anonymous()
|
||||
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
|
||||
|
||||
.antMatchers("/druid/**").permitAll()
|
||||
// 所有请求都需要认证
|
||||
.anyRequest().authenticated();
|
||||
.anyRequest().authenticated()
|
||||
// 防止iframe 造成跨域
|
||||
.and().headers().frameOptions().disable();
|
||||
|
||||
httpSecurity
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
|
|
|
@ -34,7 +34,6 @@ public class JwtAuthorizationTokenFilter extends OncePerRequestFilter {
|
|||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
|
||||
log.debug("processing authentication for '{}'", request.getRequestURL());
|
||||
|
||||
final String requestHeader = request.getHeader(this.tokenHeader);
|
||||
|
||||
|
@ -49,10 +48,7 @@ public class JwtAuthorizationTokenFilter extends OncePerRequestFilter {
|
|||
}
|
||||
}
|
||||
|
||||
log.debug("checking authentication for user '{}'", username);
|
||||
|
||||
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
|
||||
log.debug("security context was null, so authorizating user");
|
||||
|
||||
// It is not compelling necessary to load the use details from the database. You could also store the information
|
||||
// in the token and read it from it. It's up to you ;)
|
||||
|
|
|
@ -30,8 +30,14 @@ public class JwtUser implements UserDetails {
|
|||
|
||||
private final String email;
|
||||
|
||||
private final String phone;
|
||||
|
||||
private final String dept;
|
||||
|
||||
private final String job;
|
||||
|
||||
@JsonIgnore
|
||||
private final Collection<? extends GrantedAuthority> authorities;
|
||||
private final Collection<GrantedAuthority> authorities;
|
||||
|
||||
private final boolean enabled;
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package me.zhengjie.modules.security.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Permission;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.modules.system.repository.PermissionRepository;
|
||||
import me.zhengjie.modules.system.repository.RoleRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "role")
|
||||
public class JwtPermissionService {
|
||||
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Autowired
|
||||
private PermissionRepository permissionRepository;
|
||||
|
||||
@Cacheable(key = "'loadPermissionByUser:' + #p0.username")
|
||||
public Collection<GrantedAuthority> mapToGrantedAuthorities(User user) {
|
||||
|
||||
System.out.println("--------------------loadPermissionByUser:" + user.getUsername() + "---------------------");
|
||||
|
||||
Set<Role> roles = roleRepository.findByUsers_Id(user.getId());
|
||||
|
||||
Set<Permission> permissions = new HashSet<>();
|
||||
for (Role role : roles) {
|
||||
Set<Role> roleSet = new HashSet<>();
|
||||
roleSet.add(role);
|
||||
permissions.addAll(permissionRepository.findByRoles_Id(role.getId()));
|
||||
}
|
||||
|
||||
return permissions.stream()
|
||||
.map(permission -> new SimpleGrantedAuthority(permission.getName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
|
@ -6,10 +6,10 @@ import me.zhengjie.modules.system.domain.User;
|
|||
import me.zhengjie.exception.EntityNotFoundException;
|
||||
import me.zhengjie.modules.system.repository.PermissionRepository;
|
||||
import me.zhengjie.modules.system.repository.RoleRepository;
|
||||
import me.zhengjie.modules.system.repository.UserRepository;
|
||||
import me.zhengjie.modules.security.security.JwtUser;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.system.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
@ -31,56 +31,36 @@ import java.util.stream.Collectors;
|
|||
public class JwtUserDetailsService implements UserDetailsService {
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Autowired
|
||||
private PermissionRepository permissionRepository;
|
||||
private JwtPermissionService permissionService;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username){
|
||||
|
||||
User user = null;
|
||||
if(ValidationUtil.isEmail(username)){
|
||||
user = userRepository.findByEmail(username);
|
||||
} else {
|
||||
user = userRepository.findByUsername(username);
|
||||
}
|
||||
|
||||
User user = userService.findByName(username);
|
||||
if (user == null) {
|
||||
throw new EntityNotFoundException(User.class, "name", username);
|
||||
} else {
|
||||
return create(user);
|
||||
return createJwtUser(user);
|
||||
}
|
||||
}
|
||||
|
||||
public UserDetails create(User user) {
|
||||
public UserDetails createJwtUser(User user) {
|
||||
return new JwtUser(
|
||||
user.getId(),
|
||||
user.getUsername(),
|
||||
user.getPassword(),
|
||||
user.getAvatar(),
|
||||
user.getEmail(),
|
||||
mapToGrantedAuthorities(roleRepository.findByUsers_Id(user.getId()),permissionRepository),
|
||||
user.getPhone(),
|
||||
user.getDept().getName(),
|
||||
user.getJob().getName(),
|
||||
permissionService.mapToGrantedAuthorities(user),
|
||||
user.getEnabled(),
|
||||
user.getCreateTime(),
|
||||
user.getLastPasswordResetTime()
|
||||
);
|
||||
}
|
||||
|
||||
private static List<GrantedAuthority> mapToGrantedAuthorities(Set<Role> roles,PermissionRepository permissionRepository) {
|
||||
|
||||
Set<Permission> permissions = new HashSet<>();
|
||||
for (Role role : roles) {
|
||||
Set<Role> roleSet = new HashSet<>();
|
||||
roleSet.add(role);
|
||||
permissions.addAll(permissionRepository.findByRoles_Id(role.getId()));
|
||||
}
|
||||
|
||||
return permissions.stream()
|
||||
.map(permission -> new SimpleGrantedAuthority(permission.getName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="dept")
|
||||
public class Dept implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(name = "name",nullable = false)
|
||||
@NotBlank
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
@Column(name = "pid",nullable = false)
|
||||
@NotNull
|
||||
private Long pid;
|
||||
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
@ManyToMany(mappedBy = "depts")
|
||||
@JsonIgnore
|
||||
private Set<Role> roles;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="dict")
|
||||
public class Dict implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
@Column(name = "name",nullable = false,unique = true)
|
||||
@NotBlank
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "remark")
|
||||
private String remark;
|
||||
|
||||
@OneToMany(mappedBy = "dict",cascade={CascadeType.PERSIST,CascadeType.REMOVE})
|
||||
private List<DictDetail> dictDetails;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="dict_detail")
|
||||
public class DictDetail implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
@Column(name = "label",nullable = false)
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
@Column(name = "value",nullable = false)
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Column(name = "sort")
|
||||
private String sort = "999";
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "dict_id")
|
||||
private Dict dict;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package me.zhengjie.modules.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.*;
|
||||
import javax.persistence.*;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="job")
|
||||
public class Job implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
@NotNull(groups = Update.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(name = "name",nullable = false)
|
||||
@NotBlank
|
||||
private String name;
|
||||
|
||||
@Column(unique = true)
|
||||
@NotNull
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Column(name = "enabled",nullable = false)
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "dept_id")
|
||||
private Dept dept;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@CreationTimestamp
|
||||
private Timestamp createTime;
|
||||
|
||||
public @interface Update {}
|
||||
}
|
|
@ -30,6 +30,7 @@ public class Menu implements Serializable {
|
|||
private String name;
|
||||
|
||||
@Column(unique = true)
|
||||
@NotNull
|
||||
private Long sort;
|
||||
|
||||
@Column(name = "path")
|
||||
|
|
|
@ -32,6 +32,10 @@ public class Role implements Serializable {
|
|||
@NotBlank
|
||||
private String name;
|
||||
|
||||
// 数据权限类型 全部 、 本级 、 自定义
|
||||
@Column(name = "data_scope")
|
||||
private String dataScope = "本级";
|
||||
|
||||
@Column
|
||||
private String remark;
|
||||
|
||||
|
@ -47,6 +51,10 @@ public class Role implements Serializable {
|
|||
@JoinTable(name = "roles_menus", joinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "menu_id",referencedColumnName = "id")})
|
||||
private Set<Menu> menus;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "roles_depts", joinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "dept_id",referencedColumnName = "id")})
|
||||
private Set<Dept> depts;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time")
|
||||
private Timestamp createTime;
|
||||
|
|
|
@ -29,6 +29,7 @@ public class User implements Serializable {
|
|||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@Column(unique = true)
|
||||
private String username;
|
||||
|
||||
private String avatar;
|
||||
|
@ -37,6 +38,9 @@ public class User implements Serializable {
|
|||
@Pattern(regexp = "([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}",message = "格式错误")
|
||||
private String email;
|
||||
|
||||
@NotBlank
|
||||
private String phone;
|
||||
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
|
@ -53,6 +57,14 @@ public class User implements Serializable {
|
|||
@JoinTable(name = "users_roles", joinColumns = {@JoinColumn(name = "user_id",referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "id")})
|
||||
private Set<Role> roles;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "job_id")
|
||||
private Job job;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "dept_id")
|
||||
private Dept dept;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
public interface DeptRepository extends JpaRepository<Dept, Long>, JpaSpecificationExecutor {
|
||||
|
||||
/**
|
||||
* findByPid
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Dept> findByPid(Long id);
|
||||
|
||||
Set<Dept> findByRoles_Id(Long id);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
public interface DictDetailRepository extends JpaRepository<DictDetail, Long>, JpaSpecificationExecutor {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
public interface DictRepository extends JpaRepository<Dict, Long>, JpaSpecificationExecutor {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
public interface JobRepository extends JpaRepository<Job, Long>, JpaSpecificationExecutor {
|
||||
}
|
|
@ -20,4 +20,6 @@ public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificat
|
|||
Role findByName(String name);
|
||||
|
||||
Set<Role> findByUsers_Id(Long id);
|
||||
|
||||
Set<Role> findByMenus_Id(Long id);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package me.zhengjie.modules.system.repository;
|
||||
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
|
@ -29,28 +33,28 @@ public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificat
|
|||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param id
|
||||
* @param username
|
||||
* @param pass
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "update user set password = ?2 , last_password_reset_time = ?3 where id = ?1",nativeQuery = true)
|
||||
void updatePass(Long id, String pass, Date lastPasswordResetTime);
|
||||
@Query(value = "update user set password = ?2 , last_password_reset_time = ?3 where username = ?1",nativeQuery = true)
|
||||
void updatePass(String username, String pass, Date lastPasswordResetTime);
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
* @param id
|
||||
* @param username
|
||||
* @param url
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "update user set avatar = ?2 where id = ?1",nativeQuery = true)
|
||||
void updateAvatar(Long id, String url);
|
||||
@Query(value = "update user set avatar = ?2 where username = ?1",nativeQuery = true)
|
||||
void updateAvatar(String username, String url);
|
||||
|
||||
/**
|
||||
* 修改邮箱
|
||||
* @param id
|
||||
* @param username
|
||||
* @param email
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "update user set email = ?2 where id = ?1",nativeQuery = true)
|
||||
void updateEmail(Long id, String email);
|
||||
@Query(value = "update user set email = ?2 where username = ?1",nativeQuery = true)
|
||||
void updateEmail(String username, String email);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.config.DataScope;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.DeptService;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import me.zhengjie.modules.system.service.query.DeptQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class DeptController {
|
||||
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private DeptQueryService deptQueryService;
|
||||
|
||||
@Autowired
|
||||
private DataScope dataScope;
|
||||
|
||||
private static final String ENTITY_NAME = "dept";
|
||||
|
||||
@Log("查询部门")
|
||||
@GetMapping(value = "/dept")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_SELECT','DEPT_ALL','DEPT_SELECT')")
|
||||
public ResponseEntity getDepts(DeptDTO resources){
|
||||
// 数据权限
|
||||
Set<Long> deptIds = dataScope.getDeptIds();
|
||||
List<DeptDTO> deptDTOS = deptQueryService.queryAll(resources, deptIds);
|
||||
return new ResponseEntity(deptService.buildTree(deptDTOS),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增部门")
|
||||
@PostMapping(value = "/dept")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody Dept resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
return new ResponseEntity(deptService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改部门")
|
||||
@PutMapping(value = "/dept")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_EDIT')")
|
||||
public ResponseEntity update(@Validated(Dept.Update.class) @RequestBody Dept resources){
|
||||
deptService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除部门")
|
||||
@DeleteMapping(value = "/dept/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DEPT_ALL','DEPT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
deptService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.modules.system.service.DictService;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import me.zhengjie.modules.system.service.query.DictQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class DictController {
|
||||
|
||||
@Autowired
|
||||
private DictService dictService;
|
||||
|
||||
@Autowired
|
||||
private DictQueryService dictQueryService;
|
||||
|
||||
private static final String ENTITY_NAME = "dict";
|
||||
|
||||
@Log("查询字典")
|
||||
@GetMapping(value = "/dict")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_SELECT')")
|
||||
public ResponseEntity getDicts(DictDTO resources, Pageable pageable){
|
||||
return new ResponseEntity(dictQueryService.queryAll(resources,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增字典")
|
||||
@PostMapping(value = "/dict")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody Dict resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
return new ResponseEntity(dictService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改字典")
|
||||
@PutMapping(value = "/dict")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_EDIT')")
|
||||
public ResponseEntity update(@Validated(Dict.Update.class) @RequestBody Dict resources){
|
||||
dictService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除字典")
|
||||
@DeleteMapping(value = "/dict/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
dictService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.modules.system.service.DictDetailService;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import me.zhengjie.modules.system.service.query.DictDetailQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class DictDetailController {
|
||||
|
||||
@Autowired
|
||||
private DictDetailService dictDetailService;
|
||||
|
||||
@Autowired
|
||||
private DictDetailQueryService dictDetailQueryService;
|
||||
|
||||
private static final String ENTITY_NAME = "dictDetail";
|
||||
|
||||
@Log("查询字典详情")
|
||||
@GetMapping(value = "/dictDetail")
|
||||
public ResponseEntity getDictDetails(DictDetailDTO resources,
|
||||
@PageableDefault(value = 10, sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){
|
||||
return new ResponseEntity(dictDetailQueryService.queryAll(resources,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增字典详情")
|
||||
@PostMapping(value = "/dictDetail")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody DictDetail resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
return new ResponseEntity(dictDetailService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改字典详情")
|
||||
@PutMapping(value = "/dictDetail")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_EDIT')")
|
||||
public ResponseEntity update(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){
|
||||
dictDetailService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除字典详情")
|
||||
@DeleteMapping(value = "/dictDetail/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','DICT_ALL','DICT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
dictDetailService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.config.DataScope;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.JobService;
|
||||
import me.zhengjie.modules.system.service.query.JobQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class JobController {
|
||||
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
@Autowired
|
||||
private JobQueryService jobQueryService;
|
||||
|
||||
@Autowired
|
||||
private DataScope dataScope;
|
||||
|
||||
private static final String ENTITY_NAME = "job";
|
||||
|
||||
@Log("查询岗位")
|
||||
@GetMapping(value = "/job")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_SELECT','USER_ALL','USER_SELECT')")
|
||||
public ResponseEntity getJobs(@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) Boolean enabled,
|
||||
Pageable pageable){
|
||||
// 数据权限
|
||||
Set<Long> deptIds = dataScope.getDeptIds();
|
||||
return new ResponseEntity(jobQueryService.queryAll(name, enabled , deptIds, deptId, pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增岗位")
|
||||
@PostMapping(value = "/job")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody Job resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
return new ResponseEntity(jobService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改岗位")
|
||||
@PutMapping(value = "/job")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_EDIT')")
|
||||
public ResponseEntity update(@Validated(Job.Update.class) @RequestBody Job resources){
|
||||
jobService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除岗位")
|
||||
@DeleteMapping(value = "/job/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USERJOB_ALL','USERJOB_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
jobService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import me.zhengjie.modules.system.service.MenuService;
|
|||
import me.zhengjie.modules.system.service.RoleService;
|
||||
import me.zhengjie.modules.system.service.UserService;
|
||||
import me.zhengjie.modules.system.service.dto.MenuDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.MenuMapper;
|
||||
import me.zhengjie.modules.system.service.query.MenuQueryService;
|
||||
import me.zhengjie.utils.SecurityContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -39,6 +40,9 @@ public class MenuController {
|
|||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
private static final String ENTITY_NAME = "menu";
|
||||
|
||||
/**
|
||||
|
@ -59,7 +63,7 @@ public class MenuController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/menus/tree")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_SELECT','ROLES_SELECT','ROLES_ALL')")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_CREATE','MENU_EDIT','ROLES_SELECT','ROLES_ALL')")
|
||||
public ResponseEntity getMenuTree(){
|
||||
return new ResponseEntity(menuService.getMenuTree(menuService.findByPid(0L)),HttpStatus.OK);
|
||||
}
|
||||
|
@ -94,6 +98,14 @@ public class MenuController {
|
|||
@DeleteMapping(value = "/menus/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','MENU_ALL','MENU_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
List<Menu> menuList = menuService.findByPid(id);
|
||||
|
||||
// 特殊情况,对级联删除进行处理
|
||||
for (Menu menu : menuList) {
|
||||
roleService.untiedMenu(menu);
|
||||
menuService.delete(menu.getId());
|
||||
}
|
||||
roleService.untiedMenu(menuService.findOne(id));
|
||||
menuService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ public class PermissionController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/permissions/tree")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_SELECT','ROLES_SELECT','ROLES_ALL')")
|
||||
public ResponseEntity getRoleTree(){
|
||||
@PreAuthorize("hasAnyRole('ADMIN','PERMISSION_ALL','PERMISSION_CREATE','PERMISSION_EDIT','ROLES_SELECT','ROLES_ALL')")
|
||||
public ResponseEntity getTree(){
|
||||
return new ResponseEntity(permissionService.getPermissionTree(permissionService.findByPid(0L)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ public class RoleController {
|
|||
* 返回全部的角色,新增用户时下拉选择
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/roles/tree")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','USER_ALL','USER_SELECT')")
|
||||
public ResponseEntity getRoleTree(){
|
||||
return new ResponseEntity(roleService.getRoleTree(),HttpStatus.OK);
|
||||
@GetMapping(value = "/roles/all")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','ROLES_ALL','USER_ALL','USER_CREATE','USER_EDIT')")
|
||||
public ResponseEntity getAll(){
|
||||
return new ResponseEntity(roleQueryService.queryAll(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询角色")
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
package me.zhengjie.modules.system.rest;
|
||||
|
||||
import me.zhengjie.aop.log.Log;
|
||||
import me.zhengjie.config.DataScope;
|
||||
import me.zhengjie.domain.Picture;
|
||||
import me.zhengjie.domain.VerificationCode;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.security.security.JwtUser;
|
||||
import me.zhengjie.modules.system.service.DeptService;
|
||||
import me.zhengjie.service.PictureService;
|
||||
import me.zhengjie.service.VerificationCodeService;
|
||||
import me.zhengjie.utils.ElAdminConstant;
|
||||
import me.zhengjie.utils.EncryptUtils;
|
||||
import me.zhengjie.modules.security.utils.JwtTokenUtil;
|
||||
import me.zhengjie.utils.*;
|
||||
import me.zhengjie.modules.system.service.UserService;
|
||||
import me.zhengjie.modules.system.service.dto.UserDTO;
|
||||
import me.zhengjie.modules.system.service.query.UserQueryService;
|
||||
import me.zhengjie.utils.SecurityContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
|
@ -43,16 +40,15 @@ public class UserController {
|
|||
@Autowired
|
||||
private UserQueryService userQueryService;
|
||||
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("jwtUserDetailsService")
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
@Autowired
|
||||
private PictureService pictureService;
|
||||
|
||||
@Autowired
|
||||
private DataScope dataScope;
|
||||
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private VerificationCodeService verificationCodeService;
|
||||
|
||||
|
@ -63,7 +59,34 @@ public class UserController {
|
|||
@GetMapping(value = "/users")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_SELECT')")
|
||||
public ResponseEntity getUsers(UserDTO userDTO, Pageable pageable){
|
||||
return new ResponseEntity(userQueryService.queryAll(userDTO,pageable),HttpStatus.OK);
|
||||
Set<Long> deptSet = new HashSet<>();
|
||||
Set<Long> result = new HashSet<>();
|
||||
|
||||
if (!ObjectUtils.isEmpty(userDTO.getDeptId())) {
|
||||
deptSet.add(userDTO.getDeptId());
|
||||
deptSet.addAll(dataScope.getDeptChildren(deptService.findByPid(userDTO.getDeptId())));
|
||||
}
|
||||
|
||||
// 数据权限
|
||||
Set<Long> deptIds = dataScope.getDeptIds();
|
||||
|
||||
// 查询条件不为空并且数据权限不为空则取交集
|
||||
if (!CollectionUtils.isEmpty(deptIds) && !CollectionUtils.isEmpty(deptSet)){
|
||||
|
||||
// 取交集
|
||||
result.addAll(deptSet);
|
||||
result.retainAll(deptIds);
|
||||
|
||||
// 若无交集,则代表无数据权限
|
||||
if(result.size() == 0){
|
||||
return new ResponseEntity(PageUtil.toPage(null,0),HttpStatus.OK);
|
||||
} else return new ResponseEntity(userQueryService.queryAll(userDTO,result,pageable),HttpStatus.OK);
|
||||
// 否则取并集
|
||||
} else {
|
||||
result.addAll(deptSet);
|
||||
result.addAll(deptIds);
|
||||
return new ResponseEntity(userQueryService.queryAll(userDTO,result,pageable),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@Log("新增用户")
|
||||
|
@ -100,10 +123,9 @@ public class UserController {
|
|||
@GetMapping(value = "/users/validPass/{pass}")
|
||||
public ResponseEntity validPass(@PathVariable String pass){
|
||||
UserDetails userDetails = SecurityContextHolder.getUserDetails();
|
||||
JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(userDetails.getUsername());
|
||||
Map map = new HashMap();
|
||||
map.put("status",200);
|
||||
if(!jwtUser.getPassword().equals(EncryptUtils.encryptPassword(pass))){
|
||||
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){
|
||||
map.put("status",400);
|
||||
}
|
||||
return new ResponseEntity(map,HttpStatus.OK);
|
||||
|
@ -117,11 +139,10 @@ public class UserController {
|
|||
@GetMapping(value = "/users/updatePass/{pass}")
|
||||
public ResponseEntity updatePass(@PathVariable String pass){
|
||||
UserDetails userDetails = SecurityContextHolder.getUserDetails();
|
||||
JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(userDetails.getUsername());
|
||||
if(jwtUser.getPassword().equals(EncryptUtils.encryptPassword(pass))){
|
||||
if(userDetails.getPassword().equals(EncryptUtils.encryptPassword(pass))){
|
||||
throw new BadRequestException("新密码不能与旧密码相同");
|
||||
}
|
||||
userService.updatePass(jwtUser,EncryptUtils.encryptPassword(pass));
|
||||
userService.updatePass(userDetails.getUsername(),EncryptUtils.encryptPassword(pass));
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -133,9 +154,8 @@ public class UserController {
|
|||
@PostMapping(value = "/users/updateAvatar")
|
||||
public ResponseEntity updateAvatar(@RequestParam MultipartFile file){
|
||||
UserDetails userDetails = SecurityContextHolder.getUserDetails();
|
||||
JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(userDetails.getUsername());
|
||||
Picture picture = pictureService.upload(file,jwtUser.getUsername());
|
||||
userService.updateAvatar(jwtUser,picture.getUrl());
|
||||
Picture picture = pictureService.upload(file,userDetails.getUsername());
|
||||
userService.updateAvatar(userDetails.getUsername(),picture.getUrl());
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -145,16 +165,16 @@ public class UserController {
|
|||
* @param user
|
||||
* @return
|
||||
*/
|
||||
@Log("修改邮箱")
|
||||
@PostMapping(value = "/users/updateEmail/{code}")
|
||||
public ResponseEntity updateEmail(@PathVariable String code,@RequestBody User user){
|
||||
UserDetails userDetails = SecurityContextHolder.getUserDetails();
|
||||
JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(userDetails.getUsername());
|
||||
if(!jwtUser.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
|
||||
if(!userDetails.getPassword().equals(EncryptUtils.encryptPassword(user.getPassword()))){
|
||||
throw new BadRequestException("密码错误");
|
||||
}
|
||||
VerificationCode verificationCode = new VerificationCode(code, ElAdminConstant.RESET_MAIL,"email",user.getEmail());
|
||||
verificationCodeService.validated(verificationCode);
|
||||
userService.updateEmail(jwtUser,user.getEmail());
|
||||
userService.updateEmail(userDetails.getUsername(),user.getEmail());
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@CacheConfig(cacheNames = "dept")
|
||||
public interface DeptService {
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
DeptDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
DeptDTO create(Dept resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(Dept resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* buildTree
|
||||
* @param deptDTOS
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
Object buildTree(List<DeptDTO> deptDTOS);
|
||||
|
||||
/**
|
||||
* findByPid
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
List<Dept> findByPid(long pid);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@CacheConfig(cacheNames = "dictDetail")
|
||||
public interface DictDetailService {
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
DictDetailDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
DictDetailDTO create(DictDetail resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(DictDetail resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(Long id);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@CacheConfig(cacheNames = "dict")
|
||||
public interface DictService {
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
DictDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
DictDTO create(Dict resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(Dict resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(Long id);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.dto.JobDTO;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@CacheConfig(cacheNames = "job")
|
||||
public interface JobService {
|
||||
|
||||
/**
|
||||
* findById
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#p0")
|
||||
JobDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* create
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
JobDTO create(Job resources);
|
||||
|
||||
/**
|
||||
* update
|
||||
* @param resources
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void update(Job resources);
|
||||
|
||||
/**
|
||||
* delete
|
||||
* @param id
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void delete(Long id);
|
||||
}
|
|
@ -74,7 +74,7 @@ public interface MenuService {
|
|||
* @param roles
|
||||
* @return
|
||||
*/
|
||||
List<MenuDTO> findByRoles(Set<Role> roles);
|
||||
List<MenuDTO> findByRoles(List<Role> roles);
|
||||
|
||||
/**
|
||||
* buildMenus
|
||||
|
@ -82,4 +82,6 @@ public interface MenuService {
|
|||
* @return
|
||||
*/
|
||||
Object buildMenus(List<MenuDTO> byRoles);
|
||||
|
||||
Menu findOne(Long id);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import me.zhengjie.modules.system.service.dto.PermissionDTO;
|
|||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package me.zhengjie.modules.system.service;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Menu;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.modules.system.service.dto.RoleDTO;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -45,19 +47,13 @@ public interface RoleService {
|
|||
@CacheEvict(allEntries = true)
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* role tree
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "'tree'")
|
||||
Object getRoleTree();
|
||||
|
||||
/**
|
||||
* findByUsers_Id
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Set<Role> findByUsers_Id(Long id);
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
List<Role> findByUsers_Id(Long id);
|
||||
|
||||
/**
|
||||
* updatePermission
|
||||
|
@ -74,4 +70,7 @@ public interface RoleService {
|
|||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void updateMenu(Role resources, RoleDTO roleDTO);
|
||||
|
||||
@CacheEvict(allEntries = true)
|
||||
void untiedMenu(Menu menu);
|
||||
}
|
||||
|
|
|
@ -49,30 +49,30 @@ public interface UserService {
|
|||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
@Cacheable(key = "'loadUserByUsername:'+#p0")
|
||||
User findByName(String userName);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param jwtUser
|
||||
* @param username
|
||||
* @param encryptPassword
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void updatePass(JwtUser jwtUser, String encryptPassword);
|
||||
void updatePass(String username, String encryptPassword);
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
* @param jwtUser
|
||||
* @param username
|
||||
* @param url
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void updateAvatar(JwtUser jwtUser, String url);
|
||||
void updateAvatar(String username, String url);
|
||||
|
||||
/**
|
||||
* 修改邮箱
|
||||
* @param jwtUser
|
||||
* @param username
|
||||
* @param email
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
void updateEmail(JwtUser jwtUser, String email);
|
||||
void updateEmail(String username, String email);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Data
|
||||
public class DeptDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeptDTO> children;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Data
|
||||
public class DictDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Data
|
||||
public class DictDetailDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private String sort;
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
private String dictName;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package me.zhengjie.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class JobDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
private DeptDTO dept;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
public JobDTO(String name, Boolean enabled) {
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,15 @@ public class RoleDTO implements Serializable {
|
|||
|
||||
private String name;
|
||||
|
||||
private String dataScope;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Set<PermissionDTO> permissions;
|
||||
|
||||
private Set<MenuDTO> menus;
|
||||
|
||||
private Set<DeptDTO> depts;
|
||||
|
||||
private Timestamp createTime;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ public class UserDTO implements Serializable {
|
|||
|
||||
private String email;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
@JsonIgnore
|
||||
|
@ -35,4 +37,11 @@ public class UserDTO implements Serializable {
|
|||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Set<RoleDTO> roles;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
private JobDTO job;
|
||||
|
||||
private DeptDTO dept;
|
||||
|
||||
private Long deptId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.system.repository.DeptRepository;
|
||||
import me.zhengjie.modules.system.service.DeptService;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.DeptMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeptServiceImpl implements DeptService {
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public DeptDTO findById(Long id) {
|
||||
Optional<Dept> dept = deptRepository.findById(id);
|
||||
ValidationUtil.isNull(dept,"Dept","id",id);
|
||||
return deptMapper.toDto(dept.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> findByPid(long pid) {
|
||||
return deptRepository.findByPid(pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object buildTree(List<DeptDTO> deptDTOS) {
|
||||
Set<DeptDTO> trees = new LinkedHashSet<>();
|
||||
Set<DeptDTO> depts= new LinkedHashSet<>();
|
||||
Boolean isChild;
|
||||
for (DeptDTO deptDTO : deptDTOS) {
|
||||
isChild = false;
|
||||
if ("0".equals(deptDTO.getPid().toString())) {
|
||||
trees.add(deptDTO);
|
||||
}
|
||||
for (DeptDTO it : deptDTOS) {
|
||||
if (it.getPid().equals(deptDTO.getId())) {
|
||||
isChild = true;
|
||||
if (deptDTO.getChildren() == null) {
|
||||
deptDTO.setChildren(new ArrayList<DeptDTO>());
|
||||
}
|
||||
deptDTO.getChildren().add(it);
|
||||
}
|
||||
}
|
||||
if(isChild) {
|
||||
depts.add(deptDTO);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(trees)) {
|
||||
trees = depts;
|
||||
}
|
||||
|
||||
Integer totalElements = deptDTOS!=null?deptDTOS.size():0;
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("totalElements",totalElements);
|
||||
map.put("content",CollectionUtils.isEmpty(trees)?deptDTOS:trees);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeptDTO create(Dept resources) {
|
||||
return deptMapper.toDto(deptRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Dept resources) {
|
||||
if(resources.getId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
Optional<Dept> optionalDept = deptRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalDept,"Dept","id",resources.getId());
|
||||
|
||||
Dept dept = optionalDept.get();
|
||||
// 此处需自己修改
|
||||
resources.setId(dept.getId());
|
||||
deptRepository.save(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
deptRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.system.repository.DictDetailRepository;
|
||||
import me.zhengjie.modules.system.service.DictDetailService;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.DictDetailMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictDetailServiceImpl implements DictDetailService {
|
||||
|
||||
@Autowired
|
||||
private DictDetailRepository dictDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private DictDetailMapper dictDetailMapper;
|
||||
|
||||
@Override
|
||||
public DictDetailDTO findById(Long id) {
|
||||
Optional<DictDetail> dictDetail = dictDetailRepository.findById(id);
|
||||
ValidationUtil.isNull(dictDetail,"DictDetail","id",id);
|
||||
return dictDetailMapper.toDto(dictDetail.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictDetailDTO create(DictDetail resources) {
|
||||
return dictDetailMapper.toDto(dictDetailRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DictDetail resources) {
|
||||
Optional<DictDetail> optionalDictDetail = dictDetailRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalDictDetail,"DictDetail","id",resources.getId());
|
||||
|
||||
DictDetail dictDetail = optionalDictDetail.get();
|
||||
// 此处需自己修改
|
||||
resources.setId(dictDetail.getId());
|
||||
dictDetailRepository.save(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
dictDetailRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.system.repository.DictRepository;
|
||||
import me.zhengjie.modules.system.service.DictService;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.DictMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictServiceImpl implements DictService {
|
||||
|
||||
@Autowired
|
||||
private DictRepository dictRepository;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
@Override
|
||||
public DictDTO findById(Long id) {
|
||||
Optional<Dict> dict = dictRepository.findById(id);
|
||||
ValidationUtil.isNull(dict,"Dict","id",id);
|
||||
return dictMapper.toDto(dict.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictDTO create(Dict resources) {
|
||||
return dictMapper.toDto(dictRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Dict resources) {
|
||||
Optional<Dict> optionalDict = dictRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalDict,"Dict","id",resources.getId());
|
||||
|
||||
Dict dict = optionalDict.get();
|
||||
// 此处需自己修改
|
||||
resources.setId(dict.getId());
|
||||
dictRepository.save(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
dictRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.system.repository.JobRepository;
|
||||
import me.zhengjie.modules.system.service.JobService;
|
||||
import me.zhengjie.modules.system.service.dto.JobDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.JobMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class JobServiceImpl implements JobService {
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
|
||||
@Override
|
||||
public JobDTO findById(Long id) {
|
||||
Optional<Job> job = jobRepository.findById(id);
|
||||
ValidationUtil.isNull(job,"Job","id",id);
|
||||
return jobMapper.toDto(job.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JobDTO create(Job resources) {
|
||||
return jobMapper.toDto(jobRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Job resources) {
|
||||
Optional<Job> optionalJob = jobRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalJob,"Job","id",resources.getId());
|
||||
|
||||
Job job = optionalJob.get();
|
||||
// 此处需自己修改
|
||||
resources.setId(job.getId());
|
||||
jobRepository.save(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
jobRepository.deleteById(id);
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@ public class MenuServiceImpl implements MenuService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<MenuDTO> findByRoles(Set<Role> roles) {
|
||||
public List<MenuDTO> findByRoles(List<Role> roles) {
|
||||
Set<Menu> menus = new LinkedHashSet<>();
|
||||
for (Role role : roles) {
|
||||
List<Menu> menus1 = menuRepository.findByRoles_IdOrderBySortAsc(role.getId()).stream().collect(Collectors.toList());
|
||||
|
@ -61,6 +61,9 @@ public class MenuServiceImpl implements MenuService {
|
|||
|
||||
@Override
|
||||
public void update(Menu resources) {
|
||||
if(resources.getId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
Optional<Menu> optionalPermission = menuRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull(optionalPermission,"Permission","id",resources.getId());
|
||||
|
||||
|
@ -87,10 +90,6 @@ public class MenuServiceImpl implements MenuService {
|
|||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
List<Menu> menuList = menuRepository.findByPid(id);
|
||||
for (Menu menu : menuList) {
|
||||
menuRepository.delete(menu);
|
||||
}
|
||||
menuRepository.deleteById(id);
|
||||
}
|
||||
|
||||
|
@ -193,4 +192,11 @@ public class MenuServiceImpl implements MenuService {
|
|||
);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menu findOne(Long id) {
|
||||
Optional<Menu> menu = menuRepository.findById(id);
|
||||
ValidationUtil.isNull(menu,"Menu","id",id);
|
||||
return menu.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,8 +47,10 @@ public class PermissionServiceImpl implements PermissionService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Permission resources) {
|
||||
|
||||
Optional<Permission> optionalPermission = permissionRepository.findById(resources.getId());
|
||||
if(resources.getId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
ValidationUtil.isNull(optionalPermission,"Permission","id",resources.getId());
|
||||
|
||||
Permission permission = optionalPermission.get();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Menu;
|
||||
import me.zhengjie.modules.system.domain.Role;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.exception.EntityExistException;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
|
@ -61,6 +63,8 @@ public class RoleServiceImpl implements RoleService {
|
|||
|
||||
role.setName(resources.getName());
|
||||
role.setRemark(resources.getRemark());
|
||||
role.setDataScope(resources.getDataScope());
|
||||
role.setDepts(resources.getDepts());
|
||||
roleRepository.save(role);
|
||||
}
|
||||
|
||||
|
@ -78,6 +82,16 @@ public class RoleServiceImpl implements RoleService {
|
|||
roleRepository.save(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untiedMenu(Menu menu) {
|
||||
Set<Role> roles = roleRepository.findByMenus_Id(menu.getId());
|
||||
for (Role role : roles) {
|
||||
menu.getRoles().remove(role);
|
||||
role.getMenus().remove(menu);
|
||||
roleRepository.save(role);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Long id) {
|
||||
|
@ -85,22 +99,7 @@ public class RoleServiceImpl implements RoleService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getRoleTree() {
|
||||
|
||||
List<Role> roleList = roleRepository.findAll();
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (Role role : roleList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id",role.getId());
|
||||
map.put("label",role.getName());
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Role> findByUsers_Id(Long id) {
|
||||
return roleRepository.findByUsers_Id(id);
|
||||
public List<Role> findByUsers_Id(Long id) {
|
||||
return roleRepository.findByUsers_Id(id).stream().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package me.zhengjie.modules.system.service.impl;
|
||||
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.exception.EntityExistException;
|
||||
import me.zhengjie.exception.EntityNotFoundException;
|
||||
import me.zhengjie.modules.system.repository.UserRepository;
|
||||
import me.zhengjie.modules.security.security.JwtUser;
|
||||
import me.zhengjie.modules.security.utils.JwtTokenUtil;
|
||||
import me.zhengjie.modules.system.service.UserService;
|
||||
import me.zhengjie.modules.system.service.dto.UserDTO;
|
||||
import me.zhengjie.modules.system.service.mapper.UserMapper;
|
||||
|
@ -32,9 +29,6 @@ public class UserServiceImpl implements UserService {
|
|||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
|
||||
@Override
|
||||
public UserDTO findById(long id) {
|
||||
Optional<User> user = userRepository.findById(id);
|
||||
|
@ -54,20 +48,15 @@ public class UserServiceImpl implements UserService {
|
|||
throw new EntityExistException(User.class,"email",resources.getEmail());
|
||||
}
|
||||
|
||||
if(resources.getRoles() == null || resources.getRoles().size() == 0){
|
||||
throw new BadRequestException("角色不能为空");
|
||||
}
|
||||
|
||||
// 默认密码 123456,此密码是 MD5加密后的字符
|
||||
resources.setPassword("14e1b600b1fd579f47433b88e8d85291");
|
||||
resources.setAvatar("https://i.loli.net/2018/12/06/5c08894d8de21.jpg");
|
||||
// 默认密码 123456,此密码是加密后的字符
|
||||
resources.setPassword("e10adc3949ba59abbe56e057f20f883e");
|
||||
resources.setAvatar("https://aurora-1255840532.cos.ap-chengdu.myqcloud.com/8918a306ea314404835a9196585c4b75.jpeg");
|
||||
return userMapper.toDto(userRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(User resources) {
|
||||
|
||||
Optional<User> userOptional = userRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull(userOptional,"User","id",resources.getId());
|
||||
|
||||
|
@ -76,10 +65,6 @@ public class UserServiceImpl implements UserService {
|
|||
User user1 = userRepository.findByUsername(user.getUsername());
|
||||
User user2 = userRepository.findByEmail(user.getEmail());
|
||||
|
||||
if(resources.getRoles() == null || resources.getRoles().size() == 0){
|
||||
throw new BadRequestException("角色不能为空");
|
||||
}
|
||||
|
||||
if(user1 !=null&&!user.getId().equals(user1.getId())){
|
||||
throw new EntityExistException(User.class,"username",resources.getUsername());
|
||||
}
|
||||
|
@ -92,7 +77,9 @@ public class UserServiceImpl implements UserService {
|
|||
user.setEmail(resources.getEmail());
|
||||
user.setEnabled(resources.getEnabled());
|
||||
user.setRoles(resources.getRoles());
|
||||
|
||||
user.setDept(resources.getDept());
|
||||
user.setJob(resources.getJob());
|
||||
user.setPhone(resources.getPhone());
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
|
@ -120,19 +107,19 @@ public class UserServiceImpl implements UserService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePass(JwtUser jwtUser, String pass) {
|
||||
userRepository.updatePass(jwtUser.getId(),pass,new Date());
|
||||
public void updatePass(String username, String pass) {
|
||||
userRepository.updatePass(username,pass,new Date());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAvatar(JwtUser jwtUser, String url) {
|
||||
userRepository.updateAvatar(jwtUser.getId(),url);
|
||||
public void updateAvatar(String username, String url) {
|
||||
userRepository.updateAvatar(username,url);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateEmail(JwtUser jwtUser, String email) {
|
||||
userRepository.updateEmail(jwtUser.getId(),email);
|
||||
public void updateEmail(String username, String email) {
|
||||
userRepository.updateEmail(username,email);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptMapper extends EntityMapper<DeptDTO, Dept> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictDetailMapper extends EntityMapper<DictDetailDTO, DictDetail> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictMapper extends EntityMapper<DictDTO, Dict> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.modules.system.service.mapper;
|
||||
|
||||
import me.zhengjie.mapper.EntityMapper;
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.dto.JobDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface JobMapper extends EntityMapper<JobDTO, Job> {
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @author jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = {PermissionMapper.class, MenuMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
@Mapper(componentModel = "spring", uses = {PermissionMapper.class, MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleMapper extends EntityMapper<RoleDTO, Role> {
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
|
|||
* @author jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserMapper extends EntityMapper<UserDTO, User> {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package me.zhengjie.modules.system.service.query;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.service.dto.DeptDTO;
|
||||
import me.zhengjie.modules.system.repository.DeptRepository;
|
||||
import me.zhengjie.modules.system.service.mapper.DeptMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "dept")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeptQueryService {
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
/**
|
||||
* 不分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public List queryAll(DeptDTO dept, Set<Long> deptIds){
|
||||
return deptMapper.toDto(deptRepository.findAll(new Spec(dept, deptIds)));
|
||||
}
|
||||
|
||||
class Spec implements Specification<Dept> {
|
||||
|
||||
private DeptDTO dept;
|
||||
|
||||
private Set<Long> deptIds;
|
||||
|
||||
|
||||
public Spec(DeptDTO dept, Set<Long> deptIds){
|
||||
this.dept = dept;
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Dept> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
if(!ObjectUtils.isEmpty(dept.getName())){
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("name").as(String.class),"%"+dept.getName()+"%"));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(dept.getEnabled())){
|
||||
/**
|
||||
* 相等
|
||||
*/
|
||||
list.add(cb.equal(root.get("enabled").as(Boolean.class),dept.getEnabled()));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(dept.getPid())){
|
||||
/**
|
||||
* 相等
|
||||
*/
|
||||
list.add(cb.equal(root.get("pid").as(Boolean.class),dept.getPid()));
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(deptIds)) {
|
||||
list.add(root.get("id").in(deptIds));
|
||||
}
|
||||
|
||||
Predicate[] p = new Predicate[list.size()];
|
||||
return cb.and(list.toArray(p));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package me.zhengjie.modules.system.service.query;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.modules.system.domain.DictDetail;
|
||||
import me.zhengjie.modules.system.service.dto.DictDetailDTO;
|
||||
import me.zhengjie.modules.system.repository.DictDetailRepository;
|
||||
import me.zhengjie.modules.system.service.mapper.DictDetailMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import javax.persistence.criteria.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "dictDetail")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictDetailQueryService {
|
||||
|
||||
@Autowired
|
||||
private DictDetailRepository dictDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private DictDetailMapper dictDetailMapper;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(DictDetailDTO dictDetail, Pageable pageable){
|
||||
Page<DictDetail> page = dictDetailRepository.findAll(new Spec(dictDetail),pageable);
|
||||
return PageUtil.toPage(page.map(dictDetailMapper::toDto));
|
||||
}
|
||||
|
||||
class Spec implements Specification<DictDetail> {
|
||||
|
||||
private DictDetailDTO dictDetail;
|
||||
|
||||
public Spec(DictDetailDTO dictDetail){
|
||||
this.dictDetail = dictDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<DictDetail> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
Join<Dict,DictDetail> join = root.join("dict",JoinType.LEFT);
|
||||
|
||||
if(!ObjectUtils.isEmpty(dictDetail.getLabel())){
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("label").as(String.class),"%"+dictDetail.getLabel()+"%"));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(dictDetail.getDictName())){
|
||||
list.add(cb.equal(join.get("name").as(String.class),dictDetail.getDictName()));
|
||||
}
|
||||
Predicate[] p = new Predicate[list.size()];
|
||||
return cb.and(list.toArray(p));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package me.zhengjie.modules.system.service.query;
|
||||
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.modules.system.domain.Dict;
|
||||
import me.zhengjie.modules.system.service.dto.DictDTO;
|
||||
import me.zhengjie.modules.system.repository.DictRepository;
|
||||
import me.zhengjie.modules.system.service.mapper.DictMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "dict")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictQueryService {
|
||||
|
||||
@Autowired
|
||||
private DictRepository dictRepository;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(DictDTO dict, Pageable pageable){
|
||||
Page<Dict> page = dictRepository.findAll(new Spec(dict),pageable);
|
||||
return PageUtil.toPage(page.map(dictMapper::toDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(DictDTO dict){
|
||||
return dictMapper.toDto(dictRepository.findAll(new Spec(dict)));
|
||||
}
|
||||
|
||||
class Spec implements Specification<Dict> {
|
||||
|
||||
private DictDTO dict;
|
||||
|
||||
public Spec(DictDTO dict){
|
||||
this.dict = dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Dict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
if(!ObjectUtils.isEmpty(dict.getName())){
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("name").as(String.class),"%"+dict.getName()+"%"));
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(dict.getRemark())){
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("remark").as(String.class),"%"+dict.getRemark()+"%"));
|
||||
}
|
||||
Predicate[] p = new Predicate[list.size()];
|
||||
return cb.and(list.toArray(p));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package me.zhengjie.modules.system.service.query;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.modules.system.domain.Job;
|
||||
import me.zhengjie.modules.system.service.dto.JobDTO;
|
||||
import me.zhengjie.modules.system.repository.JobRepository;
|
||||
import me.zhengjie.modules.system.service.mapper.JobMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import javax.persistence.criteria.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
* @date 2018-12-03
|
||||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "job")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class JobQueryService {
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(String name , Boolean enabled, Set<Long> deptIds, Long deptId, Pageable pageable){
|
||||
Page<Job> page = jobRepository.findAll(new Spec(new JobDTO(name,enabled), deptIds, deptId),pageable);
|
||||
return PageUtil.toPage(page.map(jobMapper::toDto));
|
||||
}
|
||||
|
||||
class Spec implements Specification<Job> {
|
||||
|
||||
private JobDTO job;
|
||||
private Long deptId;
|
||||
private Set<Long> deptIds;
|
||||
|
||||
public Spec(JobDTO job, Set<Long> deptIds, Long deptId){
|
||||
this.job = job;
|
||||
this.deptId = deptId;
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate toPredicate(Root<Job> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
|
||||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
// 数据权限
|
||||
Join<Dept, Job> join = root.join("dept",JoinType.LEFT);
|
||||
if (!CollectionUtils.isEmpty(deptIds)) {
|
||||
list.add(join.get("id").in(deptIds));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(job.getEnabled())){
|
||||
/**
|
||||
* 精确
|
||||
*/
|
||||
list.add(cb.equal(root.get("enabled").as(Boolean.class),job.getEnabled()));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(job.getName())){
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("name").as(String.class),"%"+job.getName()+"%"));
|
||||
}
|
||||
|
||||
if (deptId != null) {
|
||||
/**
|
||||
* 精确
|
||||
*/
|
||||
list.add(cb.equal(join.get("id").as(Long.class),deptId));
|
||||
}
|
||||
Predicate[] p = new Predicate[list.size()];
|
||||
return cb.and(list.toArray(p));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,15 @@ public class RoleQueryService {
|
|||
return PageUtil.toPage(page.map(roleMapper::toDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(){
|
||||
List<Role> roles = roleRepository.findAll(new Spec(null));
|
||||
return roleMapper.toDto(roles);
|
||||
}
|
||||
|
||||
class Spec implements Specification<Role> {
|
||||
|
||||
private String name;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.zhengjie.modules.system.service.query;
|
||||
|
||||
import me.zhengjie.modules.system.domain.Dept;
|
||||
import me.zhengjie.modules.system.domain.User;
|
||||
import me.zhengjie.modules.system.repository.UserRepository;
|
||||
import me.zhengjie.modules.system.service.dto.UserDTO;
|
||||
|
@ -14,13 +15,13 @@ import org.springframework.data.jpa.domain.Specification;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import javax.persistence.criteria.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jie
|
||||
|
@ -41,24 +42,20 @@ public class UserQueryService {
|
|||
* 分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(UserDTO user, Pageable pageable){
|
||||
Page<User> page = userRepo.findAll(new Spec(user),pageable);
|
||||
public Object queryAll(UserDTO user, Set<Long> deptIds,Pageable pageable){
|
||||
Page<User> page = userRepo.findAll(new Spec(user,deptIds),pageable);
|
||||
return PageUtil.toPage(page.map(userMapper::toDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页
|
||||
*/
|
||||
@Cacheable(keyGenerator = "keyGenerator")
|
||||
public Object queryAll(UserDTO user){
|
||||
return userMapper.toDto(userRepo.findAll(new Spec(user)));
|
||||
}
|
||||
|
||||
class Spec implements Specification<User> {
|
||||
|
||||
private UserDTO user;
|
||||
|
||||
public Spec(UserDTO user){
|
||||
private Set<Long> deptIds;
|
||||
|
||||
public Spec(UserDTO user, Set<Long> deptIds){
|
||||
this.deptIds = deptIds;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
@ -67,6 +64,12 @@ public class UserQueryService {
|
|||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
// 数据权限, 关联查询
|
||||
Join<Dept,User> join = root.join("dept",JoinType.LEFT);
|
||||
if (!CollectionUtils.isEmpty(deptIds)) {
|
||||
list.add(join.get("id").in(deptIds));
|
||||
}
|
||||
|
||||
if(!ObjectUtils.isEmpty(user.getId())){
|
||||
/**
|
||||
* 相等
|
||||
|
|
|
@ -59,4 +59,11 @@ jwt:
|
|||
|
||||
#是否允许生成代码,生产环境设置为false
|
||||
generator:
|
||||
enabled: false
|
||||
enabled: false
|
||||
|
||||
#如果生产环境要开启swagger,需要配置请求地址
|
||||
#springfox:
|
||||
# documentation:
|
||||
# swagger:
|
||||
# v2:
|
||||
# host: # 接口域名或外网ip
|
|
@ -41,7 +41,7 @@ spring:
|
|||
#七牛云
|
||||
qiniu:
|
||||
# 文件大小 /M
|
||||
max-size: 5
|
||||
max-size: 15
|
||||
|
||||
#验证码有效时间/分钟
|
||||
code:
|
||||
|
|
|
@ -67,24 +67,24 @@ public class ${className}QueryService {
|
|||
|
||||
List<Predicate> list = new ArrayList<Predicate>();
|
||||
|
||||
<#if queryColumns??>
|
||||
<#list queryColumns as column>
|
||||
if(!ObjectUtils.isEmpty(${changeClassName}.get${column.capitalColumnName}())){
|
||||
<#if column.columnQuery = '1'>
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("${column.columnName}").as(${column.columnType}.class),"%"+${changeClassName}.get${column.capitalColumnName}()+"%"));
|
||||
</#if>
|
||||
<#if column.columnQuery = '2'>
|
||||
/**
|
||||
* 精确
|
||||
*/
|
||||
list.add(cb.equal(root.get("${column.columnName}").as(${column.columnType}.class),${changeClassName}.get${column.capitalColumnName}()));
|
||||
</#if>
|
||||
}
|
||||
</#list>
|
||||
</#if>
|
||||
<#if queryColumns??>
|
||||
<#list queryColumns as column>
|
||||
if(!ObjectUtils.isEmpty(${changeClassName}.get${column.capitalColumnName}())){
|
||||
<#if column.columnQuery = '1'>
|
||||
/**
|
||||
* 模糊
|
||||
*/
|
||||
list.add(cb.like(root.get("${column.columnName}").as(${column.columnType}.class),"%"+${changeClassName}.get${column.capitalColumnName}()+"%"));
|
||||
</#if>
|
||||
<#if column.columnQuery = '2'>
|
||||
/**
|
||||
* 精确
|
||||
*/
|
||||
list.add(cb.equal(root.get("${column.columnName}").as(${column.columnType}.class),${changeClassName}.get${column.capitalColumnName}()));
|
||||
</#if>
|
||||
}
|
||||
</#list>
|
||||
</#if>
|
||||
Predicate[] p = new Predicate[list.size()];
|
||||
return cb.and(list.toArray(p));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="app-container">
|
||||
<eHeader :query="query"/>
|
||||
<!--表格渲染-->
|
||||
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
|
||||
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
|
||||
<#if columns??>
|
||||
<#list columns as column>
|
||||
<#if column.columnShow = 'true'>
|
||||
|
|
|
@ -8,11 +8,15 @@ import me.zhengjie.service.QiNiuService;
|
|||
import me.zhengjie.service.query.QiNiuQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -87,7 +91,9 @@ public class QiniuController {
|
|||
@Log("下载文件")
|
||||
@GetMapping(value = "/qiNiuContent/download/{id}")
|
||||
public ResponseEntity download(@PathVariable Long id){
|
||||
return new ResponseEntity(qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find()),HttpStatus.OK);
|
||||
Map map = new HashMap();
|
||||
map.put("url", qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find()));
|
||||
return new ResponseEntity(map,HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,9 +39,6 @@ public class AlipayServiceImpl implements AlipayService {
|
|||
AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppID(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType());
|
||||
|
||||
double money = Double.parseDouble(trade.getTotalAmount());
|
||||
if(money <= 0 || money>=5000){
|
||||
throw new BadRequestException("测试金额过大");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建API对应的request(电脑网页版)
|
||||
|
|
|
@ -58,7 +58,7 @@ public class PictureServiceImpl implements PictureService {
|
|||
picture = JSON.parseObject(jsonObject.get("data").toString(), Picture.class);
|
||||
picture.setSize(FileUtil.getSize(Integer.valueOf(picture.getSize())));
|
||||
picture.setUsername(username);
|
||||
picture.setFilename(FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename())+FileUtil.getExtensionName(multipartFile.getOriginalFilename()));
|
||||
picture.setFilename(FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename())+"."+FileUtil.getExtensionName(multipartFile.getOriginalFilename()));
|
||||
pictureRepository.save(picture);
|
||||
//删除临时文件
|
||||
FileUtil.deleteFile(file);
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
@ -84,7 +86,11 @@ public class QiNiuServiceImpl implements QiNiuService {
|
|||
Auth auth = Auth.create(qiniuConfig.getAccessKey(), qiniuConfig.getSecretKey());
|
||||
String upToken = auth.uploadToken(qiniuConfig.getBucket());
|
||||
try {
|
||||
Response response = uploadManager.put(file.getBytes(), QiNiuUtil.getKey(file.getOriginalFilename()), upToken);
|
||||
String key = file.getOriginalFilename();
|
||||
if(qiniuContentRepository.findByKey(key) != null) {
|
||||
key = QiNiuUtil.getKey(key);
|
||||
}
|
||||
Response response = uploadManager.put(file.getBytes(), key, upToken);
|
||||
//解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
||||
//存入数据库
|
||||
|
@ -134,8 +140,7 @@ public class QiNiuServiceImpl implements QiNiuService {
|
|||
bucketManager.delete(content.getBucket(), content.getKey());
|
||||
qiniuContentRepository.delete(content);
|
||||
} catch (QiniuException ex) {
|
||||
System.err.println(ex.code());
|
||||
System.err.println(ex.response.toString());
|
||||
qiniuContentRepository.delete(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ public class QiNiuUtil {
|
|||
StringBuffer key = new StringBuffer(FileUtil.getFileNameNoEx(file));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
Date date = new Date();
|
||||
key.append("-");
|
||||
key.append(sdf.format(date));
|
||||
key.append(".");
|
||||
key.append(FileUtil.getExtensionName(file));
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -48,6 +48,10 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@ -97,6 +101,12 @@
|
|||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--监控sql日志-->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
|
|
Loading…
Reference in New Issue