Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	db/pig.sql
#	db/pig_config.sql
This commit is contained in:
付绪壮 2022-03-30 09:30:33 +08:00
commit e1b5ec9268
85 changed files with 1217 additions and 1308 deletions

View File

@ -54,6 +54,7 @@ pig
├── pig-common-job -- xxl-job 封装
├── pig-common-log -- 日志服务
├── pig-common-mybatis -- mybatis 扩展封装
├── pig-common-seata -- 分布式事务
├── pig-common-security -- 安全工具类
├── pig-common-swagger -- 接口文档
├── pig-common-feign -- feign 扩展封装

View File

@ -178,15 +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 (9, '注册用户默认角色', 'REGISTER_DEFAULT_ROLE', 'GENERAL_USER', '0', '', 'admin', 'admin', '2022-03-29 13:46:09', '2022-03-29 11:50:59', '2', '1');
INSERT INTO `sys_public_param` VALUES (1, '接口文档不显示的字段', 'GEN_HIDDEN_COLUMNS', 'tenant_id', '0', '', ' ', ' ', '2020-05-12 04:25:19', NULL, '9', '1');
COMMIT;
@ -436,7 +428,6 @@ CREATE TABLE `sys_role` (
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES (1, '管理员', 'ROLE_ADMIN', '管理员', '0', '2017-10-29 15:45:51', '2018-12-26 14:09:11', NULL, NULL);
INSERT INTO `sys_role` VALUES (2, '普通用户', 'GENERAL_USER', '普通用户', '0', '2022-03-29 19:45:56', '2022-03-29 19:45:56', 'admin', 'admin');
COMMIT;
-- ----------------------------
@ -511,8 +502,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 3303);
INSERT INTO `sys_role_menu` VALUES (1, 3400);
INSERT INTO `sys_role_menu` VALUES (1, 4000);
INSERT INTO `sys_role_menu` VALUES (1, 9999);
INSERT INTO `sys_role_menu` VALUES (2, 4000);
INSERT INTO `sys_role_menu` VALUES (2, 9999);
COMMIT;
-- ----------------------------

View File

@ -36,10 +36,10 @@ CREATE TABLE `config_info` (
-- Records of config_info
-- ----------------------------
BEGIN;
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 加解密根密码\njasypt:\n encryptor:\n password: pig #根密码\n\n# Spring 相关\n\nspring:\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n configuration:\n map-underscore-to-camel-case: true\n\n# spring security 配置\nsecurity:\n oauth2:\n resource:\n loadBalanced: true\n token-info-uri: http://pig-auth/oauth/check_token\n # 通用放行URL服务个性化请在对应配置文件覆盖\n ignore:\n urls:\n - /v2/api-docs\n - /actuator/**\n# - /user/registerUser\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n license: Powered By pig4cloud\n licenseUrl: https://pig4cloud.com\n terms-of-service-url: https://pig4cloud.com\n contact:\n email: wangiegie@gmail.com\n url: https://pig4cloud.com\n authorization:\n name: pig4cloud OAuth\n auth-regex: ^.*$\n authorization-scope-list:\n - scope: server\n description: server all\n token-url-list:\n - http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}/auth/oauth/token', 'e9998245e4edea8eab9713df40639d45', '2019-11-29 16:31:20', '2022-03-20 21:16:50', 'nacos', '127.0.0.1', '', '', '通用配置', 'null', 'null', 'yaml', 'null');
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 加解密根密码\njasypt:\n encryptor:\n password: pig #根密码\n\n# Spring 相关\n\nspring:\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n configuration:\n map-underscore-to-camel-case: true\n\n# spring security 配置\nsecurity:\n oauth2:\n resource:\n loadBalanced: true\n token-info-uri: http://pig-auth/oauth/check_token\n # 通用放行URL服务个性化请在对应配置文件覆盖\n ignore:\n urls:\n - /v3/api-docs\n - /v2/api-docs\n - /actuator/**\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}\n token-url: ${swagger.gateway}/auth/oauth/token\n services:\n pig-upms-biz: admin\n pig-codegen: gen', 'fe841b616618e0d7dfdfbb78ff08dc93', '2019-11-29 16:31:20', '2022-03-27 23:19:22', '', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (2, 'pig-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', '58b1b48a2888f49e667864be32edf9c1', '2019-11-29 16:31:48', '2020-01-01 18:30:58', NULL, '127.0.0.1', '', '', '认证中心配置', 'null', 'null', 'yaml', 'null');
INSERT INTO `config_info` VALUES (3, 'pig-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置\nsecurity:\n oauth2:\n client:\n client-id: ENC(27v1agvAug87ANOVnbKdsw==)\n client-secret: ENC(VbnkopxrwgbFVKp+UxJ2pg==)\n scope: server\n\n# 数据源配置\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\n# 直接放行URL\nignore:\n urls:\n - /v2/api-docs\n - /actuator/**\n', 'abc702838b34d11b46e96143ccd9f367', '2019-11-29 16:32:12', '2019-11-29 16:32:12', NULL, '127.0.0.1', '', '', '代码生成配置', NULL, NULL, 'yaml', NULL);
INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test\n\nswagger:\n ignore-providers:\n - pig-auth\n - pig-codegen\n', '5cd71b235930c78e700819b944a14446', '2019-11-29 16:32:42', '2020-10-09 17:10:45', NULL, '0:0:0:0:0:0:0:1', '', '', '网关配置', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n # demo模块\n - id: pig-demo\n uri: lb://demo-biz\n predicates:\n - Path=/demo/**\n - id: openapi\n uri: http://localhost:${server.port}\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?<path>.*), /$\\{path}/v3/api-docs\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test', 'dbf00e83f80de7f011d244ea1ce5686e', '2019-11-29 16:32:42', '2022-03-27 23:19:33', '', '0:0:0:0:0:0:0:1', '', '', '网关配置', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (5, 'pig-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n autoconfigure:\n exclude: com.pig4cloud.pig.common.core.config.JacksonConfiguration\n # 安全配置\n security:\n user:\n name: ENC(8Hk2ILNJM8UTOuW/Xi75qg==) # pig\n password: ENC(o6cuPFfUevmTbkmBnE67Ow====) # pig\n', '650bdfa15f60f3faa84dfe6e6878b8cf', '2019-11-29 16:33:05', '2022-03-22 17:50:52', 'nacos', '127.0.0.1', '', '', '监控配置', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (6, 'pig-upms-biz-dev.yml', 'DEFAULT_GROUP', 'security:\n oauth2:\n client:\n client-id: ENC(imENTO7M8bLO38LFSIxnzw==)\n client-secret: ENC(i3cDFhs26sa2Ucrfz2hnQw==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n\n# 文件上传相关 支持阿里云、华为云、腾讯、minio\noss:\n endpoint: http://minio.pig4cloud.com\n accessKey: lengleng\n secretKey: lengleng\n bucket-name: tmp', '5041ac486e18aa0dd0bf624bb83806de', '2019-11-29 16:52:32', '2021-09-11 14:19:55', '', '127.0.0.1', '', '', '统一权限', 'null', 'null', 'yaml', 'null');
COMMIT;

View File

@ -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>

View File

@ -1,180 +1,203 @@
<?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>
<seata.version>1.4.2</seata.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-seata</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>
<!-- seata kryo 序列化-->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-kryo</artifactId>
<version>${seata.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>

View File

@ -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>

View File

@ -0,0 +1,44 @@
package com.pig4cloud.pig.common.core.factory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.lang.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
* @author lengleng
* @date 2022/3/29
*
* 读取自定义 yaml 文件工厂类
*/
public class YamlPropertySourceFactory implements PropertySourceFactory {
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
String sourceName = name != null ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
}
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
try {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
factory.afterPropertiesSet();
return factory.getObject();
}
catch (IllegalStateException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException)
throw (FileNotFoundException) e.getCause();
throw e;
}
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /*
~ * Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
~ * <p>
~ * Licensed under the GNU Lesser General Public License 3.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ * <p>
~ * https://www.gnu.org/licenses/lgpl.html
~ * <p>
~ * 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.
~ */
-->
<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.8</version>
</parent>
<artifactId>pig-common-seata</artifactId>
<packaging>jar</packaging>
<description>pig 分布式事务处理模块</description>
<dependencies>
<!--核心依赖-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
</dependency>
<!-- seata-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
</dependency>
<!-- seata kryo 序列化-->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-serializer-kryo</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,19 @@
package com.pig4cloud.pig.common.seata.config;
import com.pig4cloud.pig.common.core.factory.YamlPropertySourceFactory;
import io.seata.spring.annotation.datasource.EnableAutoDataSourceProxy;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* Seata 配置类
*
* @author lengleng
* @date 2022/3/29
*/
@PropertySource(value = "classpath:seata-config.yml", factory = YamlPropertySourceFactory.class)
@EnableAutoDataSourceProxy
@Configuration(proxyBeanMethods = false)
public class SeataAutoConfiguration {
}

View File

@ -0,0 +1,177 @@
/**
* @author lengleng
* @date 2022/3/29
*/
package io.seata.spring.util;
import io.seata.common.util.CollectionUtils;
import io.seata.rm.tcc.remoting.parser.DubboUtil;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AdvisedSupport;
import org.springframework.aop.support.AopUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* Proxy tools base on spring 主要解决 v1.4.2 兼容性问题 https://github.com/seata/seata/issues/3709
*
* @author zhangsen
*/
public class SpringProxyUtils {
private SpringProxyUtils() {
}
/**
* Find target class class.
* @param proxy the proxy
* @return the class
* @throws Exception the exception
*/
public static Class<?> findTargetClass(Object proxy) throws Exception {
if (proxy == null) {
return null;
}
if (AopUtils.isAopProxy(proxy) && proxy instanceof Advised) {
// #issue 3709
final TargetSource targetSource = ((Advised) proxy).getTargetSource();
if (!targetSource.isStatic()) {
return targetSource.getTargetClass();
}
return findTargetClass(targetSource.getTarget());
}
return proxy.getClass();
}
public static Class<?>[] findInterfaces(Object proxy) throws Exception {
if (AopUtils.isJdkDynamicProxy(proxy)) {
AdvisedSupport advised = getAdvisedSupport(proxy);
return getInterfacesByAdvised(advised);
}
else {
return new Class<?>[] {};
}
}
private static Class<?>[] getInterfacesByAdvised(AdvisedSupport advised) {
Class<?>[] interfaces = advised.getProxiedInterfaces();
if (interfaces.length > 0) {
return interfaces;
}
else {
throw new IllegalStateException("Find the jdk dynamic proxy class that does not implement the interface");
}
}
/**
* Gets advised support.
* @param proxy the proxy
* @return the advised support
* @throws Exception the exception
*/
public static AdvisedSupport getAdvisedSupport(Object proxy) throws Exception {
Field h;
if (AopUtils.isJdkDynamicProxy(proxy)) {
h = proxy.getClass().getSuperclass().getDeclaredField("h");
}
else {
h = proxy.getClass().getDeclaredField("CGLIB$CALLBACK_0");
}
h.setAccessible(true);
Object dynamicAdvisedInterceptor = h.get(proxy);
Field advised = dynamicAdvisedInterceptor.getClass().getDeclaredField("advised");
advised.setAccessible(true);
return (AdvisedSupport) advised.get(dynamicAdvisedInterceptor);
}
/**
* Is proxy boolean.
* @param bean the bean
* @return the boolean
*/
public static boolean isProxy(Object bean) {
if (bean == null) {
return false;
}
// check dubbo proxy ?
return DubboUtil.isDubboProxyName(bean.getClass().getName())
|| (Proxy.class.isAssignableFrom(bean.getClass()) || AopUtils.isAopProxy(bean));
}
/**
* Get the target class , get the interface of its agent if it is a Proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
public static Class<?> getTargetInterface(Object proxy) throws Exception {
if (proxy == null) {
throw new java.lang.IllegalArgumentException("proxy can not be null");
}
// jdk proxy
if (Proxy.class.isAssignableFrom(proxy.getClass())) {
Proxy p = (Proxy) proxy;
return p.getClass().getInterfaces()[0];
}
return getTargetClass(proxy);
}
/**
* Get the class type of the proxy target object, if hadn't a target object, return
* the interface of the proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
protected static Class<?> getTargetClass(Object proxy) throws Exception {
if (proxy == null) {
throw new java.lang.IllegalArgumentException("proxy can not be null");
}
// not proxy
if (!AopUtils.isAopProxy(proxy)) {
return proxy.getClass();
}
AdvisedSupport advisedSupport = getAdvisedSupport(proxy);
Object target = advisedSupport.getTargetSource().getTarget();
/*
* the Proxy of sofa:reference has no target
*/
if (target == null) {
if (CollectionUtils.isNotEmpty(advisedSupport.getProxiedInterfaces())) {
return advisedSupport.getProxiedInterfaces()[0];
}
else {
return proxy.getClass();
}
}
else {
return getTargetClass(target);
}
}
/**
* get the all interfaces of bean, if the bean is null, then return empty array
* @param bean the bean
* @return target interface
*/
public static Class<?>[] getAllInterfaces(Object bean) {
Set<Class<?>> interfaces = new HashSet<>();
if (bean != null) {
Class<?> clazz = bean.getClass();
while (!Object.class.getName().equalsIgnoreCase(clazz.getName())) {
Class<?>[] clazzInterfaces = clazz.getInterfaces();
interfaces.addAll(Arrays.asList(clazzInterfaces));
clazz = clazz.getSuperclass();
}
}
return interfaces.toArray(new Class[0]);
}
}

View File

@ -0,0 +1,5 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.pig4cloud.pig.common.seata.config.SeataAutoConfiguration

View File

@ -0,0 +1,56 @@
seata:
enabled: true
tx-service-group: pig_tx_group # 事务群组(可以每个应用独立取名,也可以使用相同的名字)
client:
rm-report-success-enable: true
rm-table-meta-check-enable: false # 自动刷新缓存中的表结构默认false
rm-report-retry-count: 5 # 一阶段结果上报TC重试次数默认5
rm-async-commit-buffer-limit: 10000 # 异步提交缓存队列长度默认10000
rm:
lock:
lock-retry-internal: 10 # 校验或占用全局锁重试间隔默认10ms
lock-retry-times: 30 # 校验或占用全局锁重试次数默认30
lock-retry-policy-branch-rollback-on-conflict: true # 分支事务与其它全局回滚事务冲突时锁策略(优先释放本地锁让回滚成功)
tm-commit-retry-count: 3 # 一阶段全局提交结果上报TC重试次数默认1次建议大于1
tm-rollback-retry-count: 3 # 一阶段全局回滚结果上报TC重试次数默认1次建议大于1
undo:
undo-data-validation: true # 二阶段回滚镜像校验默认true开启
undo-log-serialization: kryo # undo序列化方式默认jackson 不支持 LocalDateTime
undo-log-table: undo_log # 自定义undo表名默认undo_log
log:
exceptionRate: 100 # 日志异常输出概率默认100
support:
spring:
datasource-autoproxy: true
service:
vgroup-mapping:
pig_tx_group: default # TC 集群必须与seata-server保持一致
enable-degrade: false # 降级开关
disable-global-transaction: false # 禁用全局事务默认false
grouplist:
default: pig-seata:8091
transport:
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
server-executor-thread-prefix: NettyServerBizHandler
share-boss-worker: false
client-selector-thread-prefix: NettyClientSelector
client-selector-thread-size: 1
client-worker-thread-prefix: NettyClientWorkerThread
type: TCP
server: NIO
heartbeat: true
serialization: seata
compressor: none
enable-client-batch-send-request: true # 客户端事务消息请求是否批量合并发送默认true
registry:
file:
name: file.conf
type: file
config:
file:
name: file.conf
type: file

View File

@ -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>

View File

@ -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>

View File

@ -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 {
}

View File

@ -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());
}
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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()));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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>

View File

@ -16,29 +16,30 @@
-->
<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-common</artifactId>
<packaging>pom</packaging>
<artifactId>pig-common</artifactId>
<packaging>pom</packaging>
<description>pig 公共聚合模块</description>
<description>pig 公共聚合模块</description>
<modules>
<module>pig-common-bom</module>
<module>pig-common-core</module>
<module>pig-common-datasource</module>
<module>pig-common-job</module>
<module>pig-common-log</module>
<module>pig-common-mybatis</module>
<module>pig-common-security</module>
<module>pig-common-feign</module>
<module>pig-common-swagger</module>
<module>pig-common-test</module>
<modules>
<module>pig-common-bom</module>
<module>pig-common-core</module>
<module>pig-common-datasource</module>
<module>pig-common-job</module>
<module>pig-common-log</module>
<module>pig-common-mybatis</module>
<module>pig-common-seata</module>
<module>pig-common-security</module>
<module>pig-common-feign</module>
<module>pig-common-swagger</module>
<module>pig-common-test</module>
</modules>
</project>

View File

@ -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>

View File

@ -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 {

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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;
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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;
}

View File

@ -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;
/**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
/**

View File

@ -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;
/**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
/**

View File

@ -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;
}

View File

@ -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;
/**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 {
/**

View File

@ -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>

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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')")

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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')")

View File

@ -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')")

View File

@ -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()));
}
/**

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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)) {

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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;

View File

@ -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')")

View File

@ -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;

View File

@ -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;
}

View File

@ -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')" )

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -22,7 +22,7 @@
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<name>${project.artifactId}</name>
<version>3.4.7</version>
<version>3.4.8</version>
<packaging>pom</packaging>
<url>https://www.pig4cloud.com</url>