🔖 Releasing / Version tags. 3.7.0-snapshot

This commit is contained in:
lbw 2023-07-07 16:12:01 +08:00
parent 1472ee11af
commit 80096f2d88
312 changed files with 12916 additions and 5943 deletions

View File

@ -2,12 +2,12 @@
| 依赖 | 版本 |
| ---------------------- |----------------|
| Spring Boot | 3.1.0 |
| Spring Boot | 3.1.1 |
| Spring Cloud | 2022.0.3 |
| Spring Cloud Alibaba | 2022.0.0.0-RC2 |
| Spring Authorization Server | 1.1.0 |
| Spring Authorization Server | 1.1.1 |
| Mybatis Plus | 3.5.3.1 |
| hutool | 5.8.18 |
| hutool | 5.8.20 |
### 模块说明

View File

@ -11,3 +11,5 @@ COPY ./pig.sql /docker-entrypoint-initdb.d
COPY ./pig_codegen.sql /docker-entrypoint-initdb.d
COPY ./pig_config.sql /docker-entrypoint-initdb.d
COPY ./pig_job.sql /docker-entrypoint-initdb.d

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -37,13 +37,13 @@ CREATE TABLE `config_info` (
-- Records of config_info
-- ----------------------------
BEGIN;
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pig\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n \n# Spring 相关\nspring:\n cache:\n type: redis\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n configuration:\n map-underscore-to-camel-case: true\n\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}\n token-url: ${swagger.gateway}/auth/oauth2/token\n scope: server', 'c9b41bce3b5ce5802d6592cab001f791', '2022-05-08 12:10:37', '2023-05-26 13:57:59', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (1, 'application-dev.yml', 'DEFAULT_GROUP', '# 配置文件加密根密码\njasypt:\n encryptor:\n password: pig\n algorithm: PBEWithMD5AndDES\n iv-generator-classname: org.jasypt.iv.NoIvGenerator\n \n# Spring 相关\nspring:\n cache:\n type: redis\n data:\n redis:\n host: pig-redis\n cloud:\n sentinel:\n eager: true\n transport:\n dashboard: pig-sentinel:5003\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \"*\" \n endpoint:\n health:\n show-details: ALWAYS\n\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# mybaits-plus配置\nmybatis-plus:\n mapper-locations: classpath:/mapper/*Mapper.xml\n global-config:\n banner: false\n db-config:\n id-type: auto\n table-underline: true\n logic-delete-value: 1\n logic-not-delete-value: 0\n type-handlers-package: com.pig4cloud.pig.common.mybatis.handler\n configuration:\n map-underscore-to-camel-case: true\n\n# swagger 配置\nswagger:\n enabled: true\n title: Pig Swagger API\n gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}\n token-url: ${swagger.gateway}/auth/oauth2/token\n scope: server\n services:\n pig-upms-biz: admin\n pig-codegen: gen', '1a4bfc475f9e6ddfd39e580d6f834180', '2022-05-08 12:10:37', '2023-07-05 07:16:04', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (2, 'pig-auth-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n freemarker:\n allow-request-override: false\n allow-session-override: false\n cache: true\n charset: UTF-8\n check-template-location: true\n content-type: text/html\n enabled: true\n expose-request-attributes: false\n expose-session-attributes: false\n expose-spring-macro-helpers: true\n prefer-file-system-access: true\n suffix: .ftl\n template-loader-path: classpath:/templates/', '74f53b71c7799aa754da75662378b93c', '2022-05-08 12:10:37', '2022-06-04 14:15:35', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (3, 'pig-codegen-dev.yml', 'DEFAULT_GROUP', '## spring security 配置1\nsecurity:\n oauth2:\n client:\n client-id: ENC(27v1agvAug87ANOVnbKdsw==)\n client-secret: ENC(VbnkopxrwgbFVKp+UxJ2pg==)\n scope: server\n\n# 数据源配置\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n', '6c6e48b793671dc2a0adffe2e2c27fb0', '2022-05-08 12:10:37', '2022-12-15 23:05:35', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n # 固定路由转发配置 无修改\n - id: openapi\n uri: lb://pig-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?<path>.*), /$\\{path}/$\\{path}/v3/api-docs\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test\n - client', '000988cf0102382d3f23df35027b47fd', '2022-05-08 12:10:37', '2022-06-07 14:00:11', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (3, 'pig-codegen-dev.yml', 'DEFAULT_GROUP', '# 数据源配置\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n resources:\n static-locations: classpath:/static/,classpath:/views/\n', 'cf786dbe3b07074fc187bf2eab3266b1', '2022-05-08 12:10:37', '2023-01-28 14:05:36', '', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (4, 'pig-gateway-dev.yml', 'DEFAULT_GROUP', 'spring:\n cloud:\n gateway:\n locator:\n enabled: true\n routes:\n # 认证中心\n - id: pig-auth\n uri: lb://pig-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - ValidateCodeGatewayFilter\n # 前端密码解密\n - PasswordDecoderFilter\n #UPMS 模块\n - id: pig-upms-biz\n uri: lb://pig-upms-biz\n predicates:\n - Path=/admin/**\n filters:\n # 限流配置\n - name: RequestRateLimiter\n args:\n key-resolver: \'#{@remoteAddrKeyResolver}\'\n redis-rate-limiter.replenishRate: 100\n redis-rate-limiter.burstCapacity: 200\n # 代码生成模块\n - id: pig-codegen\n uri: lb://pig-codegen\n predicates:\n - Path=/gen/**\n # 代码生成模块\n - id: pig-quartz\n uri: lb://pig-quartz\n predicates:\n - Path=/job/**\n # 固定路由转发配置 无修改\n - id: openapi\n uri: lb://pig-gateway\n predicates:\n - Path=/v3/api-docs/**\n filters:\n - RewritePath=/v3/api-docs/(?<path>.*), /$\\{path}/$\\{path}/v3/api-docs\n\ngateway:\n encode-key: \'thanks,pig4cloud\'\n ignore-clients:\n - test\n - client', 'cde041935aeeb2a5f59bf3b56d78f56d', '2022-05-08 12:10:37', '2023-07-05 13:50:59', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (5, 'pig-monitor-dev.yml', 'DEFAULT_GROUP', 'spring:\n autoconfigure:\n exclude: com.pig4cloud.pig.common.core.config.JacksonConfiguration\n # 安全配置\n security:\n user:\n name: ENC(8Hk2ILNJM8UTOuW/Xi75qg==) # pig\n password: ENC(o6cuPFfUevmTbkmBnE67Ow====) # pig\n', '650bdfa15f60f3faa84dfe6e6878b8cf', '2022-05-08 12:10:37', '2022-05-08 12:10:37', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL, '');
INSERT INTO `config_info` VALUES (6, 'pig-upms-biz-dev.yml', 'DEFAULT_GROUP', 'security:\n oauth2:\n client:\n client-id: ENC(imENTO7M8bLO38LFSIxnzw==)\n client-secret: ENC(i3cDFhs26sa2Ucrfz2hnQw==)\n scope: server\n\n# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n\n# 文件上传相关 支持阿里云、华为云、腾讯、minio\noss:\n endpoint: http://minio.pig4cloud.com\n accessKey: lengleng\n secretKey: lengleng\n bucket-name: tmp', '107614b40932e8237787b769e0937ed2', '2022-05-08 12:10:37', '2022-05-08 12:10:37', NULL, '127.0.0.1', '', '', NULL, NULL, NULL, 'yaml', NULL, '');
INSERT INTO `config_info` VALUES (7, 'pig-xxl-job-admin-dev.yml', 'DEFAULT_GROUP', '# xxl\nxxl:\n job:\n accessToken: default_token\n i18n: zh_CN\n logretentiondays: 30\n triggerpool:\n fast.max: 200\n slow.max: 200\n\n# mybatis\nmybatis:\n mapper-locations: classpath:/mybatis-mapper/*Mapper.xml\n\nspring:\n datasource:\n url: jdbc:mysql://${MYSQL_HOST:pig-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pig_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n mvc:\n static-path-pattern: /static/**\n freemarker:\n suffix: .ftl\n request-context-attribute: request\n settings:\n number_format: 0.##########\n mail:\n host: smtp.mxhichina.com\n port: 465\n from: xxxx@gitee.wang\n username: xxxx@gitee.wang\n password: xxxx\n properties:\n mail:\n smtp:\n auth: true\n ssl.enable: true\n starttls.enable: false\n required: false\n# spring boot admin 配置\n\nmanagement:\n health:\n mail:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS\n\n', 'b67cbbd37c8b42cdc6521780b3ed742a', '2022-11-27 17:23:42', '2022-11-27 17:28:01', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (6, 'pig-upms-biz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n\n# 文件上传相关 支持阿里云、华为云、腾讯、minio\nfile:\n bucketName: s3demo \n local:\n enable: true\n base-path: /Users/lengleng/Downloads/img', '48f8db128aeb5debb331bae49ff37908', '2022-05-08 12:10:37', '2023-07-07 14:44:09', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', '', '');
INSERT INTO `config_info` VALUES (7, 'pig-quartz-dev.yml', 'DEFAULT_GROUP', 'spring:\n datasource:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: root\n password: root\n url: jdbc:mysql://pig-mysql:3306/pig_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true\n quartz:\n #相关属性配置\n properties:\n org:\n quartz:\n scheduler:\n instanceName: clusteredScheduler\n instanceId: AUTO\n jobStore:\n class: org.springframework.scheduling.quartz.LocalDataSourceJobStore\n driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate\n tablePrefix: QRTZ_\n isClustered: true\n clusterCheckinInterval: 10000\n useProperties: false\n threadPool:\n class: org.quartz.simpl.SimpleThreadPool\n threadCount: 50\n threadPriority: 5\n threadsInheritContextClassLoaderOfInitializingThread: true\n #数据库方式\n job-store-type: jdbc\n #初始化表结构\n #jdbc:\n #initialize-schema: never\n web:\n resources:\n static-locations: classpath:/static/,classpath:/views/\n\n', '3e404971f6f49aa3ff22323b227debe0', '2023-07-02 12:24:33', '2023-07-02 13:46:04', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', '');
COMMIT;
-- ----------------------------

502
db/pig_job.sql Normal file
View File

@ -0,0 +1,502 @@
DROP DATABASE IF EXISTS `pig_job`;
CREATE DATABASE `pig_job` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
USE pig_job;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for qrtz_blob_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_blob_triggers`;
CREATE TABLE `qrtz_blob_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`blob_data` blob,
PRIMARY KEY (`sched_name`,`trigger_name`,`trigger_group`) USING BTREE,
CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_blob_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_calendars
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_calendars`;
CREATE TABLE `qrtz_calendars` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`calendar_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`calendar` blob NOT NULL,
PRIMARY KEY (`sched_name`,`calendar_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_calendars
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_cron_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_cron_triggers`;
CREATE TABLE `qrtz_cron_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`cron_expression` varchar(200) CHARACTER SET utf8 NOT NULL,
`time_zone_id` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`sched_name`,`trigger_name`,`trigger_group`) USING BTREE,
CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_cron_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_fired_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_fired_triggers`;
CREATE TABLE `qrtz_fired_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`entry_id` varchar(95) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`instance_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`fired_time` bigint NOT NULL,
`sched_time` bigint NOT NULL,
`priority` int NOT NULL,
`state` varchar(16) CHARACTER SET utf8 NOT NULL,
`job_name` varchar(200) CHARACTER SET utf8 DEFAULT NULL,
`job_group` varchar(200) CHARACTER SET utf8 DEFAULT NULL,
`is_nonconcurrent` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`requests_recovery` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`sched_name`,`entry_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_fired_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_job_details
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_job_details`;
CREATE TABLE `qrtz_job_details` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`job_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`job_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`description` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
`job_class_name` varchar(250) CHARACTER SET utf8 NOT NULL,
`is_durable` varchar(1) CHARACTER SET utf8 NOT NULL,
`is_nonconcurrent` varchar(1) CHARACTER SET utf8 NOT NULL,
`is_update_data` varchar(1) CHARACTER SET utf8 NOT NULL,
`requests_recovery` varchar(1) CHARACTER SET utf8 NOT NULL,
`job_data` blob,
PRIMARY KEY (`sched_name`,`job_name`,`job_group`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_job_details
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_locks
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_locks`;
CREATE TABLE `qrtz_locks` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`lock_name` varchar(40) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`sched_name`,`lock_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_locks
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_paused_trigger_grps
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
CREATE TABLE `qrtz_paused_trigger_grps` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`sched_name`,`trigger_group`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_paused_trigger_grps
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_scheduler_state
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_scheduler_state`;
CREATE TABLE `qrtz_scheduler_state` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`instance_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`last_checkin_time` bigint NOT NULL,
`checkin_interval` bigint NOT NULL,
PRIMARY KEY (`sched_name`,`instance_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_scheduler_state
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_simple_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_simple_triggers`;
CREATE TABLE `qrtz_simple_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`repeat_count` bigint NOT NULL,
`repeat_interval` bigint NOT NULL,
`times_triggered` bigint NOT NULL,
PRIMARY KEY (`sched_name`,`trigger_name`,`trigger_group`) USING BTREE,
CONSTRAINT `QRTZ_SIMPLE_TRIGGERS_IBFK_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_simple_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_simprop_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
CREATE TABLE `qrtz_simprop_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`str_prop_1` varchar(512) CHARACTER SET utf8 DEFAULT NULL,
`str_prop_2` varchar(512) CHARACTER SET utf8 DEFAULT NULL,
`str_prop_3` varchar(512) CHARACTER SET utf8 DEFAULT NULL,
`int_prop_1` int DEFAULT NULL,
`int_prop_2` int DEFAULT NULL,
`long_prop_1` bigint DEFAULT NULL,
`long_prop_2` bigint DEFAULT NULL,
`dec_prop_1` decimal(13,4) DEFAULT NULL,
`dec_prop_2` decimal(13,4) DEFAULT NULL,
`bool_prop_1` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`bool_prop_2` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`sched_name`,`trigger_name`,`trigger_group`) USING BTREE,
CONSTRAINT `QRTZ_SIMPROP_TRIGGERS_IBFK_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_simprop_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for qrtz_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_triggers`;
CREATE TABLE `qrtz_triggers` (
`sched_name` varchar(120) CHARACTER SET utf8 NOT NULL,
`trigger_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`trigger_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`job_name` varchar(200) CHARACTER SET utf8 NOT NULL,
`job_group` varchar(200) CHARACTER SET utf8 NOT NULL,
`description` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
`next_fire_time` bigint DEFAULT NULL,
`prev_fire_time` bigint DEFAULT NULL,
`priority` int DEFAULT NULL,
`trigger_state` varchar(16) CHARACTER SET utf8 NOT NULL,
`trigger_type` varchar(8) CHARACTER SET utf8 NOT NULL,
`start_time` bigint NOT NULL,
`end_time` bigint DEFAULT NULL,
`calendar_name` varchar(200) CHARACTER SET utf8 DEFAULT NULL,
`misfire_instr` smallint DEFAULT NULL,
`job_data` blob,
PRIMARY KEY (`sched_name`,`trigger_name`,`trigger_group`) USING BTREE,
KEY `sched_name` (`sched_name`,`job_name`,`job_group`) USING BTREE,
CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of qrtz_triggers
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for sys_job
-- ----------------------------
DROP TABLE IF EXISTS `sys_job`;
CREATE TABLE `sys_job` (
`job_id` bigint NOT NULL COMMENT '任务id',
`job_name` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '任务名称',
`job_group` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '任务组名',
`job_order` char(1) CHARACTER SET utf8mb4 DEFAULT '1' COMMENT '组内执行顺利值越大执行优先级越高最大值9最小值1',
`job_type` char(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '1' COMMENT '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他',
`execute_path` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'job_type=3时rest调用地址仅支持rest get协议,需要增加String返回值0成功1失败;job_type=4时jar路径;其它值为空',
`class_name` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'job_type=1时类完整路径;job_type=2时spring bean名称;其它值为空',
`method_name` varchar(500) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '任务方法',
`method_params_value` varchar(2000) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '参数值',
`cron_expression` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'cron执行表达式',
`misfire_policy` varchar(20) CHARACTER SET utf8mb4 DEFAULT '3' COMMENT '错失执行策略1错失周期立即执行 2错失周期执行一次 3下周期执行',
`job_tenant_type` char(1) CHARACTER SET utf8mb4 DEFAULT '1' COMMENT '1、多租户任务;2、非多租户任务',
`job_status` char(1) CHARACTER SET utf8mb4 DEFAULT '0' COMMENT '状态1、未发布;2、运行中;3、暂停;4、删除;',
`job_execute_status` char(1) CHARACTER SET utf8mb4 DEFAULT '0' COMMENT '状态0正常 1异常',
`create_by` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` varchar(64) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`start_time` timestamp NULL DEFAULT NULL COMMENT '初次执行时间',
`previous_time` timestamp NULL DEFAULT NULL COMMENT '上次执行时间',
`next_time` timestamp NULL DEFAULT NULL COMMENT '下次执行时间',
`remark` varchar(500) CHARACTER SET utf8mb4 DEFAULT '' COMMENT '备注信息',
PRIMARY KEY (`job_id`,`job_name`,`job_group`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='定时任务调度表';
-- ----------------------------
-- Records of sys_job
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for sys_job_log
-- ----------------------------
DROP TABLE IF EXISTS `sys_job_log`;
CREATE TABLE `sys_job_log` (
`job_log_id` bigint NOT NULL COMMENT '任务日志ID',
`job_id` bigint NOT NULL COMMENT '任务id',
`job_name` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务名称',
`job_group` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务组名',
`job_order` char(1) CHARACTER SET utf8 DEFAULT NULL COMMENT '组内执行顺利值越大执行优先级越高最大值9最小值1',
`job_type` char(1) CHARACTER SET utf8 NOT NULL DEFAULT '1' COMMENT '1、java类;2、spring bean名称;3、rest调用;4、jar调用;9其他',
`execute_path` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT 'job_type=3时rest调用地址仅支持post协议;job_type=4时jar路径;其它值为空',
`class_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT 'job_type=1时类完整路径;job_type=2时spring bean名称;其它值为空',
`method_name` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '任务方法',
`method_params_value` varchar(2000) CHARACTER SET utf8 DEFAULT NULL COMMENT '参数值',
`cron_expression` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT 'cron执行表达式',
`job_message` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '日志信息',
`job_log_status` char(1) CHARACTER SET utf8 DEFAULT '0' COMMENT '执行状态0正常 1失败',
`execute_time` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '执行时间',
`exception_info` varchar(2000) CHARACTER SET utf8 DEFAULT '' COMMENT '异常信息',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`job_log_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='定时任务执行日志表';
-- ----------------------------
-- Records of sys_job_log
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_group
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_group`;
CREATE TABLE `xxl_job_group` (
`id` int NOT NULL AUTO_INCREMENT,
`app_name` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT '执行器AppName',
`title` varchar(12) CHARACTER SET utf8mb4 NOT NULL COMMENT '执行器名称',
`address_type` tinyint NOT NULL DEFAULT '0' COMMENT '执行器地址类型0=自动注册、1=手动录入',
`address_list` text CHARACTER SET utf8mb4 COMMENT '执行器地址列表,多地址逗号分隔',
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_group
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_info
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_info`;
CREATE TABLE `xxl_job_info` (
`id` int NOT NULL AUTO_INCREMENT,
`job_group` int NOT NULL COMMENT '执行器主键ID',
`job_desc` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`author` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '作者',
`alarm_email` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '报警邮件',
`schedule_type` varchar(50) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'NONE' COMMENT '调度类型',
`schedule_conf` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '调度配置,值含义取决于调度类型',
`misfire_strategy` varchar(50) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'DO_NOTHING' COMMENT '调度过期策略',
`executor_route_strategy` varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器路由策略',
`executor_handler` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(512) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器任务参数',
`executor_block_strategy` varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '阻塞处理策略',
`executor_timeout` int NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
`executor_fail_retry_count` int NOT NULL DEFAULT '0' COMMENT '失败重试次数',
`glue_type` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT 'GLUE类型',
`glue_source` mediumtext CHARACTER SET utf8mb4 COMMENT 'GLUE源代码',
`glue_remark` varchar(128) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'GLUE备注',
`glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间',
`child_jobid` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '子任务ID多个逗号分隔',
`trigger_status` tinyint NOT NULL DEFAULT '0' COMMENT '调度状态0-停止1-运行',
`trigger_last_time` bigint NOT NULL DEFAULT '0' COMMENT '上次调度时间',
`trigger_next_time` bigint NOT NULL DEFAULT '0' COMMENT '下次调度时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_info
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_lock
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_lock`;
CREATE TABLE `xxl_job_lock` (
`lock_name` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '锁名称',
PRIMARY KEY (`lock_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_lock
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_log
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_log`;
CREATE TABLE `xxl_job_log` (
`id` bigint NOT NULL AUTO_INCREMENT,
`job_group` int NOT NULL COMMENT '执行器主键ID',
`job_id` int NOT NULL COMMENT '任务主键ID',
`executor_address` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
`executor_handler` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(512) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器任务参数',
`executor_sharding_param` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '执行器任务分片参数,格式如 1/2',
`executor_fail_retry_count` int NOT NULL DEFAULT '0' COMMENT '失败重试次数',
`trigger_time` datetime DEFAULT NULL COMMENT '调度-时间',
`trigger_code` int NOT NULL COMMENT '调度-结果',
`trigger_msg` text CHARACTER SET utf8mb4 COMMENT '调度-日志',
`handle_time` datetime DEFAULT NULL COMMENT '执行-时间',
`handle_code` int NOT NULL COMMENT '执行-状态',
`handle_msg` text CHARACTER SET utf8mb4 COMMENT '执行-日志',
`alarm_status` tinyint NOT NULL DEFAULT '0' COMMENT '告警状态0-默认、1-无需告警、2-告警成功、3-告警失败',
PRIMARY KEY (`id`) USING BTREE,
KEY `I_trigger_time` (`trigger_time`) USING BTREE,
KEY `I_handle_code` (`handle_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_log
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_log_report
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_log_report`;
CREATE TABLE `xxl_job_log_report` (
`id` int NOT NULL AUTO_INCREMENT,
`trigger_day` datetime DEFAULT NULL COMMENT '调度-时间',
`running_count` int NOT NULL DEFAULT '0' COMMENT '运行中-日志数量',
`suc_count` int NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量',
`fail_count` int NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_log_report
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_logglue
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_logglue`;
CREATE TABLE `xxl_job_logglue` (
`id` int NOT NULL AUTO_INCREMENT,
`job_id` int NOT NULL COMMENT '任务主键ID',
`glue_type` varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'GLUE类型',
`glue_source` mediumtext CHARACTER SET utf8mb4 COMMENT 'GLUE源代码',
`glue_remark` varchar(128) CHARACTER SET utf8mb4 NOT NULL COMMENT 'GLUE备注',
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_logglue
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_registry
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_registry`;
CREATE TABLE `xxl_job_registry` (
`id` int NOT NULL AUTO_INCREMENT,
`registry_group` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
`registry_key` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`registry_value` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_registry
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_user
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_user`;
CREATE TABLE `xxl_job_user` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '账号',
`password` varchar(50) CHARACTER SET utf8mb4 NOT NULL COMMENT '密码',
`role` tinyint NOT NULL COMMENT '角色0-普通用户、1-管理员',
`permission` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '权限执行器ID列表多个逗号分割',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `i_username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ----------------------------
-- Records of xxl_job_user
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -73,3 +73,10 @@ services:
container_name: pig-codegen
hostname: pig-codegen
image: pig-codegen
pig-daemon-quartz:
build:
context: ./pig-visual/pig-quartz
restart: always
image: pig-quartz
container_name: pig-quartz

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-auth</artifactId>

View File

@ -74,19 +74,16 @@ public class AuthorizationServerConfiguration {
.authorizationEndpoint(authorizationEndpoint -> authorizationEndpoint// 授权码端点个性化confirm页面
.consentPage(SecurityConstants.CUSTOM_CONSENT_PAGE_URI)));
DefaultSecurityFilterChain securityFilterChain = http.authorizeHttpRequests(authorizeRequests -> {
http.authorizeHttpRequests(authorizeRequests -> {
// 自定义接口端点暴露
authorizeRequests.requestMatchers("/token/**", "/actuator/**", "/css/**", "/error").permitAll();
authorizeRequests.anyRequest().authenticated();
})
.apply(authorizationServerConfigurer.authorizationService(authorizationService)// redis存储token的实现
.authorizationServerSettings(
AuthorizationServerSettings.builder().issuer(SecurityConstants.PROJECT_LICENSE).build()))
// 授权码登录的登录页个性化
.and()
.apply(new FormIdentityLoginConfigurer())
.and()
.build();
AuthorizationServerSettings.builder().issuer(SecurityConstants.PROJECT_LICENSE).build()));
http.apply(new FormIdentityLoginConfigurer());
DefaultSecurityFilterChain securityFilterChain = http.build();
// 注入自定义授权模式实现
addCustomOAuth2GrantAuthenticationProvider(http);

View File

@ -22,6 +22,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer;
import org.springframework.security.web.SecurityFilterChain;
/**
@ -44,12 +47,8 @@ public class WebSecurityConfiguration {
http.authorizeHttpRequests(authorizeRequests -> authorizeRequests.requestMatchers("/token/*")
.permitAll()// 开放自定义的部分端点
.anyRequest()
.authenticated())
.headers()
.frameOptions()
.sameOrigin()// 避免iframe同源无法登录
.and()
.apply(new FormIdentityLoginConfigurer()); // 表单登录个性化
.authenticated()).headers(header -> header.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)// 避免iframe同源无法登录许iframe
).apply(new FormIdentityLoginConfigurer()); // 表单登录个性化
// 处理 UsernamePasswordAuthenticationToken
http.authenticationProvider(new PigDaoAuthenticationProvider());
return http.build();
@ -68,12 +67,9 @@ public class WebSecurityConfiguration {
SecurityFilterChain resources(HttpSecurity http) throws Exception {
http.securityMatchers((matchers) -> matchers.requestMatchers("/actuator/**", "/css/**", "/error"))
.authorizeHttpRequests((authorize) -> authorize.anyRequest().permitAll())
.requestCache()
.disable()
.securityContext()
.disable()
.sessionManagement()
.disable();
.requestCache(RequestCacheConfigurer::disable)
.securityContext(AbstractHttpConfigurer::disable)
.sessionManagement(AbstractHttpConfigurer::disable);
return http.build();
}

View File

@ -27,6 +27,7 @@ import com.pig4cloud.pig.admin.api.vo.TokenVo;
import com.pig4cloud.pig.auth.support.handler.PigAuthenticationFailureEventHandler;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.core.util.RetOps;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
@ -34,6 +35,8 @@ import com.pig4cloud.pig.common.security.annotation.Inner;
import com.pig4cloud.pig.common.security.util.OAuth2EndpointUtils;
import com.pig4cloud.pig.common.security.util.OAuth2ErrorCodesExpand;
import com.pig4cloud.pig.common.security.util.OAuthClientException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@ -59,8 +62,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.security.Principal;
import java.util.List;
import java.util.Map;
@ -107,7 +108,8 @@ public class PigTokenEndpoint {
@RequestParam(OAuth2ParameterNames.CLIENT_ID) String clientId,
@RequestParam(OAuth2ParameterNames.SCOPE) String scope,
@RequestParam(OAuth2ParameterNames.STATE) String state) {
SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId))
SysOauthClientDetails clientDetails = RetOps
.of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN))
.getData()
.orElseThrow(() -> new OAuthClientException("clientId 不合法"));

View File

@ -31,6 +31,8 @@ public class CustomeOAuth2TokenCustomizer implements OAuth2TokenCustomizer<OAuth
PigUser pigUser = (PigUser) context.getPrincipal().getPrincipal();
claims.claim(SecurityConstants.DETAILS_USER, pigUser);
claims.claim(SecurityConstants.DETAILS_USER_ID, pigUser.getId());
claims.claim(SecurityConstants.USERNAME, pigUser.getUsername());
}
}

View File

@ -22,13 +22,11 @@ public final class FormIdentityLoginConfigurer
formLogin.failureHandler(new FormAuthenticationFailureHandler());
})
.logout() // SSO登出成功处理
.logoutSuccessHandler(new SsoLogoutSuccessHandler())
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true)
.and()
.csrf()
.disable();
.logout(logout -> logout.logoutSuccessHandler(new SsoLogoutSuccessHandler())
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true)) // SSO登出成功处理
.csrf(AbstractHttpConfigurer::disable);
}
}

View File

@ -70,7 +70,7 @@ public class PigDaoAuthenticationProvider extends AbstractUserDetailsAuthenticat
// app 模式不用校验密码
String grantType = WebUtils.getRequest().get().getParameter(OAuth2ParameterNames.GRANT_TYPE);
if (StrUtil.equals(SecurityConstants.APP, grantType)) {
if (StrUtil.equals(SecurityConstants.MOBILE, grantType)) {
return;
}

View File

@ -66,7 +66,7 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu
log.info("用户:{} 登录失败,异常:{}", username, exception.getLocalizedMessage());
SysLog logVo = SysLogUtils.getSysLog();
logVo.setTitle("登录失败");
logVo.setType(LogTypeEnum.ERROR.getType());
logVo.setLogType(LogTypeEnum.ERROR.getType());
logVo.setException(exception.getLocalizedMessage());
// 发送异步日志事件
String startTimeStr = request.getHeader(CommonConstants.REQUEST_START_TIME);
@ -76,7 +76,6 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu
logVo.setTime(endTime - startTime);
}
logVo.setCreateBy(username);
logVo.setUpdateBy(username);
SpringContextHolder.publishEvent(new SysLogEvent(logVo));
// 写出错误信息
sendErrorResponse(request, response, exception);
@ -100,7 +99,7 @@ public class PigAuthenticationFailureEventHandler implements AuthenticationFailu
// 手机号登录
String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE);
if (SecurityConstants.APP.equals(grantType)) {
if (SecurityConstants.MOBILE.equals(grantType)) {
errorMessage = MsgUtils.getSecurityMessage("AbstractUserDetailsAuthenticationProvider.smsBadCredentials");
}

View File

@ -24,7 +24,10 @@ import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import com.pig4cloud.pig.common.log.event.SysLogEvent;
import com.pig4cloud.pig.common.log.util.SysLogUtils;
import com.pig4cloud.pig.common.security.component.PigCustomOAuth2AccessTokenResponseHttpMessageConverter;
import com.pig4cloud.pig.common.security.service.PigUser;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.converter.HttpMessageConverter;
@ -34,13 +37,10 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.core.OAuth2AccessToken;
import org.springframework.security.oauth2.core.OAuth2RefreshToken;
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter;
import org.springframework.security.oauth2.server.authorization.authentication.OAuth2AccessTokenAuthenticationToken;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.util.CollectionUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.temporal.ChronoUnit;
import java.util.Map;
@ -52,7 +52,7 @@ import java.util.Map;
@Slf4j
public class PigAuthenticationSuccessEventHandler implements AuthenticationSuccessHandler {
private final HttpMessageConverter<OAuth2AccessTokenResponse> accessTokenHttpResponseConverter = new OAuth2AccessTokenResponseHttpMessageConverter();
private final HttpMessageConverter<OAuth2AccessTokenResponse> accessTokenHttpResponseConverter = new PigCustomOAuth2AccessTokenResponseHttpMessageConverter();
/**
* Called when a user has been successfully authenticated.
@ -81,7 +81,6 @@ public class PigAuthenticationSuccessEventHandler implements AuthenticationSucce
logVo.setTime(endTime - startTime);
}
logVo.setCreateBy(userInfo.getName());
logVo.setUpdateBy(userInfo.getName());
SpringContextHolder.publishEvent(new SysLogEvent(logVo));
}
@ -115,6 +114,7 @@ public class PigAuthenticationSuccessEventHandler implements AuthenticationSucce
// 无状态 注意删除 context 上下文的信息
SecurityContextHolder.clearContext();
this.accessTokenHttpResponseConverter.write(accessTokenResponse, null, httpResponse);
}

View File

@ -70,7 +70,6 @@ public class PigLogoutSuccessEventHandler implements ApplicationListener<LogoutS
logVo.setServiceId(authentication.getCredentials().toString());
}
logVo.setCreateBy(authentication.getName());
logVo.setUpdateBy(authentication.getName());
SpringContextHolder.publishEvent(new SysLogEvent(logVo));
}

View File

@ -29,13 +29,13 @@ public class OAuth2ResourceOwnerSmsAuthenticationConverter
*/
@Override
public boolean support(String grantType) {
return SecurityConstants.APP.equals(grantType);
return SecurityConstants.MOBILE.equals(grantType);
}
@Override
public OAuth2ResourceOwnerSmsAuthenticationToken buildToken(Authentication clientPrincipal, Set requestedScopes,
Map additionalParameters) {
return new OAuth2ResourceOwnerSmsAuthenticationToken(new AuthorizationGrantType(SecurityConstants.APP),
return new OAuth2ResourceOwnerSmsAuthenticationToken(new AuthorizationGrantType(SecurityConstants.MOBILE),
clientPrincipal, requestedScopes, additionalParameters);
}

View File

@ -52,7 +52,7 @@ public class OAuth2ResourceOwnerSmsAuthenticationProvider
public void checkClient(RegisteredClient registeredClient) {
assert registeredClient != null;
if (!registeredClient.getAuthorizationGrantTypes()
.contains(new AuthorizationGrantType(SecurityConstants.APP))) {
.contains(new AuthorizationGrantType(SecurityConstants.MOBILE))) {
throw new OAuth2AuthenticationException(OAuth2ErrorCodes.UNAUTHORIZED_CLIENT);
}
}

View File

@ -6,7 +6,7 @@
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-bom</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>pig-common-bom</name>
@ -15,7 +15,7 @@
<properties>
<pig.common.version>${project.version}</pig.common.version>
<spring-boot.version>3.0.6</spring-boot.version>
<spring-boot.version>3.1.1</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j2.version>2.17.1</log4j2.version>
<maven.compiler.source>1.8</maven.compiler.source>
@ -28,7 +28,7 @@
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<mysql.version>8.0.33</mysql.version>
<seata.version>1.6.1</seata.version>
<excel.version>3.0.0</excel.version>
<excel.version>3.1.0</excel.version>
<asm.version>7.1</asm.version>
<oss.version>3.0.0</oss.version>
<sms.version>3.0.0</sms.version>
@ -66,6 +66,11 @@
<artifactId>pig-common-mybatis</artifactId>
<version>${pig.common.version}</version>
</dependency>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-oss</artifactId>
<version>${pig.common.version}</version>
</dependency>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-core</artifactId>

View File

@ -29,11 +29,6 @@ public interface CacheConstants {
*/
String PROJECT_OAUTH_ACCESS = "token::access_token";
/**
* oauth 缓存令牌前缀
*/
String PROJECT_OAUTH_TOKEN = "pig_oauth:token:";
/**
* 验证码前缀
*/
@ -54,6 +49,11 @@ public interface CacheConstants {
*/
String DICT_DETAILS = "dict_details";
/**
* 角色信息缓存
*/
String ROLE_DETAILS = "role_details";
/**
* oauth 客户端信息
*/

View File

@ -65,7 +65,7 @@ public interface SecurityConstants {
/**
* 手机号登录
*/
String APP = "app";
String MOBILE = "mobile";
/**
* {bcrypt} 加密的特征码
@ -92,6 +92,11 @@ public interface SecurityConstants {
*/
String DETAILS_USER = "user_info";
/**
* 用户ID
*/
String DETAILS_USER_ID = "user_id";
/**
* 协议字段
*/
@ -120,7 +125,7 @@ public interface SecurityConstants {
/**
* 短信登录 参数名称
*/
String SMS_PARAMETER_NAME = "phone";
String SMS_PARAMETER_NAME = "mobile";
/**
* 授权码模式confirm

View File

@ -28,8 +28,8 @@ public interface ServiceNameConstants {
String AUTH_SERVICE = "pig-auth";
/**
* UMPS模块
* UPMS模块
*/
String UMPS_SERVICE = "pig-upms-biz";
String UPMS_SERVICE = "pig-upms-biz";
}

View File

@ -16,28 +16,32 @@
-->
<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>pig-common</artifactId>
<groupId>com.pig4cloud</groupId>
<version>3.6.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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>pig-common</artifactId>
<groupId>com.pig4cloud</groupId>
<version>3.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-datasource</artifactId>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-datasource</artifactId>
<packaging>jar</packaging>
<packaging>jar</packaging>
<description>pig 动态切换数据源</description>
<description>pig 动态切换数据源</description>
<dependencies>
<!--mybatis-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic-ds.version}</version>
</dependency>
</dependencies>
<dependencies>
<!--mybatis-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
<version>${dynamic-ds.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -16,8 +16,12 @@
package com.pig4cloud.pig.common.datasource;
import com.baomidou.dynamic.datasource.creator.DataSourceCreator;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.creator.hikaricp.HikariDataSourceCreator;
import com.baomidou.dynamic.datasource.processor.DsProcessor;
import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
import com.pig4cloud.pig.common.datasource.config.ClearTtlDataSourceFilter;
import com.pig4cloud.pig.common.datasource.config.DataSourceProperties;
import com.pig4cloud.pig.common.datasource.config.JdbcDynamicDataSourceProvider;
import com.pig4cloud.pig.common.datasource.config.LastParamDsProcessor;
@ -28,6 +32,9 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
/**
* @author lengleng
* @date 2020-02-06
@ -40,9 +47,9 @@ import org.springframework.context.annotation.Configuration;
public class DynamicDataSourceAutoConfiguration {
@Bean
public DynamicDataSourceProvider dynamicDataSourceProvider(StringEncryptor stringEncryptor,
DataSourceProperties properties) {
return new JdbcDynamicDataSourceProvider(stringEncryptor, properties);
public DynamicDataSourceProvider dynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator,
StringEncryptor stringEncryptor, DataSourceProperties properties) {
return new JdbcDynamicDataSourceProvider(defaultDataSourceCreator, stringEncryptor, properties);
}
@Bean
@ -50,4 +57,18 @@ public class DynamicDataSourceAutoConfiguration {
return new LastParamDsProcessor();
}
@Bean
public DefaultDataSourceCreator defaultDataSourceCreator(HikariDataSourceCreator hikariDataSourceCreator) {
DefaultDataSourceCreator defaultDataSourceCreator = new DefaultDataSourceCreator();
List<DataSourceCreator> creators = new ArrayList<>();
creators.add(hikariDataSourceCreator);
defaultDataSourceCreator.setCreators(creators);
return defaultDataSourceCreator;
}
@Bean
public ClearTtlDataSourceFilter clearTtlDsFilter() {
return new ClearTtlDataSourceFilter();
}
}

View File

@ -0,0 +1,34 @@
package com.pig4cloud.pig.common.datasource.config;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.springframework.core.Ordered;
import org.springframework.web.filter.GenericFilterBean;
import java.io.IOException;
/**
* @author lengleng
* @date 2020/12/11
* <p>
* 清空上文的DS 设置避免污染当前线程
*/
public class ClearTtlDataSourceFilter extends GenericFilterBean implements Ordered {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
DynamicDataSourceContextHolder.clear();
filterChain.doFilter(servletRequest, servletResponse);
DynamicDataSourceContextHolder.clear();
}
@Override
public int getOrder() {
return Integer.MIN_VALUE;
}
}

View File

@ -16,8 +16,9 @@
package com.pig4cloud.pig.common.datasource.config;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.provider.AbstractJdbcDataSourceProvider;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
import com.pig4cloud.pig.common.datasource.support.DataSourceConstants;
import org.jasypt.encryption.StringEncryptor;
@ -39,8 +40,10 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
private final StringEncryptor stringEncryptor;
public JdbcDynamicDataSourceProvider(StringEncryptor stringEncryptor, DataSourceProperties properties) {
super(properties.getDriverClassName(), properties.getUrl(), properties.getUsername(), properties.getPassword());
public JdbcDynamicDataSourceProvider(DefaultDataSourceCreator defaultDataSourceCreator,
StringEncryptor stringEncryptor, DataSourceProperties properties) {
super(defaultDataSourceCreator, properties.getDriverClassName(), properties.getUrl(), properties.getUsername(),
properties.getPassword());
this.stringEncryptor = stringEncryptor;
this.properties = properties;
}

View File

@ -0,0 +1,30 @@
package com.pig4cloud.pig.common.datasource.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author lengleng
* @date 2020/12/11
* <p>
* 数据源配置类型
*/
@Getter
@AllArgsConstructor
public enum DsConfTypeEnum {
/**
* 主机链接
*/
HOST(0, "主机链接"),
/**
* JDBC链接
*/
JDBC(1, "JDBC链接");
private final Integer type;
private final String description;
}

View File

@ -0,0 +1,72 @@
package com.pig4cloud.pig.common.datasource.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* @author lengleng
* @date 2020/12/11
* <p>
* jdbc-url
*/
@Getter
@AllArgsConstructor
public enum DsJdbcUrlEnum {
/**
* mysql 数据库
*/
MYSQL("mysql",
"jdbc:mysql://%s:%s/%s?characterEncoding=utf8"
+ "&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true"
+ "&useLegacyDatetimeCode=false&allowMultiQueries=true&allowPublicKeyRetrieval=true",
"select 1", "mysql8 链接"),
/**
* pg 数据库
*/
PG("pg", "jdbc:postgresql://%s:%s/%s", "select 1", "postgresql 链接"),
/**
* SQL SERVER
*/
MSSQL("mssql", "jdbc:sqlserver://%s:%s;database=%s;characterEncoding=UTF-8", "select 1", "sqlserver 链接"),
/**
* oracle
*/
ORACLE("oracle", "jdbc:oracle:thin:@%s:%s:%s", "select 1 from dual", "oracle 链接"),
/**
* db2
*/
DB2("db2", "jdbc:db2://%s:%s/%s", "select 1 from sysibm.sysdummy1", "DB2 TYPE4 连接"),
/**
* 达梦
*/
DM("dm", "jdbc:dm://%s:%s/%s", "select 1 from dual", "达梦连接"),
/**
* pg 数据库
*/
HIGHGO("highgo", "jdbc:highgo://%s:%s/%s", "select 1", "highgo 链接");
private final String dbName;
private final String url;
private final String validationQuery;
private final String description;
public static DsJdbcUrlEnum get(String dsType) {
return Arrays.stream(DsJdbcUrlEnum.values())
.filter(dsJdbcUrlEnum -> dsType.equals(dsJdbcUrlEnum.getDbName()))
.findFirst()
.get();
}
}

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -17,9 +17,9 @@
package com.pig4cloud.pig.common.feign.annotation;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.cloud.openfeign.PigFeignClientsRegistrar;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
@ -51,32 +51,7 @@ public @interface EnablePigFeignClients {
* package names.
* @return the array of 'basePackages'.
*/
@AliasFor(annotation = EnableFeignClients.class, attribute = "basePackages")
String[] basePackages() default { "com.pig4cloud.pig" };
/**
* Type-safe alternative to {@link #basePackages()} for specifying the packages to
* scan for annotated components. The package of each class specified will be scanned.
* <p>
* Consider creating a special no-op marker class or interface in each package that
* serves no purpose other than being referenced by this attribute.
* @return the array of 'basePackageClasses'.
*/
Class<?>[] basePackageClasses() default {};
/**
* A custom <code>@Configuration</code> for all feign clients. Can contain override
* <code>@Bean</code> definition for the pieces that make up the client, for instance
* {@link feign.codec.Decoder}, {@link feign.codec.Encoder}, {@link feign.Contract}.
*
* @see FeignClientsConfiguration for the defaults
*/
Class<?>[] defaultConfiguration() default {};
/**
* List of classes annotated with @FeignClient. If not empty, disables classpath
* scanning.
* @return
*/
Class<?>[] clients() default {};
}

View File

@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-job</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-log</artifactId>

View File

@ -73,7 +73,7 @@ public class SysLogAspect {
obj = point.proceed();
}
catch (Exception e) {
logVo.setType(LogTypeEnum.ERROR.getType());
logVo.setLogType(LogTypeEnum.ERROR.getType());
logVo.setException(e.getMessage());
throw e;
}

View File

@ -16,8 +16,10 @@
package com.pig4cloud.pig.common.log.event;
import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import com.pig4cloud.pig.admin.api.feign.RemoteLogService;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
@ -38,7 +40,7 @@ public class SysLogListener {
@EventListener(SysLogEvent.class)
public void saveSysLog(SysLogEvent event) {
SysLog sysLog = (SysLog) event.getSource();
remoteLogService.saveLog(sysLog);
remoteLogService.saveLog(sysLog, SecurityConstants.FROM_IN);
}
}

View File

@ -21,7 +21,7 @@ import cn.hutool.http.HttpUtil;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import jakarta.servlet.http.HttpServletRequest;
import lombok.experimental.UtilityClass;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@ -47,13 +47,12 @@ public class SysLogUtils {
HttpServletRequest request = ((ServletRequestAttributes) Objects
.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
SysLog sysLog = new SysLog();
sysLog.setType(LogTypeEnum.NORMAL.getType());
sysLog.setLogType(LogTypeEnum.NORMAL.getType());
sysLog.setRequestUri(URLUtil.getPath(request.getRequestURI()));
sysLog.setMethod(request.getMethod());
sysLog.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
sysLog.setParams(HttpUtil.toParams(request.getParameterMap()));
sysLog.setCreateBy(getUsername());
sysLog.setUpdateBy(getUsername());
return sysLog;
}
@ -90,7 +89,7 @@ public class SysLogUtils {
* @return 装载参数的容器
*/
public EvaluationContext getContext(Object[] arguments, Method signatureMethod) {
String[] parameterNames = new LocalVariableTableParameterNameDiscoverer().getParameterNames(signatureMethod);
String[] parameterNames = new StandardReflectionParameterNameDiscoverer().getParameterNames(signatureMethod);
EvaluationContext context = new StandardEvaluationContext();
if (parameterNames == null) {
return context;

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-mybatis</artifactId>
@ -67,5 +67,9 @@
<artifactId>spring-security-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -2,6 +2,7 @@ package com.pig4cloud.pig.common.mybatis.config;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.pig4cloud.pig.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.security.core.Authentication;
@ -25,10 +26,13 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
log.debug("mybatis plus start insert fill ....");
LocalDateTime now = LocalDateTime.now();
fillValIfNullByName("createTime", now, metaObject, false);
fillValIfNullByName("updateTime", now, metaObject, false);
fillValIfNullByName("createBy", getUserName(), metaObject, false);
fillValIfNullByName("updateBy", getUserName(), metaObject, false);
fillValIfNullByName("createTime", now, metaObject, true);
fillValIfNullByName("updateTime", now, metaObject, true);
fillValIfNullByName("createBy", getUserName(), metaObject, true);
fillValIfNullByName("updateBy", getUserName(), metaObject, true);
// 删除标记自动填充
fillValIfNullByName("delFlag", CommonConstants.STATUS_NORMAL, metaObject, true);
}
@Override

View File

@ -0,0 +1,56 @@
package com.pig4cloud.pig.common.mybatis.handler;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import lombok.SneakyThrows;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Mybatis数组,符串互转
* <p>
* MappedJdbcTypes 数据库中的数据类型 MappedTypes java中的的数据类型
*
* @author xuzihui
* @date 2019-11-20
*/
@MappedTypes(value = { Long[].class })
@MappedJdbcTypes(value = JdbcType.VARCHAR)
public class JsonLongArrayTypeHandler extends BaseTypeHandler<Long[]> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Long[] parameter, JdbcType jdbcType)
throws SQLException {
ps.setString(i, ArrayUtil.join(parameter, StrUtil.COMMA));
}
@Override
@SneakyThrows
public Long[] getNullableResult(ResultSet rs, String columnName) {
String reString = rs.getString(columnName);
return Convert.toLongArray(reString);
}
@Override
@SneakyThrows
public Long[] getNullableResult(ResultSet rs, int columnIndex) {
String reString = rs.getString(columnIndex);
return Convert.toLongArray(reString);
}
@Override
@SneakyThrows
public Long[] getNullableResult(CallableStatement cs, int columnIndex) {
String reString = cs.getString(columnIndex);
return Convert.toLongArray(reString);
}
}

View File

@ -0,0 +1,56 @@
package com.pig4cloud.pig.common.mybatis.handler;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import lombok.SneakyThrows;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Mybatis数组,符串互转
* <p>
* MappedJdbcTypes 数据库中的数据类型 MappedTypes java中的的数据类型
*
* @author xuzihui
* @date 2019-11-20
*/
@MappedTypes(value = { String[].class })
@MappedJdbcTypes(value = JdbcType.VARCHAR)
public class JsonStringArrayTypeHandler extends BaseTypeHandler<String[]> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType)
throws SQLException {
ps.setString(i, ArrayUtil.join(parameter, StrUtil.COMMA));
}
@Override
@SneakyThrows
public String[] getNullableResult(ResultSet rs, String columnName) {
String reString = rs.getString(columnName);
return Convert.toStrArray(reString);
}
@Override
@SneakyThrows
public String[] getNullableResult(ResultSet rs, int columnIndex) {
String reString = rs.getString(columnIndex);
return Convert.toStrArray(reString);
}
@Override
@SneakyThrows
public String[] getNullableResult(CallableStatement cs, int columnIndex) {
String reString = cs.getString(columnIndex);
return Convert.toStrArray(reString);
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-oss</artifactId>
<packaging>jar</packaging>
<description>pig 文件系统依赖</description>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>${aws.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file;
import com.pig4cloud.pig.common.file.core.FileProperties;
import com.pig4cloud.pig.common.file.local.LocalFileAutoConfiguration;
import com.pig4cloud.pig.common.file.oss.OssAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Import;
/**
* aws 自动配置类
*
* @author lengleng
* @author 858695266
*/
@Import({ LocalFileAutoConfiguration.class, OssAutoConfiguration.class })
@EnableConfigurationProperties({ FileProperties.class })
public class FileAutoConfiguration {
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.core;
import com.pig4cloud.pig.common.file.local.LocalFileProperties;
import com.pig4cloud.pig.common.file.oss.OssProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 文件 配置信息
*
* @author lengleng
* <p>
* bucket 设置公共读权限
*/
@Data
@ConfigurationProperties(prefix = "file")
public class FileProperties {
/**
* 默认的存储桶名称
*/
private String bucketName = "local";
/**
* 本地文件配置信息
*/
private LocalFileProperties local;
/**
* oss 文件配置信息
*/
private OssProperties oss;
}

View File

@ -0,0 +1,87 @@
package com.pig4cloud.pig.common.file.core;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import org.springframework.beans.factory.InitializingBean;
import java.io.InputStream;
import java.util.List;
/**
* 文件操作模板
*
* @author lengleng
* @date 2022/4/19
*/
public interface FileTemplate extends InitializingBean {
/**
* 创建bucket
* @param bucketName bucket名称
*/
void createBucket(String bucketName);
/**
* 获取全部bucket
* <p>
*
* API Documentation</a>
*/
List<Bucket> getAllBuckets();
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
void removeBucket(String bucketName);
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream, String contextType) throws Exception;
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream) throws Exception;
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
S3Object getObject(String bucketName, String objectName);
void removeObject(String bucketName, String objectName) throws Exception;
/**
* @throws Exception
*/
@Override
default void afterPropertiesSet() throws Exception {
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.local;
import com.pig4cloud.pig.common.file.core.FileProperties;
import com.pig4cloud.pig.common.file.core.FileTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
/**
* aws 自动配置类
*
* @author lengleng
* @author 858695266
*/
@AllArgsConstructor
public class LocalFileAutoConfiguration {
private final FileProperties properties;
@Bean
@ConditionalOnMissingBean(LocalFileTemplate.class)
@ConditionalOnProperty(name = "file.local.enable", havingValue = "true", matchIfMissing = true)
public FileTemplate localFileTemplate() {
return new LocalFileTemplate(properties);
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.local;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 本地文件 配置信息
*
* @author lengleng
* <p>
* bucket 设置公共读权限
*/
@Data
@ConfigurationProperties(prefix = "local")
public class LocalFileProperties {
/**
* 是否开启
*/
private boolean enable;
/**
* 默认路径
*/
private String basePath;
}

View File

@ -0,0 +1,137 @@
package com.pig4cloud.pig.common.file.local;
import cn.hutool.core.io.FileUtil;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.pig4cloud.pig.common.file.core.FileProperties;
import com.pig4cloud.pig.common.file.core.FileTemplate;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 本地文件读取模式
*
* @author lengleng
* @date 2022/4/19
*/
@RequiredArgsConstructor
public class LocalFileTemplate implements FileTemplate {
private final FileProperties properties;
/**
* 创建bucket
* @param bucketName bucket名称
*/
@Override
public void createBucket(String bucketName) {
FileUtil.mkdir(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 获取全部bucket
* <p>
* <p>
* API Documentation</a>
*/
@Override
public List<Bucket> getAllBuckets() {
return Arrays.stream(FileUtil.ls(properties.getLocal().getBasePath())).filter(FileUtil::isDirectory)
.map(dir -> new Bucket(dir.getName())).collect(Collectors.toList());
}
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
@Override
public void removeBucket(String bucketName) {
FileUtil.del(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream, String contextType) {
// Bucket 不存在时创建
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
if (!FileUtil.isDirectory(properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName)) {
createBucket(bucketName);
}
// 写入文件
File file = FileUtil.file(dir + FileUtil.FILE_SEPARATOR + objectName);
FileUtil.writeFromStream(stream, file);
}
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
@Override
@SneakyThrows
public S3Object getObject(String bucketName, String objectName) {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
S3Object s3Object = new S3Object();
s3Object.setObjectContent(FileUtil.getInputStream(dir + FileUtil.FILE_SEPARATOR + objectName));
return s3Object;
}
/**
* @param bucketName
* @param objectName
* @throws Exception
*/
@Override
public void removeObject(String bucketName, String objectName) throws Exception {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
FileUtil.del(dir + FileUtil.FILE_SEPARATOR + objectName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @throws Exception
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
putObject(bucketName, objectName, stream, null);
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
@Override
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
String dir = properties.getLocal().getBasePath() + FileUtil.FILE_SEPARATOR + bucketName;
return Arrays.stream(FileUtil.ls(dir)).filter(file -> file.getName().startsWith(prefix)).map(file -> {
S3ObjectSummary summary = new S3ObjectSummary();
summary.setKey(file.getName());
return new S3ObjectSummary();
}).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.oss;
import com.pig4cloud.pig.common.file.core.FileProperties;
import com.pig4cloud.pig.common.file.core.FileTemplate;
import com.pig4cloud.pig.common.file.oss.http.OssEndpoint;
import com.pig4cloud.pig.common.file.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
/**
* aws 自动配置类
*
* @author lengleng
* @author 858695266
*/
@AllArgsConstructor
public class OssAutoConfiguration {
private final FileProperties properties;
@Bean
@Primary
@ConditionalOnMissingBean(OssTemplate.class)
@ConditionalOnProperty(name = "file.oss.enable", havingValue = "true")
public FileTemplate ossTemplate() {
return new OssTemplate(properties);
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "file.oss.info", havingValue = "true")
public OssEndpoint ossEndpoint(OssTemplate template) {
return new OssEndpoint(template);
}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.oss;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* aws 配置信息
*
* @author lengleng
* @author 858695266 配置文件添加 oss: enable: true endpoint: http://127.0.0.1:9000 #
* pathStyleAccess 采用nginx反向代理或者AWS S3 配置成true支持第三方云存储配置成false pathStyleAccess: false
* access-key: lengleng secret-key: lengleng bucket-name: lengleng region: custom-domain:
* https://oss.xxx.com/lengleng
* <p>
* bucket 设置公共读权限
*/
@Data
@ConfigurationProperties(prefix = "oss")
public class OssProperties {
/**
* 对象存储服务的URL
*/
private String endpoint;
/**
* 自定义域名
*/
private String customDomain;
/**
* true path-style nginx 反向代理和S3默认支持 pathStyle {http://endpoint/bucketname} false
* supports virtual-hosted-style 阿里云等需要配置为 virtual-hosted-style
* 模式{http://bucketname.endpoint}
*/
private Boolean pathStyleAccess = true;
/**
* 应用ID
*/
private String appId;
/**
* 区域
*/
private String region;
/**
* Access key就像用户ID可以唯一标识你的账户
*/
private String accessKey;
/**
* Secret key是你账户的密码
*/
private String secretKey;
/**
* 最大线程数默认 100
*/
private Integer maxConnections = 100;
}

View File

@ -0,0 +1,138 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.oss.http;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.pig4cloud.pig.common.file.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import lombok.Cleanup;
import lombok.SneakyThrows;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* aws 对外提供服务端点
*
* @author lengleng
* @author 858695266
* <p>
* oss.info
*/
@RestController
@AllArgsConstructor
@RequestMapping("/oss")
@ConditionalOnProperty(name = "file.oss.info", havingValue = "true")
public class OssEndpoint {
private final OssTemplate template;
/**
* Bucket Endpoints
*/
@SneakyThrows
@PostMapping("/bucket/{bucketName}")
public Bucket createBucker(@PathVariable String bucketName) {
template.createBucket(bucketName);
return template.getBucket(bucketName).get();
}
@SneakyThrows
@GetMapping("/bucket")
public List<Bucket> getBuckets() {
return template.getAllBuckets();
}
@SneakyThrows
@GetMapping("/bucket/{bucketName}")
public Bucket getBucket(@PathVariable String bucketName) {
return template.getBucket(bucketName).orElseThrow(() -> new IllegalArgumentException("Bucket Name not found!"));
}
@SneakyThrows
@DeleteMapping("/bucket/{bucketName}")
@ResponseStatus(HttpStatus.ACCEPTED)
public void deleteBucket(@PathVariable String bucketName) {
template.removeBucket(bucketName);
}
/**
* Object Endpoints
*/
@SneakyThrows
@PostMapping("/object/{bucketName}")
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) {
String name = object.getOriginalFilename();
@Cleanup
InputStream inputStream = object.getInputStream();
template.putObject(bucketName, name, inputStream, object.getSize(), object.getContentType());
return template.getObjectInfo(bucketName, name);
}
@SneakyThrows
@PostMapping("/object/{bucketName}/{objectName}")
public S3Object createObject(@RequestBody MultipartFile object, @PathVariable String bucketName,
@PathVariable String objectName) {
@Cleanup
InputStream inputStream = object.getInputStream();
template.putObject(bucketName, objectName, inputStream, object.getSize(), object.getContentType());
return template.getObjectInfo(bucketName, objectName);
}
@SneakyThrows
@GetMapping("/object/{bucketName}/{objectName}")
public List<S3ObjectSummary> filterObject(@PathVariable String bucketName, @PathVariable String objectName) {
return template.getAllObjectsByPrefix(bucketName, objectName, true);
}
@SneakyThrows
@GetMapping("/object/{bucketName}/{objectName}/{expires}")
public Map<String, Object> getObject(@PathVariable String bucketName, @PathVariable String objectName,
@PathVariable Integer expires) {
Map<String, Object> responseBody = new HashMap<>(8);
// Put Object info
responseBody.put("bucket", bucketName);
responseBody.put("object", objectName);
responseBody.put("url", template.getObjectURL(bucketName, objectName, expires));
responseBody.put("expires", expires);
return responseBody;
}
@SneakyThrows
@ResponseStatus(HttpStatus.ACCEPTED)
@DeleteMapping("/object/{bucketName}/{objectName}/")
public void deleteObject(@PathVariable String bucketName, @PathVariable String objectName) {
template.removeObject(bucketName, objectName);
}
}

View File

@ -0,0 +1,236 @@
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.common.file.oss.service;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
import com.pig4cloud.pig.common.file.core.FileProperties;
import com.pig4cloud.pig.common.file.core.FileTemplate;
import lombok.Cleanup;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.beans.factory.InitializingBean;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
/**
* aws-s3 通用存储操作 支持所有兼容s3协议的云存储: {阿里云OSS腾讯云COS七牛云京东云minio }
*
* @author lengleng
* @author 858695266
* @date 2020/5/23 6:36 上午
* @since 1.0
*/
@RequiredArgsConstructor
public class OssTemplate implements InitializingBean, FileTemplate {
private final FileProperties properties;
private AmazonS3 amazonS3;
/**
* 创建bucket
* @param bucketName bucket名称
*/
@SneakyThrows
public void createBucket(String bucketName) {
if (!amazonS3.doesBucketExistV2(bucketName)) {
amazonS3.createBucket((bucketName));
}
}
/**
* 获取全部bucket
* <p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
* API Documentation</a>
*/
@SneakyThrows
public List<Bucket> getAllBuckets() {
return amazonS3.listBuckets();
}
/**
* @param bucketName bucket名称
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
* API Documentation</a>
*/
@SneakyThrows
public Optional<Bucket> getBucket(String bucketName) {
return amazonS3.listBuckets().stream().filter(b -> b.getName().equals(bucketName)).findFirst();
}
/**
* @param bucketName bucket名称
* @see <a href=
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket">AWS API
* Documentation</a>
*/
@SneakyThrows
public void removeBucket(String bucketName) {
amazonS3.deleteBucket(bucketName);
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
@SneakyThrows
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
ObjectListing objectListing = amazonS3.listObjects(bucketName, prefix);
return new ArrayList<>(objectListing.getObjectSummaries());
}
/**
* 获取文件外链
* @param bucketName bucket名称
* @param objectName 文件名称
* @param expires 过期时间 <=7
* @return url
* @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration)
*/
@SneakyThrows
public String getObjectURL(String bucketName, String objectName, Integer expires) {
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, expires);
URL url = amazonS3.generatePresignedUrl(bucketName, objectName, calendar.getTime());
return url.toString();
}
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
* API Documentation</a>
*/
@SneakyThrows
public S3Object getObject(String bucketName, String objectName) {
return amazonS3.getObject(bucketName, objectName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @throws Exception
*/
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
putObject(bucketName, objectName, stream, stream.available(), "application/octet-stream");
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
public void putObject(String bucketName, String objectName, InputStream stream, String contextType)
throws Exception {
putObject(bucketName, objectName, stream, stream.available(), contextType);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param size 大小
* @param contextType 类型
* @throws Exception
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject">AWS
* API Documentation</a>
*/
public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size,
String contextType) throws Exception {
// String fileName = getFileName(objectName);
byte[] bytes = IOUtils.toByteArray(stream);
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(size);
objectMetadata.setContentType(contextType);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
// 上传
return amazonS3.putObject(bucketName, objectName, byteArrayInputStream, objectMetadata);
}
/**
* 获取文件信息
* @param bucketName bucket名称
* @param objectName 文件名称
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
* API Documentation</a>
*/
public S3Object getObjectInfo(String bucketName, String objectName) throws Exception {
@Cleanup
S3Object object = amazonS3.getObject(bucketName, objectName);
return object;
}
/**
* 删除文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @throws Exception
* @see <a href=
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject">AWS API
* Documentation</a>
*/
public void removeObject(String bucketName, String objectName) throws Exception {
amazonS3.deleteObject(bucketName, objectName);
}
@Override
public void afterPropertiesSet() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setMaxConnections(properties.getOss().getMaxConnections());
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
properties.getOss().getEndpoint(), properties.getOss().getRegion());
AWSCredentials awsCredentials = new BasicAWSCredentials(properties.getOss().getAccessKey(),
properties.getOss().getSecretKey());
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
this.amazonS3 = AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)
.withClientConfiguration(clientConfiguration).withCredentials(awsCredentialsProvider)
.disableChunkedEncoding().withPathStyleAccessEnabled(properties.getOss().getPathStyleAccess()).build();
}
}

View File

@ -0,0 +1 @@
com.pig4cloud.pig.common.file.FileAutoConfiguration

View File

@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-seata</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-security</artifactId>

View File

@ -0,0 +1,51 @@
package com.pig4cloud.pig.common.security.component;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.convert.converter.Converter;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.GenericHttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.oauth2.core.endpoint.DefaultOAuth2AccessTokenResponseMapConverter;
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter;
import java.util.Map;
/**
* 扩展原生的实现支持 Long2String
*
* @author lengleng
* @date 2023/6/28
*/
public class PigCustomOAuth2AccessTokenResponseHttpMessageConverter
extends OAuth2AccessTokenResponseHttpMessageConverter {
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
};
private Converter<OAuth2AccessTokenResponse, Map<String, Object>> accessTokenResponseParametersConverter = new DefaultOAuth2AccessTokenResponseMapConverter();
@Override
protected void writeInternal(OAuth2AccessTokenResponse tokenResponse, HttpOutputMessage outputMessage)
throws HttpMessageNotWritableException {
try {
Map<String, Object> tokenResponseParameters = this.accessTokenResponseParametersConverter
.convert(tokenResponse);
ObjectMapper objectMapper = SpringContextHolder.getBean(ObjectMapper.class);
GenericHttpMessageConverter<Object> jsonMessageConverter = new MappingJackson2HttpMessageConverter(
objectMapper);
jsonMessageConverter.write(tokenResponseParameters, STRING_OBJECT_MAP.getType(), MediaType.APPLICATION_JSON,
outputMessage);
}
catch (Exception ex) {
throw new HttpMessageNotWritableException(
"An error occurred writing the OAuth 2.0 Access Token Response: " + ex.getMessage(), ex);
}
}
}

View File

@ -24,6 +24,8 @@ import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
import org.springframework.security.web.SecurityFilterChain;
@ -59,12 +61,8 @@ public class PigResourceServerConfiguration {
oauth2 -> oauth2.opaqueToken(token -> token.introspector(customOpaqueTokenIntrospector))
.authenticationEntryPoint(resourceAuthExceptionEntryPoint)
.bearerTokenResolver(pigBearerTokenExtractor))
.headers()
.frameOptions()
.disable()
.and()
.csrf()
.disable();
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
.csrf(AbstractHttpConfigurer::disable);
return http.build();
}

View File

@ -16,6 +16,7 @@
package com.pig4cloud.pig.common.security.service;
import com.pig4cloud.pig.admin.api.dto.UserDTO;
import com.pig4cloud.pig.admin.api.dto.UserInfo;
import com.pig4cloud.pig.admin.api.feign.RemoteUserService;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
@ -54,7 +55,9 @@ public class PigAppUserDetailsServiceImpl implements PigUserDetailsService {
return (PigUser) cache.get(phone).get();
}
R<UserInfo> result = remoteUserService.infoByMobile(phone);
UserDTO userDTO = new UserDTO();
userDTO.setPhone(phone);
R<UserInfo> result = remoteUserService.info(userDTO, SecurityConstants.FROM_IN);
UserDetails userDetails = getUserDetails(result);
if (cache != null) {
@ -80,7 +83,7 @@ public class PigAppUserDetailsServiceImpl implements PigUserDetailsService {
*/
@Override
public boolean support(String clientId, String grantType) {
return SecurityConstants.APP.equals(grantType);
return SecurityConstants.MOBILE.equals(grantType);
}
}

View File

@ -19,7 +19,6 @@ import org.springframework.security.oauth2.server.authorization.client.Registere
import org.springframework.security.oauth2.server.authorization.settings.ClientSettings;
import org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat;
import org.springframework.security.oauth2.server.authorization.settings.TokenSettings;
import org.springframework.util.StringUtils;
import java.time.Duration;
import java.util.Arrays;
@ -86,7 +85,8 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
@Cacheable(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
public RegisteredClient findByClientId(String clientId) {
SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId))
SysOauthClientDetails clientDetails = RetOps
.of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN))
.getData()
.orElseThrow(() -> new OAuth2AuthorizationCodeRequestAuthenticationException(
new OAuth2Error("客户端查询异常,请检查数据库链接"), null));
@ -96,10 +96,10 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
.clientSecret(SecurityConstants.NOOP + clientDetails.getClientSecret())
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
// 授权模式
Optional.ofNullable(clientDetails.getAuthorizedGrantTypes())
.ifPresent(grants -> StringUtils.commaDelimitedListToSet(grants)
.forEach(s -> builder.authorizationGrantType(new AuthorizationGrantType(s))));
for (String authorizedGrantType : clientDetails.getAuthorizedGrantTypes()) {
builder.authorizationGrantType(new AuthorizationGrantType(authorizedGrantType));
}
// 回调地址
Optional.ofNullable(clientDetails.getWebServerRedirectUri())
.ifPresent(redirectUri -> Arrays.stream(redirectUri.split(StrUtil.COMMA))

View File

@ -16,9 +16,11 @@
package com.pig4cloud.pig.common.security.service;
import com.pig4cloud.pig.admin.api.dto.UserDTO;
import com.pig4cloud.pig.admin.api.dto.UserInfo;
import com.pig4cloud.pig.admin.api.feign.RemoteUserService;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.R;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@ -55,7 +57,9 @@ public class PigUserDetailsServiceImpl implements PigUserDetailsService {
return (PigUser) cache.get(username).get();
}
R<UserInfo> result = remoteUserService.info(username);
UserDTO userDTO = new UserDTO();
userDTO.setUsername(username);
R<UserInfo> result = remoteUserService.info(userDTO,SecurityConstants.FROM_IN);
UserDetails userDetails = getUserDetails(result);
if (cache != null) {
cache.put(username, userDetails);

View File

@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-swagger</artifactId>

View File

@ -29,7 +29,7 @@ import java.lang.annotation.*;
* @author lengleng
* @date 2022-03-26
*/
@Target({ElementType.TYPE})
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@ -37,18 +37,16 @@ import java.lang.annotation.*;
@Import(OpenAPIDefinitionImportSelector.class)
public @interface EnablePigDoc {
/**
* 网关路由前缀
*
* @return String
*/
String value();
/**
* 网关路由前缀
* @return String
*/
String value();
/**
* 是否是微服务架构
*
* @return true
*/
boolean isMicro() default true;
/**
* 是否是微服务架构
* @return true
*/
boolean isMicro() default true;
}

View File

@ -17,25 +17,25 @@ import java.util.Objects;
*/
public class OpenAPIDefinitionImportSelector implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
Map<String, Object> annotationAttributes = metadata.getAnnotationAttributes(EnablePigDoc.class.getName(), true);
Object value = annotationAttributes.get("value");
if (Objects.isNull(value)) {
return;
}
Map<String, Object> annotationAttributes = metadata.getAnnotationAttributes(EnablePigDoc.class.getName(), true);
Object value = annotationAttributes.get("value");
if (Objects.isNull(value)) {
return;
}
BeanDefinitionBuilder openAPIMetadataRegister = BeanDefinitionBuilder.genericBeanDefinition(OpenAPIMetadataRegister.class);
openAPIMetadataRegister.addPropertyValue("path", value);
BeanDefinitionBuilder openAPIMetadataRegister = BeanDefinitionBuilder
.genericBeanDefinition(OpenAPIMetadataRegister.class);
openAPIMetadataRegister.addPropertyValue("path", value);
registry.registerBeanDefinition("openAPIMetadataRegister", openAPIMetadataRegister.getBeanDefinition());
registry.registerBeanDefinition("openAPIMetadataRegister", openAPIMetadataRegister.getBeanDefinition());
BeanDefinitionBuilder openAPIDefinition = BeanDefinitionBuilder.genericBeanDefinition(OpenAPIDefinition.class);
openAPIDefinition.addPropertyValue("path", value);
registry.registerBeanDefinition("openAPIDefinition", openAPIDefinition.getBeanDefinition());
BeanDefinitionBuilder openAPIDefinition = BeanDefinitionBuilder.genericBeanDefinition(OpenAPIDefinition.class);
openAPIDefinition.addPropertyValue("path", value);
registry.registerBeanDefinition("openAPIDefinition", openAPIDefinition.getBeanDefinition());
}
}
}

View File

@ -13,21 +13,20 @@ import org.springframework.context.ApplicationContextAware;
*/
public class OpenAPIMetadataRegister implements InitializingBean, ApplicationContextAware {
private ApplicationContext applicationContext;
private ApplicationContext applicationContext;
@Setter
private String path;
@Setter
private String path;
@Override
public void afterPropertiesSet() {
ServiceInstance serviceInstance = applicationContext.getBean(ServiceInstance.class);
serviceInstance.getMetadata().put("spring-doc", path);
}
@Override
public void afterPropertiesSet() {
ServiceInstance serviceInstance = applicationContext.getBean(ServiceInstance.class);
serviceInstance.getMetadata().put("spring-doc", path);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common-xss</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-common</artifactId>
@ -36,6 +36,7 @@
<module>pig-common-job</module>
<module>pig-common-log</module>
<module>pig-common-mybatis</module>
<module>pig-common-oss</module>
<module>pig-common-seata</module>
<module>pig-common-security</module>
<module>pig-common-feign</module>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-gateway</artifactId>

View File

@ -18,7 +18,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-register</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>3.6.4</version>
<version>3.7.0-SNAPSHOT</version>
</parent>
<artifactId>pig-upms-api</artifactId>

View File

@ -1,27 +0,0 @@
package com.pig4cloud.pig.admin.api.dto;
import lombok.Data;
import jakarta.validation.constraints.NotBlank;
/**
* 客户端请求验证码
*
* @author lengleng
* @date 2022/10/13
*/
@Data
public class AppSmsDTO {
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
private String phone;
/**
* 手机号是否存在数据库
*/
private Boolean exist;
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.dto;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author lengleng
* @date 2019/2/1 角色Dto
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class RoleDTO extends SysRole {
/**
* 角色部门Id
*/
private Long roleDeptId;
/**
* 部门名称
*/
private String deptName;
}

View File

@ -1,6 +1,7 @@
package com.pig4cloud.pig.admin.api.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.time.LocalDateTime;
@ -16,20 +17,75 @@ import java.time.LocalDateTime;
public class SysLogDTO {
/**
* 查询日志类型
* 编号
*/
@Schema(description = "日志类型")
private String type;
private Long id;
/**
* 日志类型
*/
@NotBlank(message = "日志类型不能为空")
private String logType;
/**
* 日志标题
*/
@NotBlank(message = "日志标题不能为空")
private String title;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 操作IP地址
*/
private String remoteAddr;
/**
* 用户代理
*/
private String userAgent;
/**
* 请求URI
*/
private String requestUri;
/**
* 操作方式
*/
private String method;
/**
* 操作提交的数据
*/
private String params;
/**
* 执行时间
*/
private Long time;
/**
* 异常信息
*/
private String exception;
/**
* 服务ID
*/
private String serviceId;
/**
* 创建时间区间 [开始时间结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTime;
/**
* 请求IP
*/
private String remoteAddr;
}

View File

@ -1,22 +1,26 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.dto;
import com.pig4cloud.pig.admin.api.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -24,17 +28,23 @@ import java.util.List;
/**
* @author lengleng
* @date 2019/2/1
* @date 2017/11/5
*/
@Data
@Schema(description = "系统用户传输对象")
@EqualsAndHashCode(callSuper = true)
public class UserDTO extends SysUser {
/**
* 角色ID
*/
@Schema(description = "角色id集合")
private List<Long> role;
/**
* 部门id
*/
@Schema(description = "部门id")
private Long deptId;
/**
@ -45,11 +55,7 @@ public class UserDTO extends SysUser {
/**
* 新密码
*/
@Schema(description = "新密码")
private String newpassword1;
/**
* 验证码
*/
private String code;
}

View File

@ -1,67 +1,54 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.dto;
import com.pig4cloud.pig.admin.api.entity.SysPost;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import com.pig4cloud.pig.admin.api.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author lengleng
* @date 2019/2/1
* <p>
* commit('SET_ROLES', data) commit('SET_NAME', data) commit('SET_AVATAR', data)
* commit('SET_INTRODUCTION', data) commit('SET_PERMISSIONS', data)
* @date 2017/11/11
*/
@Data
@Schema(description = "用户信息")
public class UserInfo implements Serializable {
/**
* 用户基本信息
*/
@Schema(description = "用户基本信息")
private SysUser sysUser;
/**
* 权限标识集合
*/
@Schema(description = "权限标识集合")
private String[] permissions;
/**
* 角色集合
*/
@Schema(description = "角色标识集合")
private Long[] roles;
/**
* 角色集合
*/
private List<SysRole> roleList;
/**
* 岗位集合
*/
private Long[] posts;
/**
* 岗位集合
*/
private List<SysPost> postList;
}

View File

@ -1,31 +1,33 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* <p>
@ -33,12 +35,12 @@ import jakarta.validation.constraints.NotNull;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2018-01-22
*/
@Schema(description = "部门")
@Data
@Schema(description = "部门")
@EqualsAndHashCode(callSuper = true)
public class SysDept extends BaseEntity {
public class SysDept extends Model<SysDept> {
private static final long serialVersionUID = 1L;
@ -50,16 +52,44 @@ public class SysDept extends BaseEntity {
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@Schema(description = "部门名称", required = true)
@Schema(description = "部门名称")
private String name;
/**
* 排序
*/
@NotNull(message = "部门排序值不能为空")
@Schema(description = "排序值", required = true)
@NotNull(message = "排序值不能为空")
@Schema(description = "排序值")
private Integer sortOrder;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 修改时间
*/
@Schema(description = "修改时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/**
* 父级部门id
*/
@ -67,9 +97,11 @@ public class SysDept extends BaseEntity {
private Long parentId;
/**
* 是否删除 -1已删除 0正常
* 是否删除 1已删除 0正常
*/
@TableLogic
@Schema(description = "删除标记,1:已删除,0:正常")
@TableField(fill = FieldFill.INSERT)
private String delFlag;
}

View File

@ -1,17 +1,20 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
@ -27,10 +30,10 @@ import lombok.EqualsAndHashCode;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2018-01-22
*/
@Schema(description = "部门关系")
@Data
@Schema(description = "部门关系")
@EqualsAndHashCode(callSuper = true)
public class SysDeptRelation extends Model<SysDeptRelation> {

View File

@ -1,28 +1,29 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 字典表
*
@ -32,7 +33,7 @@ import lombok.EqualsAndHashCode;
@Data
@Schema(description = "字典类型")
@EqualsAndHashCode(callSuper = true)
public class SysDict extends BaseEntity {
public class SysDict extends Model<SysDict> {
private static final long serialVersionUID = 1L;
@ -46,8 +47,8 @@ public class SysDict extends BaseEntity {
/**
* 类型
*/
@Schema(description = "字典key")
private String dictKey;
@Schema(description = "字典类型")
private String dictType;
/**
* 描述
@ -55,6 +56,20 @@ public class SysDict extends BaseEntity {
@Schema(description = "字典描述")
private String description;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/**
* 是否是系统内置
*/
@ -65,12 +80,27 @@ public class SysDict extends BaseEntity {
* 备注信息
*/
@Schema(description = "备注信息")
private String remark;
private String remarks;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;

View File

@ -1,28 +1,30 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 字典项
*
@ -32,7 +34,7 @@ import lombok.EqualsAndHashCode;
@Data
@Schema(description = "字典项")
@EqualsAndHashCode(callSuper = true)
public class SysDictItem extends BaseEntity {
public class SysDictItem extends Model<SysDictItem> {
private static final long serialVersionUID = 1L;
@ -49,17 +51,12 @@ public class SysDictItem extends BaseEntity {
@Schema(description = "所属字典类id")
private Long dictId;
/**
* 所属字典类id
*/
@Schema(description = "所属字典类key")
private String dictKey;
/**
* 数据值
*/
@Schema(description = "数据值")
private String value;
@JsonProperty(value = "value")
private String itemValue;
/**
* 标签名
@ -71,7 +68,7 @@ public class SysDictItem extends BaseEntity {
* 类型
*/
@Schema(description = "类型")
private String type;
private String dictType;
/**
* 描述
@ -85,16 +82,45 @@ public class SysDictItem extends BaseEntity {
@Schema(description = "排序值,默认升序")
private Integer sortOrder;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 备注信息
*/
@Schema(description = "备注信息")
private String remark;
private String remarks;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;

View File

@ -17,13 +17,14 @@
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 文件管理
*
@ -31,8 +32,9 @@ import lombok.EqualsAndHashCode;
* @date 2019-06-18 17:18:42
*/
@Data
@Schema(description = "文件")
@EqualsAndHashCode(callSuper = true)
public class SysFile extends BaseEntity {
public class SysFile extends Model<SysFile> {
private static final long serialVersionUID = 1L;
@ -40,37 +42,73 @@ public class SysFile extends BaseEntity {
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "文件编号")
private Long id;
/**
* 文件名
*/
@Schema(description = "文件名")
private String fileName;
/**
* 原文件名
*/
@Schema(description = "原始文件名")
private String original;
/**
* 容器名称
*/
@Schema(description = "存储桶名称")
private String bucketName;
/**
* 文件类型
*/
@Schema(description = "文件类型")
private String type;
/**
* 文件大小
*/
@Schema(description = "文件大小")
private Long fileSize;
/**
* 上传人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建者")
private String createBy;
/**
* 上传时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "更新者")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 删除标识1-删除0-正常
*/
@TableLogic
private Integer delFlag;
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}

View File

@ -1,34 +1,33 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
@ -36,21 +35,20 @@ import jakarta.validation.constraints.NotBlank;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-11-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysLog extends BaseEntity {
@Schema(description = "日志")
public class SysLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("日志编号")
@Schema(description = "日志编号")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
@ -59,7 +57,7 @@ public class SysLog extends BaseEntity {
@NotBlank(message = "日志类型不能为空")
@ExcelProperty("日志类型0-正常 9-错误)")
@Schema(description = "日志类型")
private String type;
private String logType;
/**
* 日志标题
@ -69,24 +67,47 @@ public class SysLog extends BaseEntity {
@Schema(description = "日志标题")
private String title;
/**
* 创建者
*/
@ExcelProperty("创建人")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@ExcelProperty("创建时间")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@ExcelIgnore
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 操作IP地址
*/
@ExcelProperty("IP")
@ExcelProperty("操作ip地址")
@Schema(description = "操作ip地址")
private String remoteAddr;
/**
* 用户浏览器
* 用户代理
*/
@ExcelProperty("浏览器类型")
@Schema(description = "用户代理")
private String userAgent;
/**
* 请求URI
*/
@ExcelProperty("请求URI")
@ExcelProperty("浏览器")
@Schema(description = "请求uri")
private String requestUri;
@ -100,14 +121,14 @@ public class SysLog extends BaseEntity {
/**
* 操作提交的数据
*/
@ExcelProperty("请求参数")
@Schema(description = "数据")
@ExcelProperty("提交数据")
@Schema(description = "提交数据")
private String params;
/**
* 执行时间
*/
@ExcelProperty("方法执行时间")
@ExcelProperty("执行时间")
@Schema(description = "方法执行时间")
private Long time;
@ -130,6 +151,8 @@ public class SysLog extends BaseEntity {
*/
@TableLogic
@ExcelIgnore
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}

View File

@ -1,31 +1,33 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* <p>
@ -33,11 +35,12 @@ import jakarta.validation.constraints.NotNull;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-11-08
*/
@Data
@Schema(description = "菜单")
@EqualsAndHashCode(callSuper = true)
public class SysMenu extends BaseEntity {
public class SysMenu extends Model<SysMenu> {
private static final long serialVersionUID = 1L;
@ -55,6 +58,12 @@ public class SysMenu extends BaseEntity {
@Schema(description = "菜单名称")
private String name;
/**
* 菜单名称
*/
@Schema(description = "菜单名称")
private String enName;
/**
* 菜单权限标识
*/
@ -75,11 +84,17 @@ public class SysMenu extends BaseEntity {
private String icon;
/**
* 前端URL
* 前端路由标识路径默认和 comment 保持一致 过期
*/
@Schema(description = "前端路由标识路径")
private String path;
/**
* 菜单显示隐藏控制
*/
@Schema(description = "菜单是否显示")
private String visible;
/**
* 排序值
*/
@ -90,7 +105,8 @@ public class SysMenu extends BaseEntity {
* 菜单类型 0菜单 1按钮
*/
@NotNull(message = "菜单类型不能为空")
private String type;
@Schema(description = "菜单类型,0:菜单 1:按钮")
private String menuType;
/**
* 路由缓冲
@ -98,10 +114,43 @@ public class SysMenu extends BaseEntity {
@Schema(description = "路由缓冲")
private String keepAlive;
@Schema(description = "菜单是否内嵌")
private String embedded;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 0--正常 1--删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}

View File

@ -1,29 +1,32 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* <p>
@ -31,19 +34,23 @@ import jakarta.validation.constraints.NotBlank;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2018-05-15
*/
@Data
@Schema(description = "客户端信息")
@EqualsAndHashCode(callSuper = true)
public class SysOauthClientDetails extends BaseEntity {
public class SysOauthClientDetails extends Model<SysOauthClientDetails> {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_ID)
@Schema(description = "id")
private Long id;
/**
* 客户端ID
*/
@NotBlank(message = "client_id 不能为空")
@TableId(value = "client_id", type = IdType.INPUT)
@Schema(description = "客户端id")
private String clientId;
@ -68,10 +75,10 @@ public class SysOauthClientDetails extends BaseEntity {
private String scope;
/**
* 授权方式A,B,C
* 授权方式[A,B,C]
*/
@Schema(description = "授权方式")
private String authorizedGrantTypes;
private String[] authorizedGrantTypes;
/**
* 回调地址
@ -109,4 +116,40 @@ public class SysOauthClientDetails extends BaseEntity {
@Schema(description = "是否自动放行")
private String autoapprove;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
}

View File

@ -14,65 +14,101 @@
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 岗位管理
* 岗位信息表
*
* @author fxz
* @date 2022-03-15 17:18:40
* @date 2022-03-26 12:50:43
*/
@Data
@TableName("sys_post")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "岗位信息表")
public class SysPost extends BaseEntity {
public class SysPost extends Model<SysPost> {
private static final long serialVersionUID = -8744622014102311894L;
private static final long serialVersionUID = 1L;
/**
* 岗位ID
*/
@TableId(type = IdType.ASSIGN_ID)
@TableId(value = "post_id", type = IdType.ASSIGN_ID)
@Schema(description = "岗位ID")
private Long postId;
/**
* 岗位编码
*/
@NotBlank(message = "岗位编码不能为空")
@Schema(description = "岗位编码")
private String postCode;
/**
* 岗位名称
*/
@NotBlank(message = "岗位名称不能为空")
@Schema(description = "岗位名称")
private String postName;
/**
* 岗位排序
*/
@NotNull(message = "排序值不能为空")
@Schema(description = "岗位排序")
private Integer postSort;
/**
* 岗位描述
*/
@Schema(description = "岗位描述")
private String remark;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 是否删除 -1已删除 0正常
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "是否删除 -1已删除 0正常")
private String delFlag;
/**
* 备注信息
* 创建时间
*/
@Schema(description = "备注信息")
private String remark;
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
}

View File

@ -17,13 +17,14 @@
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 公共参数配置
*
@ -33,7 +34,7 @@ import lombok.EqualsAndHashCode;
@Data
@Schema(description = "公共参数")
@EqualsAndHashCode(callSuper = true)
public class SysPublicParam extends BaseEntity {
public class SysPublicParam extends Model<SysPublicParam> {
private static final long serialVersionUID = 1L;
@ -86,4 +87,40 @@ public class SysPublicParam extends BaseEntity {
@Schema(description = "类型[1-检索2-原文...]", example = "1")
private String publicType;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
}

View File

@ -1,30 +1,32 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* <p>
@ -32,11 +34,12 @@ import jakarta.validation.constraints.NotBlank;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-10-29
*/
@Data
@Schema(description = "角色")
@EqualsAndHashCode(callSuper = true)
public class SysRole extends BaseEntity {
public class SysRole extends Model<SysRole> {
private static final long serialVersionUID = 1L;
@ -44,22 +47,51 @@ public class SysRole extends BaseEntity {
@Schema(description = "角色编号")
private Long roleId;
@NotBlank(message = "角色名称 不能为空")
@NotBlank(message = "角色名称不能为空")
@Schema(description = "角色名称")
private String roleName;
@NotBlank(message = "角色标识 不能为空")
@NotBlank(message = "角色标识不能为空")
@Schema(description = "角色标识")
private String roleCode;
@NotBlank(message = "角色描述 不能为空")
@Schema(description = "角色描述")
private String roleDesc;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 修改时间
*/
@Schema(description = "修改时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/**
* 删除标识0-正常,1-删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}

View File

@ -1,17 +1,20 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
@ -27,9 +30,10 @@ import lombok.EqualsAndHashCode;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-10-29
*/
@Data
@Schema(description = "角色菜单")
@EqualsAndHashCode(callSuper = true)
public class SysRoleMenu extends Model<SysRoleMenu> {

View File

@ -1,29 +1,31 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
@ -31,11 +33,11 @@ import lombok.EqualsAndHashCode;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-10-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysUser extends BaseEntity {
@Schema(description = "用户")
public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
@ -49,7 +51,7 @@ public class SysUser extends BaseEntity {
/**
* 用户名
*/
@Schema(title = "用户名")
@Schema(description = "用户名")
private String username;
/**
@ -65,6 +67,42 @@ public class SysUser extends BaseEntity {
@Schema(description = "随机盐")
private String salt;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 修改人
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 0-正常1-删除
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
/**
* 锁定标记
*/
@ -90,9 +128,51 @@ public class SysUser extends BaseEntity {
private Long deptId;
/**
* 0-正常1-删除
* 微信openid
*/
@TableLogic
private String delFlag;
@Schema(description = "微信openid")
private String wxOpenid;
/**
* 微信小程序openId
*/
@Schema(description = "微信小程序openid")
private String miniOpenid;
/**
* QQ openid
*/
@Schema(description = "QQ openid")
private String qqOpenid;
/**
* 码云唯一标识
*/
@Schema(description = "码云唯一标识")
private String giteeLogin;
/**
* 开源中国唯一标识
*/
@Schema(description = "开源中国唯一标识")
private String oscId;
/**
* 昵称
*/
@Schema(description = "昵称")
private String nickname;
/**
* 姓名
*/
@Schema(description = "姓名")
private String name;
/**
* 邮箱
*/
@Schema(description = "邮箱")
private String email;
}

View File

@ -1,17 +1,20 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
@ -27,9 +30,10 @@ import lombok.EqualsAndHashCode;
* </p>
*
* @author lengleng
* @since 2019/2/1
* @since 2017-10-29
*/
@Data
@Schema(description = "用户角色")
@EqualsAndHashCode(callSuper = true)
public class SysUserRole extends Model<SysUserRole> {

View File

@ -26,6 +26,7 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@ -33,22 +34,25 @@ import java.util.List;
* @author lengleng
* @date 2020/12/05
*/
@FeignClient(contextId = "remoteClientDetailsService", value = ServiceNameConstants.UMPS_SERVICE)
@FeignClient(contextId = "remoteClientDetailsService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteClientDetailsService {
/**
* 通过clientId 查询客户端信息
* @param clientId 用户名
* @param from 调用标志
* @return R
*/
@GetMapping(value = "/client/getClientDetailsById/{clientId}", headers = SecurityConstants.HEADER_FROM_IN)
R<SysOauthClientDetails> getClientDetailsById(@PathVariable("clientId") String clientId);
@GetMapping("/client/getClientDetailsById/{clientId}")
R<SysOauthClientDetails> getClientDetailsById(@PathVariable("clientId") String clientId,
@RequestHeader(SecurityConstants.FROM) String from);
/**
* 查询全部客户端
* @param from 调用标识
* @return R
*/
@GetMapping(value = "/client/list", headers = SecurityConstants.HEADER_FROM_IN)
R<List<SysOauthClientDetails>> listClientDetails();
@GetMapping("/client/list")
R<List<SysOauthClientDetails>> listClientDetails(@RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.feign;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
/**
* @author hccake
*/
@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.UMPS_SERVICE)
public interface RemoteDeptService {
/**
* 查收子级id列表
* @return 返回子级id列表
*/
@GetMapping(value = "/dept/child-id/{deptId}", headers = SecurityConstants.HEADER_FROM_IN)
R<List<Long>> listChildDeptId(@PathVariable("deptId") Long deptId);
}

View File

@ -15,7 +15,7 @@ import java.util.List;
* <p>
* 查询参数相关
*/
@FeignClient(contextId = "remoteDictService", value = ServiceNameConstants.UMPS_SERVICE)
@FeignClient(contextId = "remoteDictService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteDictService {
/**

View File

@ -1,17 +1,20 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.feign;
@ -23,20 +26,22 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* @author lengleng
* @date 2019/2/1
* @date 2018/6/28
*/
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UMPS_SERVICE)
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteLogService {
/**
* 保存日志
* @param sysLog 日志实体
* @param from 是否内部调用
* @return succesfalse
*/
@PostMapping(value = "/log", headers = SecurityConstants.HEADER_FROM_IN)
R<Boolean> saveLog(@RequestBody SysLog sysLog);
@PostMapping("/log/save")
R<Boolean> saveLog(@RequestBody SysLog sysLog, @RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -6,6 +6,7 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* @author lengleng
@ -13,15 +14,16 @@ import org.springframework.web.bind.annotation.PathVariable;
* <p>
* 查询参数相关
*/
@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UMPS_SERVICE)
@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteParamService {
/**
* 通过key 查询参数配置
* @param key key
* @param from 声明成内部调用避免MQ 等无法调用
* @return
*/
@GetMapping(value = "/param/publicValue/{key}", headers = SecurityConstants.HEADER_FROM_IN)
R<String> getByKey(@PathVariable("key") String key);
@GetMapping("/param/publicValue/{key}")
R<String> getByKey(@PathVariable("key") String key, @RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -1,21 +1,23 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
@ -26,25 +28,39 @@ import java.util.Map;
/**
* @author lengleng
* @date 2019/2/1
* @date 2018/9/4
*/
@FeignClient(contextId = "remoteTokenService", value = ServiceNameConstants.AUTH_SERVICE)
public interface RemoteTokenService {
/**
* 分页查询token 信息
* @param from 内部调用标志
* @param params 分页参数
* @param from 内部调用标志
* @return page
*/
@PostMapping(value = "/token/page", headers = SecurityConstants.HEADER_FROM_IN)
R getTokenPage(@RequestBody Map<String, Object> params);
@PostMapping("/token/page")
R<Page> getTokenPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 删除token
* @param from 内部调用标志
* @param token token
* @param from 内部调用标志
* @return
*/
@DeleteMapping(value = "/token/{token}", headers = SecurityConstants.HEADER_FROM_IN)
R<Boolean> removeToken(@PathVariable("token") String token);
@DeleteMapping("/token/{token}")
R<Boolean> removeTokenById(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 校验令牌获取用户信息
* @param token
* @param from
* @return
*/
@GetMapping("/token/query-token")
R<Map<String, Object>> queryToken(@RequestParam("token") String token,
@RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -1,64 +1,57 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* http://www.apache.org/licenses/LICENSE-2.0
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.feign;
import com.pig4cloud.pig.admin.api.dto.UserDTO;
import com.pig4cloud.pig.admin.api.dto.UserInfo;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
/**
* @author lengleng
* @date 2019/2/1
* @date 2018/6/22
*/
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UMPS_SERVICE)
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteUserService {
/**
* 通过用户名查询用户角色信息
* @param user 用户查询对象
* @param from 调用标志
* @return R
*/
@GetMapping("/user/info/query")
R<UserInfo> info(@SpringQueryMap UserDTO user, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 锁定用户
* @param username 用户名
* @return R
* @param from 调用标识
* @return
*/
@GetMapping(value = "/user/info/{username}", headers = SecurityConstants.HEADER_FROM_IN)
R<UserInfo> info(@PathVariable("username") String username);
/**
* 通过手机号码查询用户角色信息
* @param phone 手机号码
* @param from 调用标志
* @return R
*/
@GetMapping(value = "/app/info/{phone}", headers = SecurityConstants.HEADER_FROM_IN)
R<UserInfo> infoByMobile(@PathVariable("phone") String phone);
/**
* 根据部门id查询对应的用户 id 集合
* @param deptIds 部门id 集合
* @param from 调用标志
* @return 用户 id 集合
*/
@GetMapping(value = "/user/ids", headers = SecurityConstants.HEADER_FROM_IN)
R<List<Long>> listUserIdByDeptIds(@RequestParam("deptIds") Set<Long> deptIds);
@PutMapping("/user/lock/{username}")
R<Boolean> lockUser(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from);
}

View File

@ -57,7 +57,7 @@ public class DictResolver {
SysDictItem sysDictItem = getDictItemByItemLabel(type, itemLabel);
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getValue() : StringPool.EMPTY;
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getItemValue() : StringPool.EMPTY;
}
/**
@ -72,7 +72,7 @@ public class DictResolver {
List<SysDictItem> dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
return dictItemList.stream().filter(item -> itemValue.equals(item.getValue())).findFirst().orElse(null);
return dictItemList.stream().filter(item -> itemValue.equals(item.getItemValue())).findFirst().orElse(null);
}
return null;

View File

@ -3,6 +3,7 @@ package com.pig4cloud.pig.admin.api.util;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.pig4cloud.pig.admin.api.feign.RemoteParamService;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import lombok.experimental.UtilityClass;
@ -43,7 +44,7 @@ public class ParamResolver {
RemoteParamService remoteParamService = SpringContextHolder.getBean(RemoteParamService.class);
String result = remoteParamService.getByKey(key).getData();
String result = remoteParamService.getByKey(key, SecurityConstants.FROM_IN).getData();
if (StrUtil.isNotBlank(result)) {
return Convert.convert(clazz, result);

View File

@ -0,0 +1,44 @@
package com.pig4cloud.pig.admin.api.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serializable;
/**
* 部门导入导出
*/
@Data
public class DeptExcelVo implements Serializable {
/**
* 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
private Long lineNum;
/**
* 上级部门
*/
@NotBlank(message = "上级部门不能为空")
@ExcelProperty("上级部门")
private String parentName;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@ExcelProperty("部门名称")
private String name;
/**
* 排序
*/
@ExcelProperty(value = "排序值")
private Integer sortOrder;
}

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.vo;
import lombok.Data;
import java.awt.image.BufferedImage;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author lengleng
* @date 2019/2/1
*/
@Data
public class ImageCode implements Serializable {
private String code;
private LocalDateTime expireTime;
private BufferedImage image;
public ImageCode(BufferedImage image, String sRand, int defaultImageExpire) {
this.image = image;
this.code = sRand;
this.expireTime = LocalDateTime.now().plusSeconds(defaultImageExpire);
}
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pig4cloud.pig.admin.api.vo;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import lombok.Data;
import java.io.Serializable;
/**
* @author lengleng
* @date 2019/2/1
*/
@Data
public class LogVO implements Serializable {
private static final long serialVersionUID = 1L;
private SysLog sysLog;
private String username;
}

Some files were not shown because too many files have changed in this diff Show More