添加公共stater和gateway服务

This commit is contained in:
朱毅骏 2022-08-18 18:52:02 +08:00
parent 3ec6015300
commit 85a6e2a486
36 changed files with 1596 additions and 117 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50732 Target Server Version : 50732
File Encoding : 65001 File Encoding : 65001
Date: 17/08/2022 18:13:57 Date: 18/08/2022 18:47:33
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
@ -40,14 +40,16 @@ CREATE TABLE `config_info` (
`c_schema` text CHARACTER SET utf8 COLLATE utf8_bin NULL, `c_schema` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_configinfo_datagrouptenant`(`data_id`, `group_id`, `tenant_id`) USING BTREE UNIQUE INDEX `uk_configinfo_datagrouptenant`(`data_id`, `group_id`, `tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_info' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = 'config_info' ROW_FORMAT = Dynamic;
-- ---------------------------- -- ----------------------------
-- Records of config_info -- Records of config_info
-- ---------------------------- -- ----------------------------
INSERT INTO `config_info` VALUES (9, 'zyjblogs-oauth-test.yml', 'public', 'server:\n port: 9029\nspring:\n devtools:\n add-properties: true\n application:\n name: zyjblogs-oauth\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n\n redis:\n host: 127.0.0.1\n port: 6379\n password: \n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n # sentinel:\n # master: ${hatech.global.redis.sentinel.master}\n # nodes: ${hatech.global.redis.sentinel.nodes}\n # password: ${hatech.global.redis.sentinel.password}\nmybatis-plus:\n mapper-locations: classpath:mapper/**/*.xml\n global-config:\n db-config:\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\n id-type: assign_id\n configuration:\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\n map-underscore-to-camel-case: true\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\n call-setters-on-nulls: false\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 6000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\n\nmanagement:\n health:\n ldap:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always', '713b49c57ee2be922797bfca5df170fb', '2022-08-17 17:35:05', '2022-08-17 17:57:11', 'nacos', '127.0.0.1', '', 'test', '', '', '', 'yaml', ''); INSERT INTO `config_info` VALUES (9, 'zyjblogs-oauth-test.yml', 'public', 'server:\n port: 9029\nspring:\n devtools:\n add-properties: true\n application:\n name: zyjblogs-oauth\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\n\n redis:\n host: 127.0.0.1\n port: 6379\n password: \n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n # sentinel:\n # master: ${hatech.global.redis.sentinel.master}\n # nodes: ${hatech.global.redis.sentinel.nodes}\n # password: ${hatech.global.redis.sentinel.password}\nmybatis-plus:\n mapper-locations: classpath:mapper/**/*.xml\n global-config:\n db-config:\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\n id-type: assign_id\n configuration:\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\n map-underscore-to-camel-case: true\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\n call-setters-on-nulls: false\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 6000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\n\nmanagement:\n health:\n ldap:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always', '713b49c57ee2be922797bfca5df170fb', '2022-08-17 17:35:05', '2022-08-17 17:57:11', 'nacos', '127.0.0.1', '', 'test', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (10, 'zyjblogs-global-test.yml', 'global', 'none', '334c4a4c42fdb79d7ebc3e73b517e6f8', '2022-08-17 17:35:39', '2022-08-17 17:35:39', 'nacos', '127.0.0.1', '', 'test', NULL, NULL, NULL, 'text', NULL); INSERT INTO `config_info` VALUES (10, 'zyjblogs-global-test.yml', 'global', 'zyjblogs:\n global:\n database:\n host: 127.0.0.1\n port: 3006\n username: root\n password: 123456!@#\n\n redis:\n host: 127.0.0.1\n port: 6379\n password: \n sentinel:\n master: mymaster\n nodes: 10.1.110.71:30029,10.1.110.72:30029,10.1.110.73:30029\n password: Redis_IStorM_1618\n \n sentinel:\n transport:\n port: 8179\n dashboard:\n host: 127.0.0.1\n port: 20000\n\n rabbitmq:\n host: 127.0.0.1\n port: 30110\n username: admin\n password: admin\n minio:\n accessKey: minioadmin\n endpoint: http://10.1.110.70:30120/\n secretKey: Minio_IStorM_1618\n xxl:\n job:\n admin:\n addresses: http://10.1.110.71:10090/xxl-job-admin\n accessToken: cee8d3f4791411eca519005056b38058\n executor:\n logretentiondays: 7\n ', '5971eba0ff27324509b98209371e2e1f', '2022-08-17 17:35:39', '2022-08-18 09:33:28', 'nacos', '127.0.0.1', '', 'test', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (12, 'zyjblogs-rbac-test.yml', 'public', 'server:\r\n port: 9039\r\nspring:\r\n devtools:\r\n add-properties: true\r\n application:\r\n name: zyjblogs-rbac\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', 'bfd132739c919b446e0256345adad019', '2022-08-17 17:48:38', '2022-08-17 17:48:38', 'nacos', '127.0.0.1', '', 'test', NULL, NULL, NULL, 'yaml', NULL); INSERT INTO `config_info` VALUES (12, 'zyjblogs-rbac-test.yml', 'public', 'server:\r\n port: 9039\r\nspring:\r\n devtools:\r\n add-properties: true\r\n application:\r\n name: zyjblogs-rbac\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', 'bfd132739c919b446e0256345adad019', '2022-08-17 17:48:38', '2022-08-17 17:48:38', 'nacos', '127.0.0.1', '', 'test', NULL, NULL, NULL, 'yaml', NULL);
INSERT INTO `config_info` VALUES (14, 'zyjblogs-gateway-test.yml', 'public', '#通常情况下只需要改config配置\nzyjblogs:\n config:\n server-port: 9019\n whilelist:\n allowPaths:\n - /v2/api-docs/**\n - /oauth/token\n - /oauth/check_token\n - /user/login\n\nserver:\n port: ${zyjblogs.config.server-port}\nspring:\n main:\n allow-bean-definition-overriding: true\n servlet:\n multipart:\n enabled: true\n max-file-size: 20MB\n max-request-size: 100MB\n redis:\n host: ${zyjblogs.global.redis.host}\n port: ${zyjblogs.global.redis.port}\n password: ${zyjblogs.global.redis.password}\n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n\n cloud:\n sentinel:\n datasource:\n ds1:\n nacos:\n username: ${spring.cloud.nacos.config.username}\n password: ${spring.cloud.nacos.config.password}\n namespace: ${spring.cloud.nacos.config.namespace}\n server-addr: ${spring.cloud.nacos.config.server-addr}\n group-id: SENTINEL_GROUP\n rule-type: flow\n data-id: ${spring.application.name}-sentinel\n data-type: json\n transport:\n port: ${zyjblogs.global.sentinel.transport.port}\n dashboard: ${zyjblogs.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\n gateway:\n httpclient:\n websocket:\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\n max-frame-payload-length: 0x7fffffff\n discovery:\n locator:\n enabled: true\n routes:\n - id: zyjblogs-oauth\n uri: lb://zyjblogs-oauth\n predicates:\n - Path=/api/oauth/**\n filters:\n - StripPrefix=2\n - id: zyjblogs-rbac\n uri: lb://zyjblogs-rbac\n predicates:\n - Path=/api/rbac/**\n filters:\n - StripPrefix=2\n\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 90000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always\n', 'de451d96d9134835784db63cfc88734c', '2022-08-18 09:26:44', '2022-08-18 10:22:05', 'nacos', '127.0.0.1', '', 'test', '', '', '', 'yaml', '');
INSERT INTO `config_info` VALUES (18, 'zyjblogs-gateway-sentinel', 'DEFAULT_GROUP', '[\r\n]', 'fdaf133263369980df600fd06ce738ec', '2022-08-18 09:45:59', '2022-08-18 09:45:59', NULL, '127.0.0.1', '', 'test', NULL, NULL, NULL, 'json', NULL);
-- ---------------------------- -- ----------------------------
-- Table structure for config_info_aggr -- Table structure for config_info_aggr
@ -186,7 +188,7 @@ CREATE TABLE `his_config_info` (
INDEX `idx_gmt_create`(`gmt_create`) USING BTREE, INDEX `idx_gmt_create`(`gmt_create`) USING BTREE,
INDEX `idx_gmt_modified`(`gmt_modified`) USING BTREE, INDEX `idx_gmt_modified`(`gmt_modified`) USING BTREE,
INDEX `idx_did`(`data_id`) USING BTREE INDEX `idx_did`(`data_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '多租户改造' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '多租户改造' ROW_FORMAT = Dynamic;
-- ---------------------------- -- ----------------------------
-- Records of his_config_info -- Records of his_config_info
@ -196,6 +198,14 @@ INSERT INTO `his_config_info` VALUES (0, 14, 'zyjblogs-global-test.yml', 'global
INSERT INTO `his_config_info` VALUES (9, 15, 'zyjblogs-oauth-test.yml', 'public', '', 'server:\r\n port: 9029\r\nspring:\r\n application:\r\n name: zyjblogs-oauth\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', '9e77325d3793a367542452cb4aa3610e', '2022-08-17 17:44:16', '2022-08-17 17:44:17', 'nacos', '127.0.0.1', 'U', 'test'); INSERT INTO `his_config_info` VALUES (9, 15, 'zyjblogs-oauth-test.yml', 'public', '', 'server:\r\n port: 9029\r\nspring:\r\n application:\r\n name: zyjblogs-oauth\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', '9e77325d3793a367542452cb4aa3610e', '2022-08-17 17:44:16', '2022-08-17 17:44:17', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (0, 16, 'zyjblogs-rbac-test.yml', 'public', '', 'server:\r\n port: 9039\r\nspring:\r\n devtools:\r\n add-properties: true\r\n application:\r\n name: zyjblogs-rbac\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', 'bfd132739c919b446e0256345adad019', '2022-08-17 17:48:37', '2022-08-17 17:48:38', 'nacos', '127.0.0.1', 'I', 'test'); INSERT INTO `his_config_info` VALUES (0, 16, 'zyjblogs-rbac-test.yml', 'public', '', 'server:\r\n port: 9039\r\nspring:\r\n devtools:\r\n add-properties: true\r\n application:\r\n name: zyjblogs-rbac\r\n datasource:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\r\n username: root\r\n password: 123456\r\nmybatis-plus:\r\n mapper-locations: classpath:mapper/**/*.xml\r\n global-config:\r\n db-config:\r\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\r\n id-type: assign_id\r\n configuration:\r\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\r\n map-underscore-to-camel-case: true\r\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\r\n call-setters-on-nulls: false\r\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\r\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 6000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\n\r\nmanagement:\r\n health:\r\n ldap:\r\n enabled: false\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always', 'bfd132739c919b446e0256345adad019', '2022-08-17 17:48:37', '2022-08-17 17:48:38', 'nacos', '127.0.0.1', 'I', 'test');
INSERT INTO `his_config_info` VALUES (9, 17, 'zyjblogs-oauth-test.yml', 'public', '', 'server:\n port: 9029\nspring:\n devtools:\n add-properties: true\n application:\n name: zyjblogs-oauth\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\nmybatis-plus:\n mapper-locations: classpath:mapper/**/*.xml\n global-config:\n db-config:\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\n id-type: assign_id\n configuration:\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\n map-underscore-to-camel-case: true\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\n call-setters-on-nulls: false\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 6000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\n\nmanagement:\n health:\n ldap:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always', '1927b9538ce0dec948d93fce91d46295', '2022-08-17 17:57:11', '2022-08-17 17:57:11', 'nacos', '127.0.0.1', 'U', 'test'); INSERT INTO `his_config_info` VALUES (9, 17, 'zyjblogs-oauth-test.yml', 'public', '', 'server:\n port: 9029\nspring:\n devtools:\n add-properties: true\n application:\n name: zyjblogs-oauth\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://127.0.0.1:3306/zyjblogs_rbac?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8\n username: root\n password: 123456\nmybatis-plus:\n mapper-locations: classpath:mapper/**/*.xml\n global-config:\n db-config:\n #主键策略assign_id(雪花算法)、assign_uuid去下划线的UUID\n id-type: assign_id\n configuration:\n # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射\n map-underscore-to-camel-case: true\n # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段\n call-setters-on-nulls: false\n # 这个配置会将执行的sql打印出来在开发或测试的时候可以用\n # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 6000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 1 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\n\nmanagement:\n health:\n ldap:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always', '1927b9538ce0dec948d93fce91d46295', '2022-08-17 17:57:11', '2022-08-17 17:57:11', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (0, 18, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\r\nhatech:\r\n config:\r\n server-port: 10010\r\n whilelist:\r\n allowPaths:\r\n - /v2/api-docs/**\r\n - /oauth/token\r\n - /user/login\r\n - /license/import\r\n - /role/dev/all\r\n - /home/page/cluster/config\r\n - /application/backup/edit/**\r\n - /home/page/cluster/config/info\r\n - /word/socket\r\n - /application/backup/call/hook/*\r\n - /quota/pageAll\r\n - /quota/pageById\r\n - /alertManager/**\r\n - /user/list/user-group-tree\r\n - /oauth/authorize\r\n - /oauth/getToken\r\n - /oauth/getUserInfo\r\n\r\nserver:\r\n port: ${hatech.config.server-port}\r\nspring:\r\n main:\r\n allow-bean-definition-overriding: true\r\n servlet:\r\n multipart:\r\n enabled: true\r\n max-file-size: 20MB\r\n max-request-size: 100MB\r\n redis:\r\n host: ${hatech.global.redis.host}\r\n port: ${hatech.global.redis.port}\r\n password: ${hatech.global.redis.password}\r\n timeout: 10000 #连接超时时间(毫秒)\r\n lettuce:\r\n pool:\r\n max-active: 8 # 连接池最大连接数\r\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\r\n min-idle: 0 # 连接池中的最小空闲连接\r\n max-idle: 8 # 连接池中的最大空闲连接\r\n sentinel:\r\n master: ${hatech.global.redis.sentinel.master}\r\n nodes: ${hatech.global.redis.sentinel.nodes}\r\n password: ${hatech.global.redis.sentinel.password}\r\n cloud:\r\n alibaba:\r\n seata:\r\n # 配置分布式事务的分组名称\r\n tx-service-group: hatech-seata-tx-service-group\r\n sentinel:\r\n datasource:\r\n ds1:\r\n nacos:\r\n username: ${spring.cloud.nacos.config.username}\r\n password: ${spring.cloud.nacos.config.password}\r\n namespace: ${spring.cloud.nacos.config.namespace}\r\n server-addr: ${spring.cloud.nacos.config.server-addr}\r\n group-id: SENTINEL_GROUP\r\n rule-type: flow\r\n data-id: ${spring.application.name}-sentinel\r\n data-type: json\r\n transport:\r\n port: ${hatech.global.sentinel.transport.port}\r\n dashboard: ${hatech.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\r\n gateway:\r\n httpclient:\r\n websocket:\r\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\r\n max-frame-payload-length: 0x7fffffff\r\n discovery:\r\n locator:\r\n enabled: false\r\n routes:\r\n - id: zyjblogs-oauth\r\n uri: lb://zyjblogs-oauth\r\n predicates:\r\n - Path=/api/oauth/**\r\n filters:\r\n - StripPrefix=2\r\n - id: zyjblogs-rbac\r\n uri: lb://zyjblogs-rbac\r\n predicates:\r\n - Path=/api/rbac/**\r\n filters:\r\n - StripPrefix=2\r\n\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 90000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\nmanagement:\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always\r\n', '8e07052c2a26fcbc9f96a56babbb3daa', '2022-08-18 09:26:43', '2022-08-18 09:26:44', NULL, '127.0.0.1', 'I', 'test');
INSERT INTO `his_config_info` VALUES (14, 19, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\r\nhatech:\r\n config:\r\n server-port: 10010\r\n whilelist:\r\n allowPaths:\r\n - /v2/api-docs/**\r\n - /oauth/token\r\n - /user/login\r\n - /license/import\r\n - /role/dev/all\r\n - /home/page/cluster/config\r\n - /application/backup/edit/**\r\n - /home/page/cluster/config/info\r\n - /word/socket\r\n - /application/backup/call/hook/*\r\n - /quota/pageAll\r\n - /quota/pageById\r\n - /alertManager/**\r\n - /user/list/user-group-tree\r\n - /oauth/authorize\r\n - /oauth/getToken\r\n - /oauth/getUserInfo\r\n\r\nserver:\r\n port: ${hatech.config.server-port}\r\nspring:\r\n main:\r\n allow-bean-definition-overriding: true\r\n servlet:\r\n multipart:\r\n enabled: true\r\n max-file-size: 20MB\r\n max-request-size: 100MB\r\n redis:\r\n host: ${hatech.global.redis.host}\r\n port: ${hatech.global.redis.port}\r\n password: ${hatech.global.redis.password}\r\n timeout: 10000 #连接超时时间(毫秒)\r\n lettuce:\r\n pool:\r\n max-active: 8 # 连接池最大连接数\r\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\r\n min-idle: 0 # 连接池中的最小空闲连接\r\n max-idle: 8 # 连接池中的最大空闲连接\r\n sentinel:\r\n master: ${hatech.global.redis.sentinel.master}\r\n nodes: ${hatech.global.redis.sentinel.nodes}\r\n password: ${hatech.global.redis.sentinel.password}\r\n cloud:\r\n alibaba:\r\n seata:\r\n # 配置分布式事务的分组名称\r\n tx-service-group: hatech-seata-tx-service-group\r\n sentinel:\r\n datasource:\r\n ds1:\r\n nacos:\r\n username: ${spring.cloud.nacos.config.username}\r\n password: ${spring.cloud.nacos.config.password}\r\n namespace: ${spring.cloud.nacos.config.namespace}\r\n server-addr: ${spring.cloud.nacos.config.server-addr}\r\n group-id: SENTINEL_GROUP\r\n rule-type: flow\r\n data-id: ${spring.application.name}-sentinel\r\n data-type: json\r\n transport:\r\n port: ${hatech.global.sentinel.transport.port}\r\n dashboard: ${hatech.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\r\n gateway:\r\n httpclient:\r\n websocket:\r\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\r\n max-frame-payload-length: 0x7fffffff\r\n discovery:\r\n locator:\r\n enabled: false\r\n routes:\r\n - id: zyjblogs-oauth\r\n uri: lb://zyjblogs-oauth\r\n predicates:\r\n - Path=/api/oauth/**\r\n filters:\r\n - StripPrefix=2\r\n - id: zyjblogs-rbac\r\n uri: lb://zyjblogs-rbac\r\n predicates:\r\n - Path=/api/rbac/**\r\n filters:\r\n - StripPrefix=2\r\n\r\nfeign:\r\n sentinel:\r\n enabled: true\r\n\r\nribbon:\r\n ReadTimeout: 90000 # 请求处理的超时时间\r\n ConnectTimeout: 3000 # 请求连接的超时时间\r\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\r\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\r\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\r\n\r\nmanagement:\r\n endpoints:\r\n web:\r\n exposure:\r\n include: \'health\'\r\n endpoint:\r\n health:\r\n show-details: always\r\n', '8e07052c2a26fcbc9f96a56babbb3daa', '2022-08-18 09:32:11', '2022-08-18 09:32:11', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (10, 20, 'zyjblogs-global-test.yml', 'global', '', 'none', '334c4a4c42fdb79d7ebc3e73b517e6f8', '2022-08-18 09:33:28', '2022-08-18 09:33:28', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (14, 21, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\nzyjblogs:\n config:\n server-port: 9019\n whilelist:\n allowPaths:\n - /v2/api-docs/**\n - /oauth/token\n - /oauth/check_token\n - /user/login\n\nserver:\n port: ${zyjblogs.config.server-port}\nspring:\n main:\n allow-bean-definition-overriding: true\n servlet:\n multipart:\n enabled: true\n max-file-size: 20MB\n max-request-size: 100MB\n redis:\n host: ${hatech.global.redis.host}\n port: ${hatech.global.redis.port}\n password: ${hatech.global.redis.password}\n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n\n cloud:\n sentinel:\n datasource:\n ds1:\n nacos:\n username: ${spring.cloud.nacos.config.username}\n password: ${spring.cloud.nacos.config.password}\n namespace: ${spring.cloud.nacos.config.namespace}\n server-addr: ${spring.cloud.nacos.config.server-addr}\n group-id: SENTINEL_GROUP\n rule-type: flow\n data-id: ${spring.application.name}-sentinel\n data-type: json\n transport:\n port: ${zyjblogs.global.sentinel.transport.port}\n dashboard: ${zyjblogs.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\n gateway:\n httpclient:\n websocket:\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\n max-frame-payload-length: 0x7fffffff\n discovery:\n locator:\n enabled: false\n routes:\n - id: zyjblogs-oauth\n uri: lb://zyjblogs-oauth\n predicates:\n - Path=/api/oauth/**\n filters:\n - StripPrefix=2\n - id: zyjblogs-rbac\n uri: lb://zyjblogs-rbac\n predicates:\n - Path=/api/rbac/**\n filters:\n - StripPrefix=2\n\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 90000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always\n', 'ccf648c4bc8ff739feca11d0e2fa1f3b', '2022-08-18 09:43:28', '2022-08-18 09:43:29', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (0, 22, 'zyjblogs-gateway-sentinel', 'DEFAULT_GROUP', '', '[\r\n]', 'fdaf133263369980df600fd06ce738ec', '2022-08-18 09:45:59', '2022-08-18 09:45:59', NULL, '127.0.0.1', 'I', 'test');
INSERT INTO `his_config_info` VALUES (14, 23, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\nzyjblogs:\n config:\n server-port: 9019\n whilelist:\n allowPaths:\n - /v2/api-docs/**\n - /oauth/token\n - /oauth/check_token\n - /user/login\n\nserver:\n port: ${zyjblogs.config.server-port}\nspring:\n main:\n allow-bean-definition-overriding: true\n servlet:\n multipart:\n enabled: true\n max-file-size: 20MB\n max-request-size: 100MB\n redis:\n host: ${zyjbblogs.global.redis.host}\n port: ${zyjbblogs.global.redis.port}\n password: ${zyjbblogs.global.redis.password}\n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n\n cloud:\n sentinel:\n datasource:\n ds1:\n nacos:\n username: ${spring.cloud.nacos.config.username}\n password: ${spring.cloud.nacos.config.password}\n namespace: ${spring.cloud.nacos.config.namespace}\n server-addr: ${spring.cloud.nacos.config.server-addr}\n group-id: SENTINEL_GROUP\n rule-type: flow\n data-id: ${spring.application.name}-sentinel\n data-type: json\n transport:\n port: ${zyjblogs.global.sentinel.transport.port}\n dashboard: ${zyjblogs.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\n gateway:\n httpclient:\n websocket:\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\n max-frame-payload-length: 0x7fffffff\n discovery:\n locator:\n enabled: false\n routes:\n - id: zyjblogs-oauth\n uri: lb://zyjblogs-oauth\n predicates:\n - Path=/api/oauth/**\n filters:\n - StripPrefix=2\n - id: zyjblogs-rbac\n uri: lb://zyjblogs-rbac\n predicates:\n - Path=/api/rbac/**\n filters:\n - StripPrefix=2\n\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 90000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always\n', 'a2e43ef4a61c33f9c5f2493c8548ae4e', '2022-08-18 09:49:15', '2022-08-18 09:49:15', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (14, 24, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\nzyjblogs:\n config:\n server-port: 9019\n whilelist:\n allowPaths:\n - /v2/api-docs/**\n - /oauth/token\n - /oauth/check_token\n - /user/login\n\nserver:\n port: ${zyjblogs.config.server-port}\nspring:\n main:\n allow-bean-definition-overriding: true\n servlet:\n multipart:\n enabled: true\n max-file-size: 20MB\n max-request-size: 100MB\n redis:\n host: ${zyjblogs.global.redis.host}\n port: ${zyjblogs.global.redis.port}\n password: ${zyjblogs.global.redis.password}\n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n\n cloud:\n sentinel:\n datasource:\n ds1:\n nacos:\n username: ${spring.cloud.nacos.config.username}\n password: ${spring.cloud.nacos.config.password}\n namespace: ${spring.cloud.nacos.config.namespace}\n server-addr: ${spring.cloud.nacos.config.server-addr}\n group-id: SENTINEL_GROUP\n rule-type: flow\n data-id: ${spring.application.name}-sentinel\n data-type: json\n transport:\n port: ${zyjblogs.global.sentinel.transport.port}\n dashboard: ${zyjblogs.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\n gateway:\n httpclient:\n websocket:\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\n max-frame-payload-length: 0x7fffffff\n discovery:\n locator:\n enabled: false\n routes:\n - id: zyjblogs-oauth\n uri: lb://zyjblogs-oauth\n predicates:\n - Path=/api/oauth/**\n filters:\n - StripPrefix=2\n - id: zyjblogs-rbac\n uri: lb://zyjblogs-rbac\n predicates:\n - Path=/api/rbac/**\n filters:\n - StripPrefix=2\n\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 90000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always\n', 'e4023728583537e3de832f65f264503a', '2022-08-18 10:14:00', '2022-08-18 10:14:00', 'nacos', '127.0.0.1', 'U', 'test');
INSERT INTO `his_config_info` VALUES (14, 25, 'zyjblogs-gateway-test.yml', 'public', '', '#通常情况下只需要改config配置\nzyjblogs:\n config:\n server-port: 9019\n whilelist:\n allowPaths:\n - /v2/api-docs/**\n - /oauth/token\n - /oauth/check_token\n - /user/login\n\nserver:\n port: ${zyjblogs.config.server-port}\nspring:\n main:\n allow-bean-definition-overriding: true\n servlet:\n multipart:\n enabled: true\n max-file-size: 20MB\n max-request-size: 100MB\n redis:\n host: ${zyjblogs.global.redis.host}\n port: ${zyjblogs.global.redis.port}\n password: ${zyjblogs.global.redis.password}\n timeout: 10000 #连接超时时间(毫秒)\n lettuce:\n pool:\n max-active: 8 # 连接池最大连接数\n max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)\n min-idle: 0 # 连接池中的最小空闲连接\n max-idle: 8 # 连接池中的最大空闲连接\n\n cloud:\n sentinel:\n datasource:\n ds1:\n nacos:\n username: ${spring.cloud.nacos.config.username}\n password: ${spring.cloud.nacos.config.password}\n namespace: ${spring.cloud.nacos.config.namespace}\n server-addr: ${spring.cloud.nacos.config.server-addr}\n group-id: SENTINEL_GROUP\n rule-type: flow\n data-id: ${spring.application.name}-sentinel\n data-type: json\n transport:\n port: ${zyjblogs.global.sentinel.transport.port}\n dashboard: ${zyjblogs.global.sentinel.transport.dashboard.host}:${hatech.global.sentinel.transport.dashboard.port}\n gateway:\n httpclient:\n websocket:\n #websocket最大传输长度单位(b),默认为64kb,最大为Integer.MAX_VALUE\n max-frame-payload-length: 0x7fffffff\n discovery:\n locator:\n enabled: true\n routes:\n - id: zyjblogs-oauth\n uri: lb://zyjblogs-oauth\n predicates:\n - Path=/api/oauth/**\n filters:\n - StripPrefix=2\n - id: zyjblogs-rbac\n uri: lb://zyjblogs-rbac\n predicates:\n - Path=/api/rbac/**\n filters:\n - StripPrefix=2\n\nfeign:\n sentinel:\n enabled: true\n\nribbon:\n ReadTimeout: 90000 # 请求处理的超时时间\n ConnectTimeout: 3000 # 请求连接的超时时间\n MaxAutoRetries: 1 # 重试策略先尝试访问首选实例一次,失败后才会更换实例访问\n MaxAutoRetriesNextServer: 2 # 更换实例访问的次数通过参数设置为2, 所以会尝试更换2次实例进行重试\n OkToRetryOnAllOperations: true # 开启对请求进行行重试\n\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'health\'\n endpoint:\n health:\n show-details: always\n', 'de451d96d9134835784db63cfc88734c', '2022-08-18 10:22:04', '2022-08-18 10:22:05', 'nacos', '127.0.0.1', 'U', 'test');
-- ---------------------------- -- ----------------------------
-- Table structure for permissions -- Table structure for permissions

View File

@ -11,104 +11,128 @@
Target Server Version : 50732 Target Server Version : 50732
File Encoding : 65001 File Encoding : 65001
Date: 17/08/2022 18:14:29 Date: 18/08/2022 18:47:42
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
--
-- Oauth sql -- MYSQL
--
Drop table if exists oauth_client_details; -- ----------------------------
create table oauth_client_details ( -- Table structure for oauth_access_token
client_id VARCHAR(255) PRIMARY KEY, -- ----------------------------
resource_ids VARCHAR(255), DROP TABLE IF EXISTS `oauth_access_token`;
client_secret VARCHAR(255), CREATE TABLE `oauth_access_token` (
scope VARCHAR(255), `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
authorized_grant_types VARCHAR(255), `token_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
web_server_redirect_uri VARCHAR(255), `token` blob NULL,
authorities VARCHAR(255), `authentication_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
access_token_validity INTEGER, `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
refresh_token_validity INTEGER, `client_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
additional_information TEXT, `authentication` blob NULL,
create_time timestamp default now(), `refresh_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
archived tinyint(1) default '0', UNIQUE INDEX `authentication_id`(`authentication_id`) USING BTREE,
trusted tinyint(1) default '0', INDEX `token_id_index`(`token_id`) USING BTREE,
autoapprove VARCHAR (255) default 'false' INDEX `authentication_id_index`(`authentication_id`) USING BTREE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8; INDEX `user_name_index`(`user_name`) USING BTREE,
INDEX `client_id_index`(`client_id`) USING BTREE,
INDEX `refresh_token_index`(`refresh_token`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of oauth_access_token
-- ----------------------------
Drop table if exists oauth_access_token; -- ----------------------------
create table oauth_access_token ( -- Table structure for oauth_client_details
create_time timestamp default now(), -- ----------------------------
token_id VARCHAR(255), DROP TABLE IF EXISTS `oauth_client_details`;
token BLOB, CREATE TABLE `oauth_client_details` (
authentication_id VARCHAR(255) UNIQUE, `client_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
user_name VARCHAR(255), `resource_ids` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
client_id VARCHAR(255), `client_secret` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
authentication BLOB, `scope` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
refresh_token VARCHAR(255) `authorized_grant_types` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8; `web_server_redirect_uri` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`authorities` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`access_token_validity` int(11) NULL DEFAULT NULL,
`refresh_token_validity` int(11) NULL DEFAULT NULL,
`additional_information` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`archived` tinyint(1) NULL DEFAULT 0,
`trusted` tinyint(1) NULL DEFAULT 0,
`autoapprove` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'false',
PRIMARY KEY (`client_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of oauth_client_details
-- ----------------------------
INSERT INTO `oauth_client_details` VALUES ('zyjblogs-gateway', 'zyjblogs-gateway', '$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila', 'all', 'authorization_code,password,client_credentials,implicit,refresh_token', 'http://localhost:9019/', NULL, NULL, NULL, NULL, '2022-08-18 14:13:53', 0, 0, 'false');
INSERT INTO `oauth_client_details` VALUES ('zyjblogs-oauth', 'zyjblogs-oauth', '$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila', 'all', 'authorization_code,password,client_credentials,implicit,refresh_token', 'http://localhost:9019/', NULL, NULL, NULL, NULL, '2022-08-18 14:14:32', 0, 0, 'false');
INSERT INTO `oauth_client_details` VALUES ('zyjblogs-rbac', 'zyjblogs-rbac', '$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila', 'all', 'authorization_code,password,client_credentials,implicit,refresh_token', 'http://localhost:9029/', NULL, NULL, NULL, NULL, '2022-08-18 08:34:24', 0, 0, 'false');
Drop table if exists oauth_refresh_token; -- ----------------------------
create table oauth_refresh_token ( -- Table structure for oauth_code
create_time timestamp default now(), -- ----------------------------
token_id VARCHAR(255), DROP TABLE IF EXISTS `oauth_code`;
token BLOB, CREATE TABLE `oauth_code` (
authentication BLOB `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
) ENGINE=InnoDB DEFAULT CHARSET=utf8; `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`authentication` blob NULL,
INDEX `code_index`(`code`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of oauth_code
-- ----------------------------
INSERT INTO `oauth_code` VALUES ('2022-08-18 09:01:55', 'AeocBw', 0xACED0005737200416F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F417574683241757468656E7469636174696F6EBD400B02166252130200024C000D73746F7265645265717565737474003C4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F4F4175746832526571756573743B4C00127573657241757468656E7469636174696F6E7400324C6F72672F737072696E676672616D65776F726B2F73656375726974792F636F72652F41757468656E7469636174696F6E3B787200476F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E416273747261637441757468656E7469636174696F6E546F6B656ED3AA287E6E47640E0200035A000D61757468656E746963617465644C000B617574686F7269746965737400164C6A6176612F7574696C2F436F6C6C656374696F6E3B4C000764657461696C737400124C6A6176612F6C616E672F4F626A6563743B787000737200266A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654C697374FC0F2531B5EC8E100200014C00046C6973747400104C6A6176612F7574696C2F4C6973743B7872002C6A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65436F6C6C656374696F6E19420080CB5EF71E0200014C00016371007E00047870737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A657870000000007704000000007871007E000C707372003A6F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E4F41757468325265717565737400000000000000010200075A0008617070726F7665644C000B617574686F72697469657371007E00044C000A657874656E73696F6E7374000F4C6A6176612F7574696C2F4D61703B4C000B72656469726563745572697400124C6A6176612F6C616E672F537472696E673B4C00077265667265736874003B4C6F72672F737072696E676672616D65776F726B2F73656375726974792F6F61757468322F70726F76696465722F546F6B656E526571756573743B4C000B7265736F7572636549647374000F4C6A6176612F7574696C2F5365743B4C000D726573706F6E7365547970657371007E0011787200386F72672E737072696E676672616D65776F726B2E73656375726974792E6F61757468322E70726F76696465722E426173655265717565737436287A3EA37169BD0200034C0008636C69656E74496471007E000F4C001172657175657374506172616D657465727371007E000E4C000573636F706571007E0011787074000D7A796A626C6F67732D72626163737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C654D6170F1A5A8FE74F507420200014C00016D71007E000E7870737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F400000000000067708000000080000000474000D726573706F6E73655F74797065740004636F6465740009636C69656E745F696471007E001474000C72656469726563745F75726C74001568747470733A2F2F7777772E62616964752E636F6D74000573636F7065740003616C6C78737200256A6176612E7574696C2E436F6C6C656374696F6E7324556E6D6F6469666961626C65536574801D92D18F9B80550200007871007E0009737200176A6176612E7574696C2E4C696E6B656448617368536574D86CD75A95DD2A1E020000787200116A6176612E7574696C2E48617368536574BA44859596B8B7340300007870770C000000103F4000000000000171007E001F78017371007E0023770C000000103F40000000000000787371007E00173F400000000000007708000000100000000078740016687474703A2F2F6C6F63616C686F73743A393032392F707371007E0023770C000000103F4000000000000174000D7A796A626C6F67732D72626163787371007E0023770C000000103F4000000000000171007E001A787372004F6F72672E737072696E676672616D65776F726B2E73656375726974792E61757468656E7469636174696F6E2E557365726E616D6550617373776F726441757468656E7469636174696F6E546F6B656E00000000000002120200024C000B63726564656E7469616C7371007E00054C00097072696E636970616C71007E00057871007E0003017372001F6A6176612E7574696C2E436F6C6C656374696F6E7324456D7074794C6973747AB817B43CA79EDE0200007870737200486F72672E737072696E676672616D65776F726B2E73656375726974792E7765622E61757468656E7469636174696F6E2E57656241757468656E7469636174696F6E44657461696C7300000000000002120200024C000D72656D6F74654164647265737371007E000F4C000973657373696F6E496471007E000F78707400093132372E302E302E3174002038373032444535373930443133444133363839453433354436434139444143367073720031636E2E7A796A626C6F67732E6F617574682E7365727665722E757365722E706F2E4F617574685573657244657461696C739ABCC249D9EA599302000E5A00116163636F756E744E6F6E457870697265645A00106163636F756E744E6F6E4C6F636B65645A001563726564656E7469616C734E6F6E457870697265645A0007656E61626C65644C000B617574686F72697469657371007E00044C000764656C657465647400134C6A6176612F6C616E672F496E74656765723B4C0005656D61696C71007E000F4C0002696471007E000F4C000C696E7669746555736572496471007E000F4C00046E616D6571007E000F4C000870617373776F726471007E000F4C000570686F6E6571007E00344C000673746174757371007E00344C0008757365726E616D6571007E000F78700101010170737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000070740001317074000561646D696E74003C2432612431302434446C66765A7271377A674B7A6B624B79672E47484F36794864476E6F7A6361663342354A53414330664E42346B3147684D6B36797071007E003874000561646D696E);
Drop table if exists oauth_code; -- ----------------------------
create table oauth_code ( -- Table structure for oauth_refresh_token
create_time timestamp default now(), -- ----------------------------
code VARCHAR(255), DROP TABLE IF EXISTS `oauth_refresh_token`;
authentication BLOB CREATE TABLE `oauth_refresh_token` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`token_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`token` blob NULL,
`authentication` blob NULL,
INDEX `token_id_index`(`token_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of oauth_refresh_token
-- ----------------------------
-- ----------------------------
-- Add indexes -- Table structure for user
create index token_id_index on oauth_access_token (token_id); -- ----------------------------
create index authentication_id_index on oauth_access_token (authentication_id);
create index user_name_index on oauth_access_token (user_name);
create index client_id_index on oauth_access_token (client_id);
create index refresh_token_index on oauth_access_token (refresh_token);
create index token_id_index on oauth_refresh_token (token_id);
create index code_index on oauth_code (code);
INSERT INTO zyjblogs_rbac.oauth_client_details
(client_id, resource_ids, client_secret, `scope`, authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, refresh_token_validity, additional_information, autoapprove, trusted, archived)
VALUES('zyjblogs-rbac', 'zyjblogs-rbac', '$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila', 'all', 'authorization_code,password,client_credentials,implicit,refresh_token', NULL, NULL, NULL, NULL, NULL, 'false', NULL, NULL);
-- zyjblogs_rbac.`user` definition
DROP TABLE IF EXISTS `user`; DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` ( CREATE TABLE `user` (
`id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci NOT NULL COMMENT '用户id', `id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户id',
`username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', `username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
`name` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '昵称', `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '昵称',
`age` int DEFAULT NULL COMMENT '用户年龄', `age` int(11) NULL DEFAULT NULL COMMENT '用户年龄',
`avatar` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像', `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
`password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户密码', `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户密码',
`phone` int DEFAULT NULL COMMENT '用户密码', `phone` int(11) NULL DEFAULT NULL COMMENT '用户密码',
`email` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱', `email` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`invite_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邀请者id', `invite_user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邀请者id',
`status` int DEFAULT NULL COMMENT '用户状态 1启用 0注销', `status` int(11) NULL DEFAULT NULL COMMENT '用户状态 1启用 0注销',
`follow_num` int DEFAULT NULL COMMENT '关注数量', `follow_num` int(11) NULL DEFAULT NULL COMMENT '关注数量',
`fans_num` int DEFAULT NULL COMMENT '粉丝数量', `fans_num` int(11) NULL DEFAULT NULL COMMENT '粉丝数量',
`deleted` tinyint DEFAULT '0', `deleted` tinyint(4) NULL DEFAULT 0,
`description` varchar(600) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户介绍', `description` varchar(600) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户介绍',
`create_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建用户id', `create_user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建用户id',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8_general_ci DEFAULT NULL COMMENT '更新用户id', `update_user_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新用户id',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `username` (`username`) USING BTREE UNIQUE INDEX `username`(`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC; ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', 'admin', 1, NULL, '$2a$10$4DlfvZrq7zgKzkbKyg.GHO6yHdGnozcaf3B5JSAC0fNB4k1GhMk6y', NULL, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL);
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

96
pom.xml
View File

@ -17,16 +17,19 @@
<module>zyjblogs-oauth</module> <module>zyjblogs-oauth</module>
<module>zyjblogs-rbac</module> <module>zyjblogs-rbac</module>
<module>zyjblogs-gateway</module> <module>zyjblogs-gateway</module>
<module>zyjblogs-common-spring-boot-starter</module>
</modules> </modules>
<properties> <properties>
<zyjblogs.version>1.0-SNAPSHOT</zyjblogs.version>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<!-- spring-cloud版本配置 --> <!-- spring-cloud版本配置 -->
<spring-cloud.version>Hoxton.SR12</spring-cloud.version> <spring-cloud.version>Hoxton.SR12</spring-cloud.version>
<lombok.version>1.18.24</lombok.version> <lombok.version>1.18.24</lombok.version>
<jackson.version>2.13.3</jackson.version> <jackson.version>2.13.3</jackson.version>
<jjwt.version>0.11.1</jjwt.version> <jjwt.version>0.9.1</jjwt.version>
<jwt.version>0.11.1</jwt.version>
<aliyun.version>4.5.0</aliyun.version> <aliyun.version>4.5.0</aliyun.version>
<spring-authorization-server.version>0.3.1</spring-authorization-server.version> <spring-authorization-server.version>0.3.1</spring-authorization-server.version>
<feign-hystrix.version>11.8</feign-hystrix.version> <feign-hystrix.version>11.8</feign-hystrix.version>
@ -37,6 +40,23 @@
<mysql-jdbc.version>8.0.21</mysql-jdbc.version> <mysql-jdbc.version>8.0.21</mysql-jdbc.version>
<!-- spring-cloud-alibaba版本配置 --> <!-- spring-cloud-alibaba版本配置 -->
<spring-cloud-alibaba.version>2.2.6.RELEASE</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2.2.6.RELEASE</spring-cloud-alibaba.version>
<com.alibaba.transmittable.version>2.12.2</com.alibaba.transmittable.version>
<!-- orika-core实体类转换版本配置 -->
<orika-core.version>1.5.4</orika-core.version>
<!-- 斯瓦格UI版本配置 -->
<swagger-annotations.verion>1.5.24</swagger-annotations.verion>
<knife4j-spring-boot-starter.version>3.0.3</knife4j-spring-boot-starter.version>
<!-- 阿里巴巴excel解析版本配置 -->
<easyexcel.version>2.2.11</easyexcel.version>
<!-- xxl-job-core核心版本号 -->
<xxl-job-core.version>2.3.0</xxl-job-core.version>
<!-- 第三方工具库 -->
<lombok.version>1.18.24</lombok.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-collections4.version>4.4</commons-collections4.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-crypto.version>1.1.0</commons-crypto.version>
<jackson-datatype-jsr310.version>2.13.3</jackson-datatype-jsr310.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@ -74,17 +94,22 @@
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId> <artifactId>jjwt-api</artifactId>
<version>${jjwt.version}</version> <version>${jwt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId> <artifactId>jjwt-impl</artifactId>
<version>${jwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version> <version>${jjwt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId> <artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version> <version>${jwt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
@ -106,6 +131,11 @@
<artifactId>nacos-client</artifactId> <artifactId>nacos-client</artifactId>
<version>${nacos-client.version}</version> <version>${nacos-client.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-datatype-jsr310.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --> <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
@ -122,7 +152,56 @@
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${com.alibaba.transmittable.version}</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>${orika-core.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.verion}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-crypto</artifactId>
<version>${commons-crypto.version}</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>${orika-core.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-oauth2-authorization-server --> <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-oauth2-authorization-server -->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>--> <!-- <groupId>org.springframework.security</groupId>-->
@ -130,6 +209,7 @@
<!-- <version>${spring-authorization-server.version}</version>--> <!-- <version>${spring-authorization-server.version}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
@ -137,10 +217,10 @@
<!-- <groupId>org.springframework.security</groupId>--> <!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-oauth2-authorization-server</artifactId>--> <!-- <artifactId>spring-security-oauth2-authorization-server</artifactId>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-devtools</artifactId> <!-- <artifactId>spring-boot-devtools</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@ -0,0 +1,78 @@
<?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">
<parent>
<artifactId>zyjblogs-parent</artifactId>
<groupId>cn.zyjblogs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cn.zyjblogs.starter</groupId>
<artifactId>zyjblogs-common-spring-boot-starter</artifactId>
<version>${zyjblogs.version}</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- Spring 集成 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<!-- 第三方工具库 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-crypto</artifactId>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,21 @@
package cn.zyjblogs.common.entity.constant;
public class CommonConstant {
public static final Integer IS_DELETED = 1;
public static final Integer NO_DELETED = 0 ;
public static final int YES = 1;
public static final int NO = 0;
public static final String NO_STR = "0";
public static final int VERSION_START_VALUE = 1;
public static final String TENANT_ID = "tenant_id";
public static final String EMPTY_STR = "";
public static final int DEFAULT_PAGE = 1;
public static final int DEFAULT_LIMIT = 10;
public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String TRACE_ID_HEADER = "x-traceId-header";
public static final String LOG_TRACE_ID = "traceId";
public static final String INIT_TENANT_FANOUT_EXCHANGE = "init.tenant.fanout.exchange";
private CommonConstant() {
}
}

View File

@ -0,0 +1,14 @@
package cn.zyjblogs.common.entity.constant;
public class HttpHeaderConstant {
public static final String AUTHORIZATION = "Authorization";
public static final String AUTHORIZATION_TYPE = "Bearer";
public static final String LANGUAGE = "istorm-language";
public static final String REQUEST_FROM_GATEWAY_KEY = "request-from-istorm-gateway";
public static final String REQUEST_FROM_GATEWAY_VALUE = "yes";
public static final String REQUEST_FROM_FEIGN_KEY = "request-from-istorm-feign";
public static final String REQUEST_FROM_FEIGN_VALUE = "yes";
private HttpHeaderConstant() {
}
}

View File

@ -0,0 +1,13 @@
package cn.zyjblogs.common.entity.constant;
public class LengthConstant {
public static final int ID_SIZE = 32;
public static final int MIN_SIZE = 1;
public static final int SHORT_SIZE = 16;
public static final int NORMAL_SIZE = 100;
public static final int LONG_SIZE = 500;
public static final int MOBILE_PHONE_SIZE = 11;
public LengthConstant() {
}
}

View File

@ -0,0 +1,11 @@
package cn.zyjblogs.common.entity.constant;
public class RegexConstant {
public static final String MOBILE_PHONE_PATTERN = "[\\s]?|^1[3456789]\\d{9}$";
public static final String IS_ENABLED_PATTERN = "^(0|1)$";
public static final String INVALID_CHAR = "[a-zA-Z0-9\\-_\\u4e00-\\u9fa5\\s]+";
public static final String EMAIL = "^(\\w-*\\.*)+@(\\w-?)+(\\.\\w{2,})+$";
public RegexConstant() {
}
}

View File

@ -0,0 +1,58 @@
package cn.zyjblogs.common.entity.context;
import cn.zyjblogs.common.entity.dto.ContextDto;
import cn.zyjblogs.common.utils.bean.BeanUtils;
import com.alibaba.ttl.TransmittableThreadLocal;
import java.util.Locale;
public class BaseContextHandler {
private static final ThreadLocal<ContextDto> CONTEXT = new TransmittableThreadLocal<ContextDto>() {
public ContextDto initialValue() {
return ContextDto.builder().build();
}
};
public BaseContextHandler() {
}
public static ContextDto get() {
return (ContextDto)CONTEXT.get();
}
public static void set(ContextDto ContextDto) {
CONTEXT.set(ContextDto);
}
public static String getUserId() {
return ((ContextDto)CONTEXT.get()).getUserId();
}
public static String getUsername() {
return ((ContextDto)CONTEXT.get()).getUsername();
}
public static Integer getSource() {
return ((ContextDto)CONTEXT.get()).getSource();
}
public static String getTenantId() {
return ((ContextDto)CONTEXT.get()).getTenantId();
}
public static String getToken() {
return ((ContextDto)CONTEXT.get()).getToken();
}
public static ContextDto getDataReplication() {
return (ContextDto) BeanUtils.map((ContextDto)CONTEXT.get(), ContextDto.class);
}
public static Locale getLanguage() {
return ((ContextDto)CONTEXT.get()).getLanguage();
}
public static void clear() {
CONTEXT.remove();
}
}

View File

@ -0,0 +1,21 @@
package cn.zyjblogs.common.entity.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Locale;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ContextDto {
private String tenantId;
private String userId;
private String username;
private Integer source;
private Integer isTenantCreator;
private String token;
private Locale language;
}

View File

@ -0,0 +1,50 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package cn.zyjblogs.common.entity.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(
description = "状态返回信息"
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ResponseObject<T> {
@ApiModelProperty(
value = "响应结果编码",
example = "200"
)
private int code;
@ApiModelProperty(
value = "错误码",
example = "user_not_exists"
)
private String errorCode;
@ApiModelProperty(
value = "响应结果信息",
example = "请求成功"
)
private String msg;
@ApiModelProperty(
value = "统计列表总数(如果列表存在)",
example = "10"
)
private long count;
@ApiModelProperty("响应结果数据")
private T data;
@ApiModelProperty(
value = "当前时间戳",
example = "1630051102895"
)
private long timestamp;
}

View File

@ -0,0 +1,44 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package cn.zyjblogs.common.entity.response;
public class ResponseResult {
private static final int ZERO_DATA_TOTAL = 0;
private static final int ONE_DATA_TOTAL = 1;
private ResponseResult() {
}
public static ResponseObject<Object> success() {
return success(0L, (Object)null);
}
public static <T> ResponseObject<T> success(T data) {
return success(1L, data);
}
public static <T> ResponseObject<T> success(long total, T data) {
return ResponseObject.<T>builder().code(ResponseStatus.OK.value()).msg(ResponseStatus.OK.getReasonPhrase()).count(total).data(data).timestamp(System.currentTimeMillis()).build();
}
public static <T> ResponseObject<T> error(ResponseStatus responseCode, String errorMsg) {
return error(responseCode, responseCode.getReasonPhrase(), errorMsg, 0L, null);
}
public static <T> ResponseObject<T> error(ResponseStatus responseCode, String errorCode, String errorMsg) {
return error(responseCode, errorCode, errorMsg, 0L, null);
}
public static <T> ResponseObject<T> error(ResponseStatus responseCode, String errorCode, String errorMsg, T data) {
return error(responseCode, errorCode, errorMsg, 1L, data);
}
public static <T> ResponseObject<T> error(ResponseStatus responseCode, String errorCode, String errorMsg, long total, T data) {
if (responseCode.value() == ResponseStatus.OK.value()) {
throw new IllegalArgumentException("ResponseResult.error方法中的responseCode参数不能是ResponseCode.REQUEST_SUCCESS");
} else {
return ResponseObject.<T>builder().code(responseCode.value()).errorCode(errorCode).msg(errorMsg == null ? responseCode.getReasonPhrase() : errorMsg).count(total).data(data).timestamp(System.currentTimeMillis()).build();
}
}
}

View File

@ -0,0 +1,204 @@
package cn.zyjblogs.common.entity.response;
public enum ResponseStatus {
CONTINUE(100, "Continue"),
SWITCHING_PROTOCOLS(101, "Switching Protocols"),
PROCESSING(102, "Processing"),
CHECKPOINT(103, "Checkpoint"),
OK(200, "OK"),
CREATED(201, "Created"),
ACCEPTED(202, "Accepted"),
NON_AUTHORITATIVE_INFORMATION(203, "Non-Authoritative Information"),
NO_CONTENT(204, "No Content"),
RESET_CONTENT(205, "Reset Content"),
PARTIAL_CONTENT(206, "Partial Content"),
MULTI_STATUS(207, "Multi-Status"),
ALREADY_REPORTED(208, "Already Reported"),
IM_USED(226, "IM Used"),
MULTIPLE_CHOICES(300, "Multiple Choices"),
MOVED_PERMANENTLY(301, "Moved Permanently"),
FOUND(302, "Found"),
/** @deprecated */
@Deprecated
MOVED_TEMPORARILY(302, "Moved Temporarily"),
SEE_OTHER(303, "See Other"),
NOT_MODIFIED(304, "Not Modified"),
/** @deprecated */
@Deprecated
USE_PROXY(305, "Use Proxy"),
TEMPORARY_REDIRECT(307, "Temporary Redirect"),
PERMANENT_REDIRECT(308, "Permanent Redirect"),
BAD_REQUEST(400, "Bad Request"),
UNAUTHORIZED(401, "Unauthorized"),
PAYMENT_REQUIRED(402, "Payment Required"),
FORBIDDEN(403, "Forbidden"),
NOT_FOUND(404, "Not Found"),
METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
NOT_ACCEPTABLE(406, "Not Acceptable"),
PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"),
REQUEST_TIMEOUT(408, "Request Timeout"),
CONFLICT(409, "Conflict"),
GONE(410, "Gone"),
LENGTH_REQUIRED(411, "Length Required"),
PRECONDITION_FAILED(412, "Precondition Failed"),
PAYLOAD_TOO_LARGE(413, "Payload Too Large"),
/** @deprecated */
@Deprecated
REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"),
URI_TOO_LONG(414, "URI Too Long"),
/** @deprecated */
@Deprecated
REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"),
UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested range not satisfiable"),
EXPECTATION_FAILED(417, "Expectation Failed"),
I_AM_A_TEAPOT(418, "I'm a teapot"),
/** @deprecated */
@Deprecated
INSUFFICIENT_SPACE_ON_RESOURCE(419, "Insufficient Space On Resource"),
/** @deprecated */
@Deprecated
METHOD_FAILURE(420, "Method Failure"),
/** @deprecated */
@Deprecated
DESTINATION_LOCKED(421, "Destination Locked"),
UNPROCESSABLE_ENTITY(422, "Unprocessable Entity"),
LOCKED(423, "Locked"),
FAILED_DEPENDENCY(424, "Failed Dependency"),
TOO_EARLY(425, "Too Early"),
UPGRADE_REQUIRED(426, "Upgrade Required"),
PRECONDITION_REQUIRED(428, "Precondition Required"),
TOO_MANY_REQUESTS(429, "Too Many Requests"),
REQUEST_HEADER_FIELDS_TOO_LARGE(431, "Request Header Fields Too Large"),
UNAVAILABLE_FOR_LEGAL_REASONS(451, "Unavailable For Legal Reasons"),
INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
NOT_IMPLEMENTED(501, "Not Implemented"),
BAD_GATEWAY(502, "Bad Gateway"),
SERVICE_UNAVAILABLE(503, "Service Unavailable"),
GATEWAY_TIMEOUT(504, "Gateway Timeout"),
HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version not supported"),
VARIANT_ALSO_NEGOTIATES(506, "Variant Also Negotiates"),
INSUFFICIENT_STORAGE(507, "Insufficient Storage"),
LOOP_DETECTED(508, "Loop Detected"),
BANDWIDTH_LIMIT_EXCEEDED(509, "Bandwidth Limit Exceeded"),
NOT_EXTENDED(510, "Not Extended"),
NETWORK_AUTHENTICATION_REQUIRED(511, "Network Authentication Required");
private final int value;
private final String reasonPhrase;
private ResponseStatus(int value, String reasonPhrase) {
this.value = value;
this.reasonPhrase = reasonPhrase;
}
public int value() {
return this.value;
}
public String getReasonPhrase() {
return this.reasonPhrase;
}
public Series series() {
return ResponseStatus.Series.valueOf(this);
}
public boolean is1xxInformational() {
return this.series() == ResponseStatus.Series.INFORMATIONAL;
}
public boolean is2xxSuccessful() {
return this.series() == ResponseStatus.Series.SUCCESSFUL;
}
public boolean is3xxRedirection() {
return this.series() == ResponseStatus.Series.REDIRECTION;
}
public boolean is4xxClientError() {
return this.series() == ResponseStatus.Series.CLIENT_ERROR;
}
public boolean is5xxServerError() {
return this.series() == ResponseStatus.Series.SERVER_ERROR;
}
public boolean isError() {
return this.is4xxClientError() || this.is5xxServerError();
}
public String toString() {
return this.value + " " + this.name();
}
public static ResponseStatus valueOf(int statusCode) {
ResponseStatus status = resolve(statusCode);
if (status == null) {
throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
} else {
return status;
}
}
public static ResponseStatus resolve(int statusCode) {
ResponseStatus[] var1 = values();
int var2 = var1.length;
for(int var3 = 0; var3 < var2; ++var3) {
ResponseStatus status = var1[var3];
if (status.value == statusCode) {
return status;
}
}
return null;
}
public static enum Series {
INFORMATIONAL(1),
SUCCESSFUL(2),
REDIRECTION(3),
CLIENT_ERROR(4),
SERVER_ERROR(5);
private final int value;
private Series(int value) {
this.value = value;
}
public int value() {
return this.value;
}
public static Series valueOf(ResponseStatus status) {
return valueOf(status.value);
}
public static Series valueOf(int statusCode) {
Series series = resolve(statusCode);
if (series == null) {
throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
} else {
return series;
}
}
public static Series resolve(int statusCode) {
int seriesCode = statusCode / 100;
Series[] var2 = values();
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
Series series = var2[var4];
if (series.value == seriesCode) {
return series;
}
}
return null;
}
}
}

View File

@ -0,0 +1,11 @@
package cn.zyjblogs.common.exception;
public abstract class AbstractFrameworkException extends RuntimeException {
public AbstractFrameworkException(String message) {
super(message);
}
public AbstractFrameworkException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -0,0 +1,171 @@
package cn.zyjblogs.common.utils.bean;
import cn.zyjblogs.common.utils.jackson.JacksonHolder;
import cn.zyjblogs.common.utils.jackson.exception.JsonConvertException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import ma.glasnost.orika.DefaultFieldMapper;
import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import ma.glasnost.orika.metadata.ClassMapBuilder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BeanUtils {
private static final Logger log = LoggerFactory.getLogger(BeanUtils.class);
private static final MapperFacade DEFAULT_MAPPER_FACADE = (new DefaultMapperFactory.Builder()).build().getMapperFacade();
private static final Map<String, String> MYSQL_ESCAPE_MAP = new LinkedHashMap<>();
private BeanUtils() {
}
public static Map<String, Object> beanToMap(Object bean) {
Map<String, Object> result = new HashMap();
DEFAULT_MAPPER_FACADE.map(bean, result);
return result;
}
public static <S, T> T map(S sourceBean, Class<T> targetClass) {
return DEFAULT_MAPPER_FACADE.map(sourceBean, targetClass);
}
public static <S, T> T map(S sourceBean, Class<T> targetClass, Map<String, String> customPropertyMap) {
MapperFacade mapperFacade = getMapperFacadeForCustomPropertyMap(sourceBean.getClass(), targetClass, customPropertyMap);
return mapperFacade.map(sourceBean, targetClass);
}
public static <S, T> T map(S sourceBean, T targetBean) {
DEFAULT_MAPPER_FACADE.map(sourceBean, targetBean);
return targetBean;
}
public static <S, T> T map(S sourceBean, T targetBean, Map<String, String> customPropertyMap) {
MapperFacade mapperFacade = getMapperFacadeForCustomPropertyMap(sourceBean.getClass(), targetBean.getClass(), customPropertyMap);
mapperFacade.map(sourceBean, targetBean);
return targetBean;
}
public static <S, T> List<T> map(Iterable<S> sourceData, Class<T> targetClass) {
return DEFAULT_MAPPER_FACADE.mapAsList(sourceData, targetClass);
}
public static <T> T mapByJackson(Object content, TypeReference<T> valueTypeRef) {
if (!Objects.isNull(content) && !StringUtils.isBlank(content.toString())) {
try {
T result = JacksonHolder.MAPPER.readValue(JacksonHolder.MAPPER.writeValueAsString(content), valueTypeRef);
return result;
} catch (JsonProcessingException var4) {
log.error("json转换异常", var4);
throw new JsonConvertException("json转换异常", var4);
}
} else {
return null;
}
}
public static <T> T handlePropertyForLikeQuery(T bean, Set<String> ignoreProperty) {
if (bean != null) {
Class<?> clazz = bean.getClass();
Field[] fields = clazz.getDeclaredFields();
Field[] var4 = fields;
int var5 = fields.length;
for (int var6 = 0; var6 < var5; ++var6) {
Field field = var4[var6];
String fieldName = field.getName();
if ((ignoreProperty == null || !ignoreProperty.contains(fieldName)) && String.class == field.getType()) {
String originalValue = (String) getFieldValue(bean, field.getName(), String.class);
String newValue = escapeFieldValue(originalValue);
setFieldValue(bean, fieldName, newValue);
}
}
}
return bean;
}
public static <K, V> Map<V, K> reverseMap(Map<K, V> map) {
return (Map) (map != null && map.size() != 0 ? (Map) map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey, (key1, key2) -> {
return key2;
})) : new HashMap(0));
}
private static <T> T getFieldValue(Object bean, String fieldName, Class<T> clazz) {
Method method = null;
try {
method = bean.getClass().getMethod("get" + getFieldBaseMethodName(fieldName));
return (T) method.invoke(bean);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException var5) {
throw new JsonConvertException("bean转义时获取属性值出现异常", var5);
}
}
public static <T> T handlePropertyForLikeQuery(T bean) {
return (T) handlePropertyForLikeQuery(bean, null);
}
private static void setFieldValue(Object bean, String fieldName, Object fieldValue) {
Class clazz = bean.getClass();
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(bean, fieldValue);
} catch (IllegalAccessException | NoSuchFieldException var6) {
throw new JsonConvertException("bean转义时设置属性值出现异常", var6);
}
}
private static String getFieldBaseMethodName(String fieldName) {
byte[] items = fieldName.getBytes();
items[0] = (byte) ((char) items[0] - 97 + 65);
return new String(items);
}
private static String escapeFieldValue(String originalFieldValue) {
if (originalFieldValue != null && !"".equals(originalFieldValue)) {
String oldChar;
String newChar;
for (Iterator var1 = MYSQL_ESCAPE_MAP.entrySet().iterator(); var1.hasNext(); originalFieldValue = originalFieldValue.replace(oldChar, newChar)) {
Map.Entry<String, String> escapeEntry = (Map.Entry) var1.next();
oldChar = (String) escapeEntry.getKey();
newChar = (String) escapeEntry.getValue();
}
return originalFieldValue;
} else {
return null;
}
}
public static <S, T> MapperFacade getMapperFacadeForCustomPropertyMap(Class<S> sourceClass, Class<T> targetClass, Map<String, String> customPropertyMap) {
MapperFactory mapperFactory = (new DefaultMapperFactory.Builder()).build();
ClassMapBuilder<S, T> classMapBuilder = mapperFactory.classMap(sourceClass, targetClass);
Objects.requireNonNull(classMapBuilder);
customPropertyMap.forEach(classMapBuilder::field);
classMapBuilder.byDefault(new DefaultFieldMapper[0]).register();
return mapperFactory.getMapperFacade();
}
static {
MYSQL_ESCAPE_MAP.put("\\", "\\\\");
MYSQL_ESCAPE_MAP.put("%", "\\%");
MYSQL_ESCAPE_MAP.put("'", "\\'");
MYSQL_ESCAPE_MAP.put("_", "\\_");
}
}

View File

@ -0,0 +1,17 @@
package cn.zyjblogs.common.utils.jackson;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public final class JacksonHolder {
public static final ObjectMapper MAPPER = new ObjectMapper();
private JacksonHolder() {
}
static {
MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
}

View File

@ -0,0 +1,45 @@
package cn.zyjblogs.common.utils.jackson;
import cn.zyjblogs.common.utils.jackson.exception.JsonConvertException;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonUtils {
public static final ObjectMapper MAPPER = new ObjectMapper();
private JsonUtils() {
}
public static <T> T readValue(String content, TypeReference<T> valueTypeRef) {
try {
return MAPPER.readValue(content, valueTypeRef);
} catch (JsonProcessingException var3) {
throw new JsonConvertException("json字符串转对象出现异常", var3);
}
}
public static <T> T readValue(String content, Class<T> valueType) {
try {
return MAPPER.readValue(content, valueType);
} catch (JsonProcessingException var3) {
throw new JsonConvertException("json字符串转对象出现异常", var3);
}
}
public static String writeValueAsString(Object value) {
try {
return MAPPER.writeValueAsString(value);
} catch (JsonProcessingException var2) {
throw new JsonConvertException("对象转json字符串出现异常", var2);
}
}
static {
MAPPER.setSerializationInclusion(Include.NON_NULL);
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
}

View File

@ -0,0 +1,13 @@
package cn.zyjblogs.common.utils.jackson.exception;
import cn.zyjblogs.common.exception.AbstractFrameworkException;
public class JsonConvertException extends AbstractFrameworkException {
public JsonConvertException(String msg) {
super(msg);
}
public JsonConvertException(String msg, Throwable cause) {
super(msg, cause);
}
}

View File

@ -0,0 +1,5 @@
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.3
Built-By: mitom
Build-Jdk: 11

View File

@ -0,0 +1,5 @@
#Generated by Maven
#Mon Jul 25 15:29:06 CST 2022
groupId=cn.zyjblogs.starter
artifactId=zyjblogs-common-spring-boot-starter
version=1.0-SNAPSHOT

View File

@ -0,0 +1,82 @@
<?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">
<parent>
<artifactId>zyjblogs-parent</artifactId>
<groupId>cn.zyjblogs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cn.zyjblogs.starter</groupId>
<artifactId>zyjblogs-common-spring-boot-starter</artifactId>
<version>${zyjblogs.version}</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- Spring 集成 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<!-- 第三方工具库 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-crypto</artifactId>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -9,11 +9,91 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.zyjblogs.pubilc</groupId>
<artifactId>zyjblogs-gateway</artifactId> <artifactId>zyjblogs-gateway</artifactId>
<version>${zyjblogs.version}</version>
<properties> <properties>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
</properties> </properties>
<dependencies>
<!-- 加入sentinel-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- 加入actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<!-- 集成nacos-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<exclusions>
<exclusion>
<artifactId>checker-qual</artifactId>
<groupId>org.checkerframework</groupId>
</exclusion>
<exclusion>
<artifactId>error_prone_annotations</artifactId>
<groupId>com.google.errorprone</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 集成 Nacos 作为服务注册中心配置 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- 网关 配置 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!--sentinel持久化存储-->
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.security.oauth.boot</groupId>-->
<!-- <artifactId>spring-security-oauth2-autoconfigure</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>cn.zyjblogs.starter</groupId>
<artifactId>zyjblogs-common-spring-boot-starter</artifactId>
<version>${zyjblogs.version}</version>
</dependency>
</dependencies>
</project> </project>

View File

@ -0,0 +1,25 @@
package cn.zyjblogs.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* Copyright (C), 2021, 北京同创永益科技发展有限公司
*
* @author zhuyijun
* @version 3.0.0
* @description
* @date 2022/8/18 9:28
*/
@EnableAsync
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}

View File

@ -0,0 +1,147 @@
package cn.zyjblogs.gateway.filter;
import cn.zyjblogs.common.entity.constant.HttpHeaderConstant;
import cn.zyjblogs.common.entity.response.ResponseObject;
import cn.zyjblogs.common.entity.response.ResponseResult;
import cn.zyjblogs.common.entity.response.ResponseStatus;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
import java.util.List;
/**
* Copyright (C), 2021, 北京同创永益科技发展有限公司
*
* @author tanyuanzhi
* @version 3.0.0
* description token校验过滤器要在WebsocketRoutingFilter过滤器之后huo
* @date 2021/11/1 16:22
*/
@Component
@Slf4j
@EnableConfigurationProperties(WhiteListProperties.class)
@RequiredArgsConstructor
public class AuthFilter implements GlobalFilter {
private final WhiteListProperties whiteListProperties;
private AntPathMatcher antPathMatcher = new AntPathMatcher();
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//添加网关标记
ServerHttpRequest serverHttpRequest = exchange.getRequest().mutate()
.headers(h -> h.add(HttpHeaderConstant.REQUEST_FROM_GATEWAY_KEY, HttpHeaderConstant.REQUEST_FROM_GATEWAY_VALUE))
.build();
ServerWebExchange build = exchange.mutate().request(serverHttpRequest).build();
ServerHttpRequest request = build.getRequest();
ServerHttpResponse response = build.getResponse();
String token = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
log.debug("token:{}", token);
String path = request.getURI().getPath();
String methodType = request.getMethodValue().toLowerCase();
Route route = (Route) exchange.getAttributes().get(ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR);
String routeId = route.getId();
//白名单请求直接放行
if (isWhileList(path)) {
return chain.filter(exchange);
}
if (isExpired(token)) {
log.info("token过期");
return getErrorMono(response, ResponseStatus.UNAUTHORIZED, "invalid_token");
}
if ("/user/login".equals(path)) {
return chain.filter(exchange);
}
// if (!TokenUtil.checkToken(token)) {
// return getErrorMono(response, ResponseStatus.UNAUTHORIZED, "invalid_token");
// }
/*boolean hasPermission = hasPermission(routeId, methodType, path);
if (!hasPermission) {
log.warn("无权限访问path:{}", path);
return getErrorMono(response, ResponseCode.FORBIDDEN, "no_access");
}*/
return chain.filter(build);
}
/**
* token是否过期
*
* @param token token
* @return 过期true
* @author tanyuanzhi
* @date 2021/11/15 19:17
*/
private boolean isExpired(String token) {
if (StringUtils.isEmpty(token)) {
return false;
}
if (!token.startsWith(HttpHeaderConstant.AUTHORIZATION_TYPE)) {
return false;
}
String jwt = token.replace(HttpHeaderConstant.AUTHORIZATION_TYPE + " ", "");
return true;
}
/**
* 是否是白名单
*
* @param path 当前路径
* @return 是否是白名单中的地址
* @author tanyuanzhi
* @date 2021/11/2 9:15
*/
private boolean isWhileList(String path) {
List<String> allowPaths = whiteListProperties.getAllowPaths();
if (CollectionUtils.isEmpty(allowPaths)) {
return false;
}
return allowPaths.stream().anyMatch(allowPath -> antPathMatcher.match(allowPath, path));
}
/**
* 验证不通过时的返回
*
* @param response 响应
* @param responseCode 响应码
* @return reactor.core.publisher.Mono<java.lang.Void>
* @date 2021/11/1 17:10
*/
private Mono<Void> getErrorMono(ServerHttpResponse response, ResponseStatus responseCode, String msg) {
response.getHeaders().setContentType(MediaType.APPLICATION_JSON);
response.setStatusCode(HttpStatus.OK);
ResponseObject<Object> responseObject = ResponseResult.error(responseCode, msg);
ObjectMapper mapper = new ObjectMapper();
byte[] bytes = new byte[0];
try {
bytes = mapper.writeValueAsBytes(responseObject);
} catch (JsonProcessingException e) {
log.error("转换错误");
}
DataBuffer wrap = response.bufferFactory().wrap(bytes);
return response.writeWith(Mono.just(wrap));
}
}

View File

@ -0,0 +1,16 @@
package cn.zyjblogs.gateway.filter;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
/**
* 白名单
*/
@Data
@ConfigurationProperties(prefix = "zyjblogs.whilelist")
public class WhiteListProperties {
private List<String> allowPaths;
}

View File

@ -0,0 +1,8 @@
zyjblogs:
config:
nacos:
host: ${HATECH_CONFIG_NACOS_HOST:127.0.0.1}
port: ${HATECH_CONFIG_NACOS_PORT:8848}
username: ${HATECH_CONFIG_NACOS_USERNAME:nacos}
password: ${HATECH_CONFIG_NACOS_PASSWORD:nacos}

View File

@ -0,0 +1,28 @@
spring:
profiles:
active: test
---
spring:
application:
name: zyjblogs-gateway
cloud:
nacos:
config:
server-addr: ${zyjblogs.config.nacos.host}:${zyjblogs.config.nacos.port}
username: ${zyjblogs.config.nacos.username}
password: ${zyjblogs.config.nacos.password}
namespace: ${spring.profiles.active}
group: public
file-extension: yml
shared-configs[0]:
data-id: zyjblogs-global-${spring.profiles.active}.yml
group: global
discovery:
server-addr: ${spring.cloud.nacos.config.server-addr}
username: ${spring.cloud.nacos.config.username}
password: ${spring.cloud.nacos.config.password}
namespace: ${spring.cloud.nacos.config.namespace}
group: public
logging:
config: classpath:logback-spring.xml

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 获取application.yml配置文件中的属性 -->
<springProperty scope="context" name="SPRING_APPLICATION_NAME" source="spring.application.name"/>
<springProperty scope="context" name="SPRING_PROFILES_ACTIVE" source="spring.profiles.active"/>
<!-- 配置文件存放路径 -->
<property name="logger.path" value="./log/${SPRING_APPLICATION_NAME}/${SPRING_PROFILES_ACTIVE}" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr([%X{traceId}]) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 输出到控制台 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件 -->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logger.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%X{traceId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${logger.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<!-- 日志采集保留天数 -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logger.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%X{traceId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${logger.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<!-- 日志采集保留天数 -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logger.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%X{traceId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logger.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<!-- 日志采集保留天数 -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${logger.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%X{traceId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logger.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<!-- 日志采集保留天数 -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
root节点是必选节点用来指定最基础的日志输出级别只有一个level属性
level:用来设置打印级别大小写无关TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素标识这个appender将会添加到这个logger。
-->
<!-- 开发环境配置 -->
<springProfile name="dev">
<root level="debug">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<!-- 测试环境配置 -->
<springProfile name="test">
<root level="debug">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<!-- 上线环境配置 -->
<springProfile name="prod">
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<!-- 高可用环境配置-->
<springProfile name="ha">
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<!-- k8s环境配置-->
<springProfile name="k8s">
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
</configuration>

View File

@ -9,7 +9,9 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.zyjblogs.pubilc</groupId>
<artifactId>zyjblogs-oauth</artifactId> <artifactId>zyjblogs-oauth</artifactId>
<version>${zyjblogs.version}</version>
<properties> <properties>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>

View File

@ -1,8 +1,8 @@
hatech: zyjblogs:
config: config:
nacos: nacos:
host: ${HATECH_CONFIG_NACOS_HOST:127.0.0.1} host: ${ZYJBLOGS_CONFIG_NACOS_HOST:127.0.0.1}
port: ${HATECH_CONFIG_NACOS_PORT:8848} port: ${ZYJBLOGS_CONFIG_NACOS_PORT:8848}
username: ${HATECH_CONFIG_NACOS_USERNAME:nacos} username: ${ZYJBLOGS_CONFIG_NACOS_USERNAME:nacos}
password: ${HATECH_CONFIG_NACOS_PASSWORD:nacos} password: ${ZYJBLOGS_CONFIG_NACOS_PASSWORD:nacos}

View File

@ -9,9 +9,9 @@ spring:
cloud: cloud:
nacos: nacos:
config: config:
server-addr: ${hatech.config.nacos.host}:${hatech.config.nacos.port} server-addr: ${zyjblogs.config.nacos.host}:${zyjblogs.config.nacos.port}
username: ${hatech.config.nacos.username} username: ${zyjblogs.config.nacos.username}
password: ${hatech.config.nacos.password} password: ${zyjblogs.config.nacos.password}
namespace: ${spring.profiles.active} namespace: ${spring.profiles.active}
group: public group: public
file-extension: yml file-extension: yml

View File

@ -8,8 +8,9 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.zyjblogs.pubilc</groupId>
<artifactId>zyjblogs-rbac</artifactId> <artifactId>zyjblogs-rbac</artifactId>
<version>${zyjblogs.version}</version>
<properties> <properties>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>

View File

@ -19,9 +19,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@SpringBootApplication @SpringBootApplication
public class RbacApplication { public class RbacApplication {
public static void main(String[] args) { public static void main(String[] args) {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
System.out.println(bCryptPasswordEncoder.encode("secret"));
SpringApplication.run(RbacApplication.class, args); SpringApplication.run(RbacApplication.class, args);
} }
} }

View File

@ -1,8 +1,8 @@
hatech: zyjblogs:
config: config:
nacos: nacos:
host: ${HATECH_CONFIG_NACOS_HOST:127.0.0.1} host: ${ZYJBLOGS_CONFIG_NACOS_HOST:127.0.0.1}
port: ${HATECH_CONFIG_NACOS_PORT:8848} port: ${ZYJBLOGS_CONFIG_NACOS_PORT:8848}
username: ${HATECH_CONFIG_NACOS_USERNAME:nacos} username: ${ZYJBLOGS_CONFIG_NACOS_USERNAME:nacos}
password: ${HATECH_CONFIG_NACOS_PASSWORD:nacos} password: ${ZYJBLOGS_CONFIG_NACOS_PASSWORD:nacos}

View File

@ -9,9 +9,9 @@ spring:
cloud: cloud:
nacos: nacos:
config: config:
server-addr: ${hatech.config.nacos.host}:${hatech.config.nacos.port} server-addr: ${zyjblogs.config.nacos.host}:${zyjblogs.config.nacos.port}
username: ${hatech.config.nacos.username} username: ${zyjblogs.config.nacos.username}
password: ${hatech.config.nacos.password} password: ${zyjblogs.config.nacos.password}
namespace: ${spring.profiles.active} namespace: ${spring.profiles.active}
group: public group: public
file-extension: yml file-extension: yml