mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 12:48:58 +08:00
✨ Introducing new features. close #I4ZOTH swagger2 迁移至 springdoc
This commit is contained in:
parent
921b3ed9dd
commit
153de26c04
@ -178,14 +178,7 @@ CREATE TABLE `sys_public_param` (
|
||||
-- Records of sys_public_param
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `sys_public_param` VALUES (1, '租户默认来源', 'TENANT_DEFAULT_ID', '1', '0', 'TENANT_DEFAULT_ID', ' ', 'admin', '2020-05-12 04:03:46', '2022-03-25 21:05:55', '2', '0');
|
||||
INSERT INTO `sys_public_param` VALUES (2, '租户默认部门名称', 'TENANT_DEFAULT_DEPTNAME', '租户默认部门', '0', '', ' ', ' ', '2020-05-12 03:36:32', NULL, '2', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (3, '租户默认账户', 'TENANT_DEFAULT_USERNAME', 'admin', '0', '', ' ', ' ', '2020-05-12 04:05:04', NULL, '2', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (4, '租户默认密码', 'TENANT_DEFAULT_PASSWORD', '123456', '0', '', ' ', ' ', '2020-05-12 04:05:24', NULL, '2', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (5, '租户默认角色编码', 'TENANT_DEFAULT_ROLECODE', 'ROLE_ADMIN', '0', '', ' ', ' ', '2020-05-12 04:05:57', NULL, '2', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (6, '租户默认角色名称', 'TENANT_DEFAULT_ROLENAME', '租户默认角色', '0', '', ' ', ' ', '2020-05-12 04:06:19', NULL, '2', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (7, '表前缀', 'GEN_TABLE_PREFIX', 'tb_', '0', '', ' ', ' ', '2020-05-12 04:23:04', NULL, '9', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (8, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1');
|
||||
INSERT INTO `sys_public_param` VALUES (1, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1');
|
||||
COMMIT;
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-auth</artifactId>
|
||||
|
@ -1,180 +1,191 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-bom</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<packaging>pom</packaging>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-bom</artifactId>
|
||||
<version>3.4.8</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>pig-common-bom</name>
|
||||
<url>pig cloud parent</url>
|
||||
<description>pig cloud parent</description>
|
||||
<name>pig-common-bom</name>
|
||||
<url>pig cloud parent</url>
|
||||
<description>pig cloud parent</description>
|
||||
|
||||
<properties>
|
||||
<pig.common.version>${project.version}</pig.common.version>
|
||||
<spring-boot.version>2.6.4</spring-boot.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<security.oauth.version>2.1.8.RELEASE</security.oauth.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<git.commit.plugin>4.9.9</git.commit.plugin>
|
||||
<spring.checkstyle.plugin>0.0.29</spring.checkstyle.plugin>
|
||||
<fastjson.version>1.2.78</fastjson.version>
|
||||
<swagger.core.version>1.5.24</swagger.core.version>
|
||||
<mybatis-plus.version>3.5.1</mybatis-plus.version>
|
||||
<excel.version>1.1.1</excel.version>
|
||||
<oss.version>1.0.3</oss.version>
|
||||
<sms.version>2.0.2</sms.version>
|
||||
<jaxb.version>2.3.5</jaxb.version>
|
||||
</properties>
|
||||
<properties>
|
||||
<pig.common.version>${project.version}</pig.common.version>
|
||||
<spring-boot.version>2.6.5</spring-boot.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<security.oauth.version>2.1.8.RELEASE</security.oauth.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<git.commit.plugin>4.9.9</git.commit.plugin>
|
||||
<spring.checkstyle.plugin>0.0.29</spring.checkstyle.plugin>
|
||||
<fastjson.version>1.2.78</fastjson.version>
|
||||
<springdoc.version>1.6.6</springdoc.version>
|
||||
<swagger.core.version>2.1.13</swagger.core.version>
|
||||
<mybatis-plus.version>3.5.1</mybatis-plus.version>
|
||||
<excel.version>1.1.1</excel.version>
|
||||
<oss.version>1.0.3</oss.version>
|
||||
<sms.version>2.0.2</sms.version>
|
||||
<jaxb.version>2.3.5</jaxb.version>
|
||||
</properties>
|
||||
|
||||
<!-- 定义全局jar版本,模块使用需要再次引入但不用写版本号-->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-datasource</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-job</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-log</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-mybatis</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-security</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-feign</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-swagger</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-test</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-upms-api</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<!--稳定版本,替代spring security bom内置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
<version>${security.oauth.version}</version>
|
||||
</dependency>
|
||||
<!--swagger 最新依赖内置版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>${swagger.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger.core.version}</version>
|
||||
</dependency>
|
||||
<!--fastjson 版本-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.excel</groupId>
|
||||
<artifactId>excel-spring-boot-starter</artifactId>
|
||||
<version>${excel.version}</version>
|
||||
</dependency>
|
||||
<!-- 阿里云短信下发 -->
|
||||
<dependency>
|
||||
<groupId>io.springboot.sms</groupId>
|
||||
<artifactId>aliyun-sms-spring-boot-starter</artifactId>
|
||||
<version>${sms.version}</version>
|
||||
</dependency>
|
||||
<!--mybatis-plus-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>oss-spring-boot-starter</artifactId>
|
||||
<version>${oss.version}</version>
|
||||
</dependency>
|
||||
<!--orm 相关-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<exclusions>
|
||||
<!--排除tomcat依赖-->
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 指定 log4j 版本-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-bom</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<!-- 定义全局jar版本,模块使用需要再次引入但不用写版本号-->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-datasource</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-job</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-log</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-mybatis</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-security</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-feign</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-swagger</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-test</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-upms-api</artifactId>
|
||||
<version>${pig.common.version}</version>
|
||||
</dependency>
|
||||
<!--稳定版本,替代spring security bom内置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||
<version>${security.oauth.version}</version>
|
||||
</dependency>
|
||||
<!--springdoc -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-webmvc-core</artifactId>
|
||||
<version>${springdoc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-webflux-ui</artifactId>
|
||||
<version>${springdoc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-security</artifactId>
|
||||
<version>${springdoc.version}</version>
|
||||
</dependency>
|
||||
<!--fastjson 版本-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.excel</groupId>
|
||||
<artifactId>excel-spring-boot-starter</artifactId>
|
||||
<version>${excel.version}</version>
|
||||
</dependency>
|
||||
<!-- 阿里云短信下发 -->
|
||||
<dependency>
|
||||
<groupId>io.springboot.sms</groupId>
|
||||
<artifactId>aliyun-sms-spring-boot-starter</artifactId>
|
||||
<version>${sms.version}</version>
|
||||
</dependency>
|
||||
<!--mybatis-plus-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>oss-spring-boot-starter</artifactId>
|
||||
<version>${oss.version}</version>
|
||||
</dependency>
|
||||
<!--orm 相关-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<exclusions>
|
||||
<!--排除tomcat依赖-->
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 指定 log4j 版本-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-bom</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!--打包jar 与git commit 关联插件-->
|
||||
<plugin>
|
||||
<groupId>io.github.git-commit-id</groupId>
|
||||
<artifactId>git-commit-id-maven-plugin</artifactId>
|
||||
<version>${git.commit.plugin}</version>
|
||||
</plugin>
|
||||
<!--代码格式插件,默认使用spring 规则-->
|
||||
<plugin>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
<artifactId>spring-javaformat-maven-plugin</artifactId>
|
||||
<version>${spring.checkstyle.plugin}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<plugins>
|
||||
<!--打包jar 与git commit 关联插件-->
|
||||
<plugin>
|
||||
<groupId>io.github.git-commit-id</groupId>
|
||||
<artifactId>git-commit-id-maven-plugin</artifactId>
|
||||
<version>${git.commit.plugin}</version>
|
||||
</plugin>
|
||||
<!--代码格式插件,默认使用spring 规则-->
|
||||
<plugin>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
<artifactId>spring-javaformat-maven-plugin</artifactId>
|
||||
<version>${spring.checkstyle.plugin}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -16,56 +16,51 @@
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
</parent>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>pig 公共工具类核心包</description>
|
||||
<description>pig 公共工具类核心包</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!--hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!--redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--server-api-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<!--hibernate-validator-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<!--json模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--swagger 依赖-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<!--hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!--redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--server-api-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<!--hibernate-validator-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<!--json模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-job</artifactId>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-log</artifactId>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-mybatis</artifactId>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-security</artifactId>
|
||||
|
@ -19,58 +19,55 @@
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
</parent>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-swagger</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>pig-common-swagger</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>pig 接口文档</description>
|
||||
<description>pig 接口文档</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!--接口文档-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-oas</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!--webflux 相关包-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webflux</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--网关 swagger 聚合依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-gateway-server</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<!--接口文档-->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-webmvc-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<!--webflux 相关包-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webflux</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--网关 swagger 聚合依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-gateway-server</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package com.pig4cloud.pig.common.swagger.annotation;
|
||||
|
||||
import com.pig4cloud.pig.common.swagger.config.GatewaySwaggerAutoConfiguration;
|
||||
import com.pig4cloud.pig.common.swagger.config.SwaggerAutoConfiguration;
|
||||
import com.pig4cloud.pig.common.swagger.support.SwaggerProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@ -25,17 +24,17 @@ import org.springframework.context.annotation.Import;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 开启 pig swagger
|
||||
* 开启 pig spring doc
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2020/10/2
|
||||
* @date 2022-03-26
|
||||
*/
|
||||
@Target({ ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@Import({ SwaggerAutoConfiguration.class, GatewaySwaggerAutoConfiguration.class })
|
||||
public @interface EnablePigSwagger2 {
|
||||
@Import({ SwaggerAutoConfiguration.class })
|
||||
public @interface EnablePigDoc {
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package com.pig4cloud.pig.common.swagger.config;
|
||||
|
||||
import com.pig4cloud.pig.common.swagger.support.*;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.cloud.gateway.config.GatewayProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.server.RequestPredicates;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import springfox.documentation.swagger.web.SecurityConfiguration;
|
||||
import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
|
||||
import springfox.documentation.swagger.web.UiConfiguration;
|
||||
import springfox.documentation.swagger.web.UiConfigurationBuilder;
|
||||
|
||||
/**
|
||||
* 网关swagger 配置类,仅在webflux 环境生效哦
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2020/10/2
|
||||
*/
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
public class GatewaySwaggerAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public SwaggerProvider swaggerProvider(SwaggerProperties swaggerProperties, GatewayProperties gatewayProperties) {
|
||||
return new SwaggerProvider(swaggerProperties, gatewayProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SwaggerResourceHandler swaggerResourceHandler(SwaggerProvider swaggerProvider) {
|
||||
return new SwaggerResourceHandler(swaggerProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebFluxSwaggerConfiguration fluxSwaggerConfiguration() {
|
||||
return new WebFluxSwaggerConfiguration();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "swagger.basic.enabled", havingValue = "true")
|
||||
public SwaggerBasicGatewayFilter swaggerBasicGatewayFilter(SwaggerProperties swaggerProperties) {
|
||||
return new SwaggerBasicGatewayFilter(swaggerProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SwaggerSecurityHandler swaggerSecurityHandler(
|
||||
ObjectProvider<SecurityConfiguration> securityConfigurationObjectProvider) {
|
||||
SecurityConfiguration securityConfiguration = securityConfigurationObjectProvider
|
||||
.getIfAvailable(() -> SecurityConfigurationBuilder.builder().build());
|
||||
return new SwaggerSecurityHandler(securityConfiguration);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SwaggerUiHandler swaggerUiHandler(ObjectProvider<UiConfiguration> uiConfigurationObjectProvider) {
|
||||
UiConfiguration uiConfiguration = uiConfigurationObjectProvider
|
||||
.getIfAvailable(() -> UiConfigurationBuilder.builder().build());
|
||||
return new SwaggerUiHandler(uiConfiguration);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> swaggerRouterFunction(SwaggerProperties swaggerProperties,
|
||||
SwaggerUiHandler swaggerUiHandler, SwaggerSecurityHandler swaggerSecurityHandler,
|
||||
SwaggerResourceHandler swaggerResourceHandler) {
|
||||
// 开启swagger 匹配路由
|
||||
if (swaggerProperties.getEnabled()) {
|
||||
return RouterFunctions
|
||||
.route(RequestPredicates.GET("/swagger-resources").and(RequestPredicates.accept(MediaType.ALL)),
|
||||
swaggerResourceHandler)
|
||||
.andRoute(RequestPredicates.GET("/swagger-resources/configuration/ui")
|
||||
.and(RequestPredicates.accept(MediaType.ALL)), swaggerUiHandler)
|
||||
.andRoute(RequestPredicates.GET("/swagger-resources/configuration/security")
|
||||
.and(RequestPredicates.accept(MediaType.ALL)), swaggerSecurityHandler);
|
||||
}
|
||||
else {
|
||||
// 关闭时,返回404
|
||||
return RouterFunctions
|
||||
.route(RequestPredicates.GET("/swagger-ui/**").and(RequestPredicates.accept(MediaType.ALL)),
|
||||
serverRequest -> ServerResponse.notFound().build())
|
||||
.andRoute(RequestPredicates.GET("/*/v2/api-docs").and(RequestPredicates.accept(MediaType.ALL)),
|
||||
serverRequest -> ServerResponse.notFound().build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -17,33 +17,22 @@
|
||||
package com.pig4cloud.pig.common.swagger.config;
|
||||
|
||||
import com.pig4cloud.pig.common.swagger.support.SwaggerProperties;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.security.OAuthFlow;
|
||||
import io.swagger.v3.oas.models.security.OAuthFlows;
|
||||
import io.swagger.v3.oas.models.security.Scopes;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.builders.RequestParameterBuilder;
|
||||
import springfox.documentation.schema.ScalarType;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* swagger配置
|
||||
@ -58,127 +47,39 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* @author lengleng
|
||||
*/
|
||||
@EnableSwagger2
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
||||
@ConditionalOnMissingClass("org.springframework.cloud.gateway.config.GatewayAutoConfiguration")
|
||||
public class SwaggerAutoConfiguration {
|
||||
|
||||
/**
|
||||
* 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
|
||||
*/
|
||||
private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error", "/actuator/**");
|
||||
private final SwaggerProperties swaggerProperties;
|
||||
|
||||
private static final String BASE_PATH = "/**";
|
||||
private final ServiceInstance serviceInstance;
|
||||
|
||||
@Bean
|
||||
public Docket api(SwaggerProperties swaggerProperties) {
|
||||
// base-path处理
|
||||
if (swaggerProperties.getBasePath().isEmpty()) {
|
||||
swaggerProperties.getBasePath().add(BASE_PATH);
|
||||
}
|
||||
|
||||
// exclude-path处理
|
||||
if (swaggerProperties.getExcludePath().isEmpty()) {
|
||||
swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
|
||||
}
|
||||
List<Predicate<String>> excludePath = new ArrayList<>();
|
||||
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
|
||||
|
||||
// 版本请求头处理
|
||||
List<RequestParameter> pars = new ArrayList<>();
|
||||
|
||||
RequestParameterBuilder versionPar = new RequestParameterBuilder().description("灰度路由版本信息")
|
||||
.in(ParameterType.HEADER).name("VERSION").required(false)
|
||||
.query(param -> param.model(model -> model.scalarModel(ScalarType.STRING)));
|
||||
|
||||
pars.add(versionPar.build());
|
||||
|
||||
ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).host(swaggerProperties.getHost())
|
||||
.apiInfo(apiInfo(swaggerProperties)).globalRequestParameters(pars).select()
|
||||
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()));
|
||||
|
||||
swaggerProperties.getBasePath().forEach(p -> builder.paths(PathSelectors.ant(p)));
|
||||
swaggerProperties.getExcludePath().forEach(p -> builder.paths(PathSelectors.ant(p).negate()));
|
||||
|
||||
return builder.build().securitySchemes(Collections.singletonList(securitySchema(swaggerProperties)))
|
||||
.securityContexts(Collections.singletonList(securityContext(swaggerProperties))).pathMapping("/");
|
||||
public OpenAPI springOpenAPI() {
|
||||
OpenAPI openAPI = new OpenAPI().info(new Info().title(swaggerProperties.getTitle()));
|
||||
// oauth2.0 password
|
||||
openAPI.schemaRequirement(HttpHeaders.AUTHORIZATION, this.securityScheme());
|
||||
// servers
|
||||
List<Server> serverList = new ArrayList<>();
|
||||
String path = swaggerProperties.getServices().get(serviceInstance.getServiceId());
|
||||
serverList.add(new Server().url(swaggerProperties.getGateway() + "/" + path));
|
||||
openAPI.servers(serverList);
|
||||
return openAPI;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置默认的全局鉴权策略的开关,通过正则表达式进行匹配;默认匹配所有URL
|
||||
* @return
|
||||
*/
|
||||
private static SecurityContext securityContext(SwaggerProperties swaggerProperties) {
|
||||
return SecurityContext.builder().securityReferences(defaultAuth(swaggerProperties)).build();
|
||||
}
|
||||
private SecurityScheme securityScheme() {
|
||||
OAuthFlow clientCredential = new OAuthFlow();
|
||||
clientCredential.setTokenUrl(swaggerProperties.getTokenUrl());
|
||||
clientCredential.setScopes(new Scopes().addString(swaggerProperties.getScope(), swaggerProperties.getScope()));
|
||||
OAuthFlows oauthFlows = new OAuthFlows();
|
||||
oauthFlows.password(clientCredential);
|
||||
|
||||
/**
|
||||
* 默认的全局鉴权策略
|
||||
* @return
|
||||
*/
|
||||
private static List<SecurityReference> defaultAuth(SwaggerProperties swaggerProperties) {
|
||||
ArrayList<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
||||
swaggerProperties.getAuthorization().getAuthorizationScopeList()
|
||||
.forEach(authorizationScope -> authorizationScopeList.add(
|
||||
new AuthorizationScope(authorizationScope.getScope(), authorizationScope.getDescription())));
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[authorizationScopeList.size()];
|
||||
return Collections
|
||||
.singletonList(SecurityReference.builder().reference(swaggerProperties.getAuthorization().getName())
|
||||
.scopes(authorizationScopeList.toArray(authorizationScopes)).build());
|
||||
}
|
||||
|
||||
private static OAuth securitySchema(SwaggerProperties swaggerProperties) {
|
||||
ArrayList<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
||||
swaggerProperties.getAuthorization().getAuthorizationScopeList()
|
||||
.forEach(authorizationScope -> authorizationScopeList.add(
|
||||
new AuthorizationScope(authorizationScope.getScope(), authorizationScope.getDescription())));
|
||||
ArrayList<GrantType> grantTypes = new ArrayList<>();
|
||||
swaggerProperties.getAuthorization().getTokenUrlList()
|
||||
.forEach(tokenUrl -> grantTypes.add(new ResourceOwnerPasswordCredentialsGrant(tokenUrl)));
|
||||
return new OAuth(swaggerProperties.getAuthorization().getName(), authorizationScopeList, grantTypes);
|
||||
}
|
||||
|
||||
private static ApiInfo apiInfo(SwaggerProperties swaggerProperties) {
|
||||
return new ApiInfoBuilder().title(swaggerProperties.getTitle()).description(swaggerProperties.getDescription())
|
||||
.license(swaggerProperties.getLicense()).licenseUrl(swaggerProperties.getLicenseUrl())
|
||||
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
||||
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(),
|
||||
swaggerProperties.getContact().getEmail()))
|
||||
.version(swaggerProperties.getVersion()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public static BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
|
||||
return new BeanPostProcessor() {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof WebMvcRequestHandlerProvider) {
|
||||
customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(
|
||||
List<T> mappings) {
|
||||
List<T> copy = mappings.stream().filter(mapping -> mapping.getPatternParser() == null)
|
||||
.collect(Collectors.toList());
|
||||
mappings.clear();
|
||||
mappings.addAll(copy);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) {
|
||||
try {
|
||||
Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings");
|
||||
field.setAccessible(true);
|
||||
return (List<RequestMappingInfoHandlerMapping>) field.get(bean);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
SecurityScheme securityScheme = new SecurityScheme();
|
||||
securityScheme.setType(SecurityScheme.Type.OAUTH2);
|
||||
securityScheme.setFlows(oauthFlows);
|
||||
return securityScheme;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package com.pig4cloud.pig.common.swagger.config;
|
||||
|
||||
import org.springframework.web.reactive.config.ResourceHandlerRegistry;
|
||||
import org.springframework.web.reactive.config.WebFluxConfigurer;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/10/2
|
||||
* <p>
|
||||
* webflux 网关 swagger 资源路径配置
|
||||
*/
|
||||
public class WebFluxSwaggerConfiguration implements WebFluxConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/swagger-ui/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||||
.resourceChain(false);
|
||||
}
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.util.Base64Utils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* swagger 开启basic 认证
|
||||
*
|
||||
* @author Lht
|
||||
* @date 2021/8/8
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerBasicGatewayFilter implements GlobalFilter {
|
||||
|
||||
private static final String API_URI = "/v2/api-docs";
|
||||
|
||||
private static final String BASIC_PREFIX = "Basic ";
|
||||
|
||||
private final SwaggerProperties swaggerProperties;
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
|
||||
if (!request.getURI().getPath().contains(API_URI)) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
|
||||
if (hasAuth(exchange)) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
else {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
response.setStatusCode(HttpStatus.UNAUTHORIZED);
|
||||
response.getHeaders().add(HttpHeaders.WWW_AUTHENTICATE, "Basic Realm=\"pig\"");
|
||||
return response.setComplete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单的basic认证
|
||||
* @param exchange 上下文
|
||||
* @return 是否有权限
|
||||
*/
|
||||
private boolean hasAuth(ServerWebExchange exchange) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
String auth = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
|
||||
log.info("Basic认证信息为:{}", auth);
|
||||
if (!StringUtils.hasText(auth) || !auth.startsWith(BASIC_PREFIX)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
String username = swaggerProperties.getBasic().getUsername();
|
||||
String password = swaggerProperties.getBasic().getPassword();
|
||||
|
||||
String encodeToString = Base64Utils
|
||||
.encodeToString((username + ":" + password).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
return auth.equals(BASIC_PREFIX + encodeToString);
|
||||
}
|
||||
|
||||
}
|
@ -17,11 +17,11 @@
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SwaggerProperties
|
||||
@ -64,128 +64,20 @@ public class SwaggerProperties {
|
||||
private String title = "";
|
||||
|
||||
/**
|
||||
* 描述
|
||||
**/
|
||||
private String description = "";
|
||||
|
||||
/**
|
||||
* 版本
|
||||
**/
|
||||
private String version = "";
|
||||
|
||||
/**
|
||||
* 许可证
|
||||
**/
|
||||
private String license = "";
|
||||
|
||||
/**
|
||||
* 许可证URL
|
||||
**/
|
||||
private String licenseUrl = "";
|
||||
|
||||
/**
|
||||
* 服务条款URL
|
||||
**/
|
||||
private String termsOfServiceUrl = "";
|
||||
|
||||
/**
|
||||
* host信息
|
||||
**/
|
||||
private String host = "";
|
||||
|
||||
/**
|
||||
* 联系人信息
|
||||
* 网关
|
||||
*/
|
||||
private Contact contact = new Contact();
|
||||
private String gateway;
|
||||
|
||||
/**
|
||||
* 全局统一鉴权配置
|
||||
**/
|
||||
private Authorization authorization = new Authorization();
|
||||
|
||||
/**
|
||||
* 认证参数
|
||||
* 获取token
|
||||
*/
|
||||
private SwaggerBasic basic = new SwaggerBasic();
|
||||
private String tokenUrl;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class Contact {
|
||||
/**
|
||||
* 作用域
|
||||
*/
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
**/
|
||||
private String name = "";
|
||||
|
||||
/**
|
||||
* 联系人url
|
||||
**/
|
||||
private String url = "";
|
||||
|
||||
/**
|
||||
* 联系人email
|
||||
**/
|
||||
private String email = "";
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class Authorization {
|
||||
|
||||
/**
|
||||
* 鉴权策略ID,需要和SecurityReferences ID保持一致
|
||||
*/
|
||||
private String name = "";
|
||||
|
||||
/**
|
||||
* 需要开启鉴权URL的正则
|
||||
*/
|
||||
private String authRegex = "^.*$";
|
||||
|
||||
/**
|
||||
* 鉴权作用域列表
|
||||
*/
|
||||
private List<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
||||
|
||||
private List<String> tokenUrlList = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public static class AuthorizationScope {
|
||||
|
||||
/**
|
||||
* 作用域名称
|
||||
*/
|
||||
private String scope = "";
|
||||
|
||||
/**
|
||||
* 作用域描述
|
||||
*/
|
||||
private String description = "";
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SwaggerBasic {
|
||||
|
||||
/**
|
||||
* 是否开启 basic 认证
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
}
|
||||
private Map<String, String> services;
|
||||
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.gateway.config.GatewayProperties;
|
||||
import org.springframework.cloud.gateway.route.RouteLocator;
|
||||
import org.springframework.cloud.gateway.support.NameUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import springfox.documentation.swagger.web.SwaggerResource;
|
||||
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sywd 聚合接口文档注册,和zuul实现类似
|
||||
*/
|
||||
@Primary
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerProvider implements SwaggerResourcesProvider {
|
||||
|
||||
private static final String API_URI = "/v2/api-docs";
|
||||
|
||||
private final SwaggerProperties swaggerProperties;
|
||||
|
||||
private final GatewayProperties gatewayProperties;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RouteLocator routeLocator;
|
||||
|
||||
@Override
|
||||
public List<SwaggerResource> get() {
|
||||
List<SwaggerResource> resources = new ArrayList<>();
|
||||
List<String> routes = new ArrayList<>();
|
||||
routeLocator.getRoutes().subscribe(route -> routes.add(route.getId()));
|
||||
gatewayProperties.getRoutes().stream().filter(routeDefinition -> routes.contains(routeDefinition.getId()))
|
||||
.forEach(routeDefinition -> routeDefinition.getPredicates().stream()
|
||||
.filter(predicateDefinition -> "Path".equalsIgnoreCase(predicateDefinition.getName()))
|
||||
.filter(predicateDefinition -> !swaggerProperties.getIgnoreProviders()
|
||||
.contains(routeDefinition.getId()))
|
||||
.forEach(predicateDefinition -> resources
|
||||
.add(swaggerResource(routeDefinition.getId(), predicateDefinition.getArgs()
|
||||
.get(NameUtils.GENERATED_NAME_PREFIX + "0").replace("/**", API_URI)))));
|
||||
return resources;
|
||||
}
|
||||
|
||||
private static SwaggerResource swaggerResource(String name, String location) {
|
||||
SwaggerResource swaggerResource = new SwaggerResource();
|
||||
swaggerResource.setName(name);
|
||||
swaggerResource.setLocation(location);
|
||||
swaggerResource.setSwaggerVersion("2.0");
|
||||
return swaggerResource;
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.function.server.HandlerFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018-07-19 SwaggerResourceHandler
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerResourceHandler implements HandlerFunction<ServerResponse> {
|
||||
|
||||
private final SwaggerResourcesProvider swaggerResources;
|
||||
|
||||
/**
|
||||
* Handle the given request.
|
||||
* @param request the request to handler
|
||||
* @return the response
|
||||
*/
|
||||
@Override
|
||||
public Mono<ServerResponse> handle(ServerRequest request) {
|
||||
return ServerResponse.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON)
|
||||
.body(BodyInserters.fromValue(swaggerResources.get()));
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.function.server.HandlerFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import springfox.documentation.swagger.web.SecurityConfiguration;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018-07-19 SwaggerSecurityHandler
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerSecurityHandler implements HandlerFunction<ServerResponse> {
|
||||
|
||||
private final SecurityConfiguration securityConfiguration;
|
||||
|
||||
/**
|
||||
* Handle the given request.
|
||||
* @param request the request to handler
|
||||
* @return the response
|
||||
*/
|
||||
@Override
|
||||
public Mono<ServerResponse> handle(ServerRequest request) {
|
||||
return ServerResponse.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON)
|
||||
.body(BodyInserters.fromValue(securityConfiguration));
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.common.swagger.support;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.function.server.HandlerFunction;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
import springfox.documentation.swagger.web.UiConfiguration;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018-07-19 SwaggerUiHandler
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerUiHandler implements HandlerFunction<ServerResponse> {
|
||||
|
||||
private final UiConfiguration uiConfiguration;
|
||||
|
||||
/**
|
||||
* Handle the given request.
|
||||
* @param request the request to handler
|
||||
* @return the response
|
||||
*/
|
||||
@Override
|
||||
public Mono<ServerResponse> handle(ServerRequest request) {
|
||||
return ServerResponse.status(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON)
|
||||
.body(BodyInserters.fromValue(uiConfiguration));
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common-test</artifactId>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-common</artifactId>
|
||||
|
@ -16,87 +16,87 @@
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
</parent>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-gateway</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>pig-gateway</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>pig 服务网关,基于 spring cloud gateway</description>
|
||||
<description>pig 服务网关,基于 spring cloud gateway</description>
|
||||
|
||||
<dependencies>
|
||||
<!--gateway 网关依赖,内置webflux 依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
|
||||
</dependency>
|
||||
<!--注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--断路器依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!-- LB 扩展 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<!--caffeine 替换LB 默认缓存实现-->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
</dependency>
|
||||
<!--验证码 源码: https://github.com/pig-mesh/easy-captcha -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>captcha-spring-boot-starter</artifactId>
|
||||
<version>${captcha.version}</version>
|
||||
</dependency>
|
||||
<!-- 工具包依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--接口文档-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-swagger</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<!--gateway 网关依赖,内置webflux 依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
|
||||
</dependency>
|
||||
<!--注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--断路器依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!-- LB 扩展 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
<!--caffeine 替换LB 默认缓存实现-->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
</dependency>
|
||||
<!--验证码 源码: https://github.com/pig-mesh/easy-captcha -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.plugin</groupId>
|
||||
<artifactId>captcha-spring-boot-starter</artifactId>
|
||||
<version>${captcha.version}</version>
|
||||
</dependency>
|
||||
<!-- 工具包依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--接口文档-->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-webflux-ui</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
@ -16,10 +16,18 @@
|
||||
|
||||
package com.pig4cloud.pig.gateway;
|
||||
|
||||
import com.pig4cloud.pig.common.swagger.annotation.EnablePigSwagger2;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springdoc.core.SwaggerUiConfigParameters;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@ -27,7 +35,6 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
* <p>
|
||||
* 网关应用
|
||||
*/
|
||||
@EnablePigSwagger2
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class PigGatewayApplication {
|
||||
|
@ -3,6 +3,7 @@ package com.pig4cloud.pig.gateway.config;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pig4cloud.pig.gateway.filter.PasswordDecoderFilter;
|
||||
import com.pig4cloud.pig.gateway.filter.PigRequestGlobalFilter;
|
||||
import com.pig4cloud.pig.gateway.filter.PigSpringDocGlobalFilter;
|
||||
import com.pig4cloud.pig.gateway.filter.ValidateCodeGatewayFilter;
|
||||
import com.pig4cloud.pig.gateway.handler.GlobalExceptionHandler;
|
||||
import com.pig4cloud.pig.gateway.handler.ImageCodeHandler;
|
||||
@ -30,6 +31,11 @@ public class GatewayConfiguration {
|
||||
return new PigRequestGlobalFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PigSpringDocGlobalFilter pigSwaggerGlobalFilter() {
|
||||
return new PigSpringDocGlobalFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ValidateCodeGatewayFilter validateCodeGatewayFilter(GatewayConfigProperties configProperties,
|
||||
ObjectMapper objectMapper, RedisTemplate redisTemplate) {
|
||||
|
@ -0,0 +1,45 @@
|
||||
package com.pig4cloud.pig.gateway.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springdoc.core.SwaggerUiConfigParameters;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2022/3/26
|
||||
*
|
||||
* swagger 3.0 展示
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SpringDocConfiguration {
|
||||
|
||||
@Bean
|
||||
@Lazy(false)
|
||||
public List<GroupedOpenApi> apis(SwaggerUiConfigParameters swaggerUiConfigParameters,
|
||||
SwaggerProperties properties) {
|
||||
List<GroupedOpenApi> groups = new ArrayList<>();
|
||||
for (String value : properties.services.values()) {
|
||||
swaggerUiConfigParameters.addGroup(value);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties("swagger")
|
||||
class SwaggerProperties {
|
||||
|
||||
private Map<String, String> services;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -61,6 +61,10 @@ public class PigRequestGlobalFilter implements GlobalFilter, Ordered {
|
||||
String rawPath = request.getURI().getRawPath();
|
||||
String newPath = "/" + Arrays.stream(StringUtils.tokenizeToStringArray(rawPath, "/")).skip(1L)
|
||||
.collect(Collectors.joining("/"));
|
||||
|
||||
// if (rawPath.contains("/v3/api-docs/")) {
|
||||
// newPath = "/admin/v3/api-docs";
|
||||
// }
|
||||
ServerHttpRequest newRequest = request.mutate().path(newPath).build();
|
||||
exchange.getAttributes().put(GATEWAY_REQUEST_URL_ATTR, newRequest.getURI());
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.gateway.filter;
|
||||
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.addOriginalRequestUrl;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2022-03-26
|
||||
* <p>
|
||||
* 支持springdoc 路径从写
|
||||
*/
|
||||
public class PigSpringDocGlobalFilter implements GlobalFilter, Ordered {
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
|
||||
String rawPath = request.getURI().getRawPath();
|
||||
|
||||
// 非springdoc 请求直接跳过
|
||||
if (!rawPath.contains("/api-docs/")) {
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
|
||||
// 2. 重写StripPrefix
|
||||
addOriginalRequestUrl(exchange, request.getURI());
|
||||
|
||||
String newPath = "/" + Arrays.stream(StringUtils.tokenizeToStringArray(rawPath, "/")).skip(1L)
|
||||
.collect(Collectors.joining("/")) + "/v3/api-docs";
|
||||
ServerHttpRequest newRequest = request.mutate().path(newPath).build();
|
||||
exchange.getAttributes().put(GATEWAY_REQUEST_URL_ATTR, newRequest.getURI());
|
||||
|
||||
return chain.filter(exchange.mutate().request(newRequest.mutate().build()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return -500;
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-register</artifactId>
|
||||
|
@ -16,45 +16,50 @@
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-upms</artifactId>
|
||||
<version>3.4.7</version>
|
||||
</parent>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-upms</artifactId>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-upms-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>pig-upms-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>pig 通用用户权限管理系统公共api模块</description>
|
||||
<description>pig 通用用户权限管理系统公共api模块</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!--core 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!--断路器依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 https://github.com/pig-mesh/excel-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.excel</groupId>
|
||||
<artifactId>excel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencies>
|
||||
<!--core 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--swagger-->
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<!--feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!--断路器依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-common-mybatis</artifactId>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 https://github.com/pig-mesh/excel-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud.excel</groupId>
|
||||
<artifactId>excel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.pig4cloud.pig.admin.api.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@ -13,19 +12,19 @@ import java.time.LocalDateTime;
|
||||
* 日志查询传输对象
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "日志查询对象")
|
||||
@Schema(name = "日志查询对象")
|
||||
public class SysLogDTO {
|
||||
|
||||
/**
|
||||
* 查询日志类型
|
||||
*/
|
||||
@ApiModelProperty(value = "日志类型")
|
||||
@Schema(name = "日志类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 创建时间区间 [开始时间,结束时间]
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间区间")
|
||||
@Schema(name = "创建时间区间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -36,7 +35,7 @@ import javax.validation.constraints.NotNull;
|
||||
* @author lengleng
|
||||
* @since 2019/2/1
|
||||
*/
|
||||
@ApiModel(value = "部门")
|
||||
@Schema(name = "部门")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDept extends BaseEntity {
|
||||
@ -44,27 +43,27 @@ public class SysDept extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "dept_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "部门id")
|
||||
@Schema(name = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@ApiModelProperty(value = "部门名称", required = true)
|
||||
@Schema(name = "部门名称", required = true)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "部门排序值不能为空")
|
||||
@ApiModelProperty(value = "排序值", required = true)
|
||||
@Schema(name = "排序值", required = true)
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 父级部门id
|
||||
*/
|
||||
@ApiModelProperty(value = "父级部门id")
|
||||
@Schema(name = "父级部门id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
|
@ -17,8 +17,7 @@
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -30,7 +29,7 @@ import lombok.EqualsAndHashCode;
|
||||
* @author lengleng
|
||||
* @since 2019/2/1
|
||||
*/
|
||||
@ApiModel(value = "部门关系")
|
||||
@Schema(name = "部门关系")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDeptRelation extends Model<SysDeptRelation> {
|
||||
@ -40,13 +39,13 @@ public class SysDeptRelation extends Model<SysDeptRelation> {
|
||||
/**
|
||||
* 祖先节点
|
||||
*/
|
||||
@ApiModelProperty(value = "祖先节点")
|
||||
@Schema(name = "祖先节点")
|
||||
private Long ancestor;
|
||||
|
||||
/**
|
||||
* 后代节点
|
||||
*/
|
||||
@ApiModelProperty(value = "后代节点")
|
||||
@Schema(name = "后代节点")
|
||||
private Long descendant;
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -31,7 +30,7 @@ import lombok.EqualsAndHashCode;
|
||||
* @date 2019/03/19
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "字典类型")
|
||||
@Schema(name = "字典类型")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDict extends BaseEntity {
|
||||
|
||||
@ -41,38 +40,38 @@ public class SysDict extends BaseEntity {
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "字典编号")
|
||||
@Schema(name = "字典编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "字典类型")
|
||||
@Schema(name = "字典类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "字典描述")
|
||||
@Schema(name = "字典描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否是系统内置
|
||||
*/
|
||||
@ApiModelProperty(value = "是否系统内置")
|
||||
@Schema(name = "是否系统内置")
|
||||
private String systemFlag;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
@Schema(name = "备注信息")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "删除标记,1:已删除,0:正常")
|
||||
@Schema(name = "删除标记,1:已删除,0:正常")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -31,7 +30,7 @@ import lombok.EqualsAndHashCode;
|
||||
* @date 2019/03/19
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "字典项")
|
||||
@Schema(name = "字典项")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictItem extends BaseEntity {
|
||||
|
||||
@ -41,56 +40,56 @@ public class SysDictItem extends BaseEntity {
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "字典项id")
|
||||
@Schema(name = "字典项id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属字典类id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属字典类id")
|
||||
@Schema(name = "所属字典类id")
|
||||
private Long dictId;
|
||||
|
||||
/**
|
||||
* 数据值
|
||||
*/
|
||||
@ApiModelProperty(value = "数据值")
|
||||
@Schema(name = "数据值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 标签名
|
||||
*/
|
||||
@ApiModelProperty(value = "标签名")
|
||||
@Schema(name = "标签名")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "类型")
|
||||
@Schema(name = "类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "描述")
|
||||
@Schema(name = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序(升序)
|
||||
*/
|
||||
@ApiModelProperty(value = "排序值,默认升序")
|
||||
@Schema(name = "排序值,默认升序")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
@Schema(name = "备注信息")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "删除标记,1:已删除,0:正常")
|
||||
@Schema(name = "删除标记,1:已删除,0:正常")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -49,7 +49,7 @@ public class SysLog extends BaseEntity {
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
@ExcelProperty("日志编号")
|
||||
@ApiModelProperty(value = "日志编号")
|
||||
@Schema(name = "日志编号")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@ -58,7 +58,7 @@ public class SysLog extends BaseEntity {
|
||||
*/
|
||||
@NotBlank(message = "日志类型不能为空")
|
||||
@ExcelProperty("日志类型(0-正常 9-错误)")
|
||||
@ApiModelProperty(value = "日志类型")
|
||||
@Schema(name = "日志类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -66,63 +66,63 @@ public class SysLog extends BaseEntity {
|
||||
*/
|
||||
@NotBlank(message = "日志标题不能为空")
|
||||
@ExcelProperty("日志标题")
|
||||
@ApiModelProperty(value = "日志标题")
|
||||
@Schema(name = "日志标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 操作IP地址
|
||||
*/
|
||||
@ExcelProperty("IP")
|
||||
@ApiModelProperty(value = "操作ip地址")
|
||||
@Schema(name = "操作ip地址")
|
||||
private String remoteAddr;
|
||||
|
||||
/**
|
||||
* 用户浏览器
|
||||
*/
|
||||
@ExcelProperty("浏览器类型")
|
||||
@ApiModelProperty(value = "用户代理")
|
||||
@Schema(name = "用户代理")
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* 请求URI
|
||||
*/
|
||||
@ExcelProperty("请求URI")
|
||||
@ApiModelProperty(value = "请求uri")
|
||||
@Schema(name = "请求uri")
|
||||
private String requestUri;
|
||||
|
||||
/**
|
||||
* 操作方式
|
||||
*/
|
||||
@ExcelProperty("操作方式")
|
||||
@ApiModelProperty(value = "操作方式")
|
||||
@Schema(name = "操作方式")
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 操作提交的数据
|
||||
*/
|
||||
@ExcelProperty("请求参数")
|
||||
@ApiModelProperty(value = "数据")
|
||||
@Schema(name = "数据")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
@ExcelProperty("方法执行时间")
|
||||
@ApiModelProperty(value = "方法执行时间")
|
||||
@Schema(name = "方法执行时间")
|
||||
private Long time;
|
||||
|
||||
/**
|
||||
* 异常信息
|
||||
*/
|
||||
@ExcelProperty("异常信息")
|
||||
@ApiModelProperty(value = "异常信息")
|
||||
@Schema(name = "异常信息")
|
||||
private String exception;
|
||||
|
||||
/**
|
||||
* 服务ID
|
||||
*/
|
||||
@ExcelProperty("应用标识")
|
||||
@ApiModelProperty(value = "应用标识")
|
||||
@Schema(name = "应用标识")
|
||||
private String serviceId;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -45,45 +45,45 @@ public class SysMenu extends BaseEntity {
|
||||
* 菜单ID
|
||||
*/
|
||||
@TableId(value = "menu_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "菜单id")
|
||||
@Schema(name = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
@Schema(name = "菜单名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单权限标识
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单权限标识")
|
||||
@Schema(name = "菜单权限标识")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 父菜单ID
|
||||
*/
|
||||
@NotNull(message = "菜单父ID不能为空")
|
||||
@ApiModelProperty(value = "菜单父id")
|
||||
@Schema(name = "菜单父id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
@Schema(name = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 前端URL
|
||||
*/
|
||||
@ApiModelProperty(value = "前端路由标识路径")
|
||||
@Schema(name = "前端路由标识路径")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
@ApiModelProperty(value = "排序值")
|
||||
@Schema(name = "排序值")
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
@ -95,7 +95,7 @@ public class SysMenu extends BaseEntity {
|
||||
/**
|
||||
* 路由缓冲
|
||||
*/
|
||||
@ApiModelProperty(value = "路由缓冲")
|
||||
@Schema(name = "路由缓冲")
|
||||
private String keepAlive;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ package com.pig4cloud.pig.admin.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -44,69 +44,69 @@ public class SysOauthClientDetails extends BaseEntity {
|
||||
*/
|
||||
@NotBlank(message = "client_id 不能为空")
|
||||
@TableId(value = "client_id", type = IdType.INPUT)
|
||||
@ApiModelProperty(value = "客户端id")
|
||||
@Schema(name = "客户端id")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端密钥
|
||||
*/
|
||||
@NotBlank(message = "client_secret 不能为空")
|
||||
@ApiModelProperty(value = "客户端密钥")
|
||||
@Schema(name = "客户端密钥")
|
||||
private String clientSecret;
|
||||
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
@ApiModelProperty(value = "资源id列表")
|
||||
@Schema(name = "资源id列表")
|
||||
private String resourceIds;
|
||||
|
||||
/**
|
||||
* 作用域
|
||||
*/
|
||||
@NotBlank(message = "scope 不能为空")
|
||||
@ApiModelProperty(value = "作用域")
|
||||
@Schema(name = "作用域")
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* 授权方式(A,B,C)
|
||||
*/
|
||||
@ApiModelProperty(value = "授权方式")
|
||||
@Schema(name = "授权方式")
|
||||
private String authorizedGrantTypes;
|
||||
|
||||
/**
|
||||
* 回调地址
|
||||
*/
|
||||
@ApiModelProperty(value = "回调地址")
|
||||
@Schema(name = "回调地址")
|
||||
private String webServerRedirectUri;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@ApiModelProperty(value = "权限列表")
|
||||
@Schema(name = "权限列表")
|
||||
private String authorities;
|
||||
|
||||
/**
|
||||
* 请求令牌有效时间
|
||||
*/
|
||||
@ApiModelProperty(value = "请求令牌有效时间")
|
||||
@Schema(name = "请求令牌有效时间")
|
||||
private Integer accessTokenValidity;
|
||||
|
||||
/**
|
||||
* 刷新令牌有效时间
|
||||
*/
|
||||
@ApiModelProperty(value = "刷新令牌有效时间")
|
||||
@Schema(name = "刷新令牌有效时间")
|
||||
private Integer refreshTokenValidity;
|
||||
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
@ApiModelProperty(value = "扩展信息")
|
||||
@Schema(name = "扩展信息")
|
||||
private String additionalInformation;
|
||||
|
||||
/**
|
||||
* 是否自动放行
|
||||
*/
|
||||
@ApiModelProperty(value = "是否自动放行")
|
||||
@Schema(name = "是否自动放行")
|
||||
private String autoapprove;
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -34,7 +33,7 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@TableName("sys_post")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "岗位信息表")
|
||||
@Schema(name = "岗位信息表")
|
||||
public class SysPost extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = -8744622014102311894L;
|
||||
@ -43,37 +42,37 @@ public class SysPost extends BaseEntity {
|
||||
* 岗位ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "岗位ID")
|
||||
@Schema(name = "岗位ID")
|
||||
private Long postId;
|
||||
|
||||
/**
|
||||
* 岗位编码
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位编码")
|
||||
@Schema(name = "岗位编码")
|
||||
private String postCode;
|
||||
|
||||
/**
|
||||
* 岗位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
@Schema(name = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 岗位排序
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位排序")
|
||||
@Schema(name = "岗位排序")
|
||||
private Integer postSort;
|
||||
|
||||
/**
|
||||
* 是否删除 -1:已删除 0:正常
|
||||
*/
|
||||
@ApiModelProperty(value = "是否删除 -1:已删除 0:正常")
|
||||
@Schema(name = "是否删除 -1:已删除 0:正常")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@ApiModelProperty(value = "备注信息")
|
||||
@Schema(name = "备注信息")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
@ -17,16 +17,13 @@
|
||||
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 公共参数配置
|
||||
*
|
||||
@ -34,7 +31,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2019-04-29
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "公共参数")
|
||||
@Schema(name = "公共参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPublicParam extends BaseEntity {
|
||||
|
||||
@ -44,49 +41,49 @@ public class SysPublicParam extends BaseEntity {
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "公共参数编号")
|
||||
@Schema(name = "公共参数编号")
|
||||
private Long publicId;
|
||||
|
||||
/**
|
||||
* 公共参数名称
|
||||
*/
|
||||
@ApiModelProperty(value = "公共参数名称", required = true, example = "公共参数名称")
|
||||
@Schema(name = "公共参数名称", required = true, example = "公共参数名称")
|
||||
private String publicName;
|
||||
|
||||
/**
|
||||
* 公共参数地址值,英文大写+下划线
|
||||
*/
|
||||
@ApiModelProperty(value = "键[英文大写+下划线]", required = true, example = "PIGX_PUBLIC_KEY")
|
||||
@Schema(name = "键[英文大写+下划线]", required = true, example = "PIGX_PUBLIC_KEY")
|
||||
private String publicKey;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
@ApiModelProperty(value = "值", required = true, example = "999")
|
||||
@Schema(name = "值", required = true, example = "999")
|
||||
private String publicValue;
|
||||
|
||||
/**
|
||||
* 状态(1有效;2无效;)
|
||||
*/
|
||||
@ApiModelProperty(value = "标识[1有效;2无效]", example = "1")
|
||||
@Schema(name = "标识[1有效;2无效]", example = "1")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 公共参数编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码", example = "^(PIG|PIGX)$")
|
||||
@Schema(name = "编码", example = "^(PIG|PIGX)$")
|
||||
private String validateCode;
|
||||
|
||||
/**
|
||||
* 是否是系统内置
|
||||
*/
|
||||
@ApiModelProperty(value = "是否是系统内置")
|
||||
@Schema(name = "是否是系统内置")
|
||||
private String systemFlag;
|
||||
|
||||
/**
|
||||
* 配置类型:0-默认;1-检索;2-原文;3-报表;4-安全;5-文档;6-消息;9-其他
|
||||
*/
|
||||
@ApiModelProperty(value = "类型[1-检索;2-原文...]", example = "1")
|
||||
@Schema(name = "类型[1-检索;2-原文...]", example = "1")
|
||||
private String publicType;
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -41,19 +41,19 @@ public class SysRole extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "role_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "角色编号")
|
||||
@Schema(name = "角色编号")
|
||||
private Long roleId;
|
||||
|
||||
@NotBlank(message = "角色名称 不能为空")
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
@Schema(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
@NotBlank(message = "角色标识 不能为空")
|
||||
@ApiModelProperty(value = "角色标识")
|
||||
@Schema(name = "角色标识")
|
||||
private String roleCode;
|
||||
|
||||
@NotBlank(message = "角色描述 不能为空")
|
||||
@ApiModelProperty(value = "角色描述")
|
||||
@Schema(name = "角色描述")
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -38,13 +38,13 @@ public class SysRoleMenu extends Model<SysRoleMenu> {
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@ApiModelProperty(value = "角色id")
|
||||
@Schema(name = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@ApiModelProperty(value = "菜单id")
|
||||
@Schema(name = "菜单id")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -43,50 +43,50 @@ public class SysUser extends BaseEntity {
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "user_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@Schema(name = "主键id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名")
|
||||
@Schema(name = "用户名")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@ApiModelProperty(value = "密码")
|
||||
@Schema(name = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 随机盐
|
||||
*/
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "随机盐")
|
||||
@Schema(name = "随机盐")
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 锁定标记
|
||||
*/
|
||||
@ApiModelProperty(value = "锁定标记")
|
||||
@Schema(name = "锁定标记")
|
||||
private String lockFlag;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ApiModelProperty(value = "手机号")
|
||||
@Schema(name = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@ApiModelProperty(value = "头像地址")
|
||||
@Schema(name = "头像地址")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户所属部门id")
|
||||
@Schema(name = "用户所属部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -37,13 +37,13 @@ public class SysUserPost extends Model<SysUserPost> {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
@Schema(name = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 岗位ID
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位id")
|
||||
@Schema(name = "岗位id")
|
||||
private Long postId;
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.pig4cloud.pig.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -38,13 +38,13 @@ public class SysUserRole extends Model<SysUserRole> {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
@Schema(name = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@ApiModelProperty(value = "角色id")
|
||||
@Schema(name = "角色id")
|
||||
private Long roleId;
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package com.pig4cloud.pig.admin.api.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ import lombok.Data;
|
||||
* @date 2020/2/10
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "前端角色展示对象")
|
||||
@Schema(name = "前端角色展示对象")
|
||||
public class RoleVo {
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-upms</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-upms-biz</artifactId>
|
||||
|
@ -18,7 +18,7 @@ package com.pig4cloud.pig.admin;
|
||||
|
||||
import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients;
|
||||
import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer;
|
||||
import com.pig4cloud.pig.common.swagger.annotation.EnablePigSwagger2;
|
||||
import com.pig4cloud.pig.common.swagger.annotation.EnablePigDoc;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
@ -27,7 +27,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
* @author lengleng
|
||||
* @date 2018年06月21日 用户统一管理系统
|
||||
*/
|
||||
@EnablePigSwagger2
|
||||
@EnablePigDoc
|
||||
@EnablePigResourceServer
|
||||
@EnablePigFeignClients
|
||||
@EnableDiscoveryClient
|
||||
|
@ -7,8 +7,10 @@ import com.pig4cloud.pig.admin.service.AppService;
|
||||
import com.pig4cloud.pig.admin.service.SysUserService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -21,7 +23,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app")
|
||||
@Api(value = "app", tags = "手机管理模块")
|
||||
@Tag(name = "移动端登录模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class AppController {
|
||||
|
||||
private final AppService appService;
|
||||
|
@ -22,8 +22,10 @@ import com.pig4cloud.pig.admin.service.SysDeptService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -41,7 +43,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dept")
|
||||
@Api(value = "dept", tags = "部门管理模块")
|
||||
@Tag(name = "部门管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class DeptController {
|
||||
|
||||
private final SysDeptService sysDeptService;
|
||||
|
@ -26,10 +26,12 @@ import com.pig4cloud.pig.admin.service.SysDictService;
|
||||
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -47,7 +49,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dict")
|
||||
@Api(value = "dict", tags = "字典管理模块")
|
||||
@Tag(name = "字典管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class DictController {
|
||||
|
||||
private final SysDictItemService sysDictItemService;
|
||||
|
@ -26,11 +26,13 @@ import com.pig4cloud.pig.admin.service.SysFileService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -44,9 +46,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @date 2021-09-11
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/sys-file")
|
||||
@Api(value = "sys-file", tags = "文件管理")
|
||||
@Tag(name = "文件管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class FileController {
|
||||
|
||||
private final SysFileService sysFileService;
|
||||
@ -57,7 +60,7 @@ public class FileController {
|
||||
* @param sysFile 文件管理
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R<IPage<SysFile>> getSysFilePage(Page page, SysFile sysFile) {
|
||||
return R.ok(sysFileService.page(page, Wrappers.query(sysFile)));
|
||||
@ -68,7 +71,7 @@ public class FileController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除文件管理", notes = "通过id删除文件管理")
|
||||
@Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理")
|
||||
@SysLog("删除文件管理")
|
||||
@DeleteMapping("/{id:\\d+}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_file_del')")
|
||||
|
@ -23,8 +23,10 @@ import com.pig4cloud.pig.admin.service.SysLogService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -42,7 +44,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/log")
|
||||
@Api(value = "log", tags = "日志管理模块")
|
||||
@Tag(name = "日志管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class LogController {
|
||||
|
||||
private final SysLogService sysLogService;
|
||||
|
@ -22,8 +22,10 @@ import com.pig4cloud.pig.admin.service.SysMenuService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pig.common.security.util.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -40,7 +42,8 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/menu")
|
||||
@Api(value = "menu", tags = "菜单管理模块")
|
||||
@Tag(name = "菜单管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class MenuController {
|
||||
|
||||
private final SysMenuService sysMenuService;
|
||||
|
@ -23,8 +23,10 @@ import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
|
||||
import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -42,7 +44,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/client")
|
||||
@Api(value = "client", tags = "客户端管理模块")
|
||||
@Tag(name = "客户端管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class OauthClientDetailsController {
|
||||
|
||||
private final SysOauthClientDetailsService sysOauthClientDetailsService;
|
||||
|
@ -26,9 +26,11 @@ import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -42,7 +44,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/post")
|
||||
@Api(value = "post", tags = "岗位管理模块")
|
||||
@Tag(name = "岗位管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class PostController {
|
||||
|
||||
private final SysPostService sysPostService;
|
||||
@ -61,7 +64,7 @@ public class PostController {
|
||||
* @param page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('sys_post_get')")
|
||||
public R getSysPostPage(Page page) {
|
||||
@ -73,7 +76,7 @@ public class PostController {
|
||||
* @param postId id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{postId}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_post_get')")
|
||||
public R getById(@PathVariable("postId") Long postId) {
|
||||
@ -85,7 +88,7 @@ public class PostController {
|
||||
* @param sysPost 岗位信息表
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增岗位信息表", notes = "新增岗位信息表")
|
||||
@Operation(summary = "新增岗位信息表", description = "新增岗位信息表")
|
||||
@SysLog("新增岗位信息表")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_post_add')")
|
||||
@ -98,7 +101,7 @@ public class PostController {
|
||||
* @param sysPost 岗位信息表
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改岗位信息表", notes = "修改岗位信息表")
|
||||
@Operation(summary = "修改岗位信息表", description = "修改岗位信息表")
|
||||
@SysLog("修改岗位信息表")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_post_edit')")
|
||||
@ -111,7 +114,7 @@ public class PostController {
|
||||
* @param postId id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除岗位信息表", notes = "通过id删除岗位信息表")
|
||||
@Operation(summary = "通过id删除岗位信息表", description = "通过id删除岗位信息表")
|
||||
@SysLog("通过id删除岗位信息表")
|
||||
@DeleteMapping("/{postId}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_post_del')")
|
||||
|
@ -24,9 +24,11 @@ import com.pig4cloud.pig.admin.service.SysPublicParamService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -37,9 +39,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @date 2019-04-29
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/param")
|
||||
@Api(value = "param", tags = "公共参数配置")
|
||||
@Tag(name = "公共参数配置")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class PublicParamController {
|
||||
|
||||
private final SysPublicParamService sysPublicParamService;
|
||||
@ -50,7 +53,7 @@ public class PublicParamController {
|
||||
* @return
|
||||
*/
|
||||
@Inner(value = false)
|
||||
@ApiOperation(value = "查询公共参数值", notes = "根据key查询公共参数值")
|
||||
@Operation(summary = "查询公共参数值", description = "根据key查询公共参数值")
|
||||
@GetMapping("/publicValue/{publicKey}")
|
||||
public R publicKey(@PathVariable("publicKey") String publicKey) {
|
||||
return R.ok(sysPublicParamService.getSysPublicParamKeyToValue(publicKey));
|
||||
@ -62,7 +65,7 @@ public class PublicParamController {
|
||||
* @param sysPublicParam 公共参数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getSysPublicParamPage(Page page, SysPublicParam sysPublicParam) {
|
||||
return R.ok(sysPublicParamService.page(page, Wrappers.query(sysPublicParam)));
|
||||
@ -73,7 +76,7 @@ public class PublicParamController {
|
||||
* @param publicId id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询公共参数", notes = "通过id查询公共参数")
|
||||
@Operation(summary = "通过id查询公共参数", description = "通过id查询公共参数")
|
||||
@GetMapping("/{publicId}")
|
||||
public R getById(@PathVariable("publicId") Long publicId) {
|
||||
return R.ok(sysPublicParamService.getById(publicId));
|
||||
@ -84,7 +87,7 @@ public class PublicParamController {
|
||||
* @param sysPublicParam 公共参数
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增公共参数", notes = "新增公共参数")
|
||||
@Operation(summary = "新增公共参数", description = "新增公共参数")
|
||||
@SysLog("新增公共参数")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_publicparam_add')")
|
||||
@ -97,7 +100,7 @@ public class PublicParamController {
|
||||
* @param sysPublicParam 公共参数
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改公共参数", notes = "修改公共参数")
|
||||
@Operation(summary = "修改公共参数", description = "修改公共参数")
|
||||
@SysLog("修改公共参数")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_publicparam_edit')")
|
||||
@ -110,7 +113,7 @@ public class PublicParamController {
|
||||
* @param publicId id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "删除公共参数", notes = "删除公共参数")
|
||||
@Operation(summary = "删除公共参数", description = "删除公共参数")
|
||||
@SysLog("删除公共参数")
|
||||
@DeleteMapping("/{publicId}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_publicparam_del')")
|
||||
|
@ -28,8 +28,10 @@ import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -44,7 +46,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/role")
|
||||
@Api(value = "role", tags = "角色管理模块")
|
||||
@Tag(name = "角色管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class RoleController {
|
||||
|
||||
private final SysRoleService sysRoleService;
|
||||
@ -125,7 +128,7 @@ public class RoleController {
|
||||
@PutMapping("/menu")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_perm')")
|
||||
public R<Boolean> saveRoleMenus(@RequestBody RoleVo roleVo) {
|
||||
return R.ok(sysRoleMenuService.saveRoleMenus( roleVo.getRoleId(), roleVo.getMenuIds()));
|
||||
return R.ok(sysRoleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,8 +19,10 @@ package com.pig4cloud.pig.admin.controller;
|
||||
import com.pig4cloud.pig.admin.api.feign.RemoteTokenService;
|
||||
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -33,7 +35,8 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/token")
|
||||
@Api(value = "token", tags = "令牌管理模块")
|
||||
@Tag(name = "令牌管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class TokenController {
|
||||
|
||||
private final RemoteTokenService remoteTokenService;
|
||||
|
@ -33,8 +33,10 @@ import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
import com.pig4cloud.pig.common.security.util.SecurityUtils;
|
||||
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -50,7 +52,8 @@ import java.util.Set;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user")
|
||||
@Api(value = "user", tags = "用户管理模块")
|
||||
@Tag(name = "用户管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class UserController {
|
||||
|
||||
private final SysUserService userService;
|
||||
|
@ -35,6 +35,6 @@ public interface SysRoleMenuService extends IService<SysRoleMenu> {
|
||||
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
|
||||
* @return
|
||||
*/
|
||||
Boolean saveRoleMenus( Long roleId, String menuIds);
|
||||
Boolean saveRoleMenus(Long roleId, String menuIds);
|
||||
|
||||
}
|
||||
|
@ -48,14 +48,13 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
/**
|
||||
* @param role
|
||||
* @param roleId 角色
|
||||
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveRoleMenus( Long roleId, String menuIds) {
|
||||
public Boolean saveRoleMenus(Long roleId, String menuIds) {
|
||||
this.remove(Wrappers.<SysRoleMenu>query().lambda().eq(SysRoleMenu::getRoleId, roleId));
|
||||
|
||||
if (StrUtil.isBlank(menuIds)) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-upms</artifactId>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-visual</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-codegen</artifactId>
|
||||
|
@ -19,6 +19,7 @@ package com.pig4cloud.pig.codegen;
|
||||
import com.pig4cloud.pig.common.datasource.annotation.EnableDynamicDataSource;
|
||||
import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients;
|
||||
import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer;
|
||||
import com.pig4cloud.pig.common.swagger.annotation.EnablePigDoc;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
@ -27,6 +28,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
* @author lengleng
|
||||
* @date 2020/03/11 代码生成模块
|
||||
*/
|
||||
@EnablePigDoc
|
||||
@EnableDynamicDataSource
|
||||
@EnablePigFeignClients
|
||||
@EnableDiscoveryClient
|
||||
|
@ -22,8 +22,10 @@ import com.pig4cloud.pig.codegen.entity.GenDatasourceConf;
|
||||
import com.pig4cloud.pig.codegen.service.GenDatasourceConfService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@ -37,7 +39,8 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dsconf")
|
||||
@Api(value = "dsconf", tags = "数据源管理模块")
|
||||
@Tag(name = "数据源管理模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class GenDsConfController {
|
||||
|
||||
private final GenDatasourceConfService datasourceConfService;
|
||||
|
@ -23,9 +23,11 @@ import com.pig4cloud.pig.codegen.entity.GenFormConf;
|
||||
import com.pig4cloud.pig.codegen.service.GenFormConfService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -38,7 +40,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/form")
|
||||
@Api(value = "form", tags = "表单管理")
|
||||
@Tag(name = "表单管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class GenFormConfController {
|
||||
|
||||
private final GenFormConfService genRecordService;
|
||||
@ -49,7 +52,7 @@ public class GenFormConfController {
|
||||
* @param formConf 生成记录
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R<IPage<GenFormConf>> getGenFormConfPage(Page page, GenFormConf formConf) {
|
||||
return R.ok(genRecordService.page(page, Wrappers.query(formConf)));
|
||||
@ -60,7 +63,7 @@ public class GenFormConfController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
public R<GenFormConf> getById(@PathVariable("id") Integer id) {
|
||||
return R.ok(genRecordService.getById(id));
|
||||
@ -72,7 +75,7 @@ public class GenFormConfController {
|
||||
* @param tableName tableName
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过tableName查询表单信息")
|
||||
@Operation(summary = "通过tableName查询表单信息")
|
||||
@GetMapping("/info")
|
||||
public R<String> form(String dsName, String tableName) {
|
||||
return R.ok(genRecordService.getForm(dsName, tableName));
|
||||
@ -83,7 +86,7 @@ public class GenFormConfController {
|
||||
* @param formConf 生成记录
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增生成记录", notes = "新增生成记录")
|
||||
@Operation(summary = "新增生成记录", description = "新增生成记录")
|
||||
@SysLog("新增生成记录")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('gen_form_add')")
|
||||
@ -96,7 +99,7 @@ public class GenFormConfController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除生成记录", notes = "通过id删除生成记录")
|
||||
@Operation(summary = "通过id删除生成记录", description = "通过id删除生成记录")
|
||||
@SysLog("通过id删除生成记录")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('gen_form_del')")
|
||||
|
@ -22,7 +22,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pig.codegen.entity.GenConfig;
|
||||
import com.pig4cloud.pig.codegen.service.GeneratorService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@ -41,7 +42,8 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/generator")
|
||||
@Api(value = "generator", tags = "代码生成模块")
|
||||
@Tag(name = "代码生成模块")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class GeneratorController {
|
||||
|
||||
private final GeneratorService generatorService;
|
||||
|
@ -20,8 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -33,33 +32,33 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@TableName("gen_form_conf")
|
||||
@Schema(name = "生成记录")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "生成记录")
|
||||
public class GenFormConf extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
@Schema(name = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
@ApiModelProperty(value = "表名称")
|
||||
@Schema(name = "表名称")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 表单信息
|
||||
*/
|
||||
@ApiModelProperty(value = "表单信息")
|
||||
@Schema(name = "表单信息")
|
||||
private String formInfo;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标记")
|
||||
@Schema(name = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,11 @@ import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||
import ${package}.${moduleName}.entity.${className};
|
||||
import ${package}.${moduleName}.service.${className}Service;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@ -39,7 +41,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${pathName}" )
|
||||
@Api(value = "${pathName}", tags = "${comments}管理")
|
||||
@Tag(name = "${comments}管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class ${className}Controller {
|
||||
|
||||
private final ${className}Service ${classname}Service;
|
||||
@ -50,7 +53,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
|
||||
public R get${className}Page(Page page, ${className} ${classname}) {
|
||||
@ -63,7 +66,7 @@ public class ${className}Controller {
|
||||
* @param ${pk.lowerAttrName} id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{${pk.lowerAttrName}}" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
|
||||
public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
|
||||
@ -75,7 +78,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增${comments}", notes = "新增${comments}")
|
||||
@Operation(summary = "新增${comments}", description = "新增${comments}")
|
||||
@SysLog("新增${comments}" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" )
|
||||
@ -88,7 +91,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改${comments}", notes = "修改${comments}")
|
||||
@Operation(summary = "修改${comments}", description = "修改${comments}")
|
||||
@SysLog("修改${comments}" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" )
|
||||
@ -101,7 +104,7 @@ public class ${className}Controller {
|
||||
* @param ${pk.lowerAttrName} id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除${comments}", notes = "通过id删除${comments}")
|
||||
@Operation(summary = "通过id删除${comments}", description = "通过id删除${comments}")
|
||||
@SysLog("通过id删除${comments}" )
|
||||
@DeleteMapping("/{${pk.lowerAttrName}}" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" )
|
||||
|
@ -21,8 +21,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
#if(${hasBigDecimal})
|
||||
@ -38,7 +37,7 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "${comments}")
|
||||
@Schema(name = "${comments}")
|
||||
public class ${className} extends BaseEntity {
|
||||
|
||||
#foreach ($column in $columns)
|
||||
@ -50,7 +49,7 @@ public class ${className} extends BaseEntity {
|
||||
#if($column.columnName == $pk.columnName)
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
#end
|
||||
@ApiModelProperty(value="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
@Schema(name="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
private $column.attrType $column.lowerAttrName;
|
||||
|
||||
#end
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-visual</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-monitor</artifactId>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-visual</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-sentinel-dashboard</artifactId>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig-visual</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-xxl-job-admin</artifactId>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pig</artifactId>
|
||||
<version>3.4.7</version>
|
||||
<version>3.4.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pig-visual</artifactId>
|
||||
|
Loading…
Reference in New Issue
Block a user