Commit 3e02f69c authored by 林洋洋's avatar 林洋洋

调整项目结构

parent 52b71166
root = true
[*.{groovy,java,kt,xml}]
indent_style = tab
indent_size = 4
continuation_indent_size = 8
### gradle ###
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.settings/
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
bin/
### IntelliJ IDEA ###
!.idea/icon.png
.idea
*.iws
*.iml
*.ipr
rebel.xml
### NetBeans ###
nbproject/private/
build/
nbbuild/
nbdist/
.nb-gradle/
### maven ###
target/
*.war
*.ear
*.zip
*.tar
*.tar.gz
*.versionsBackup
### vscode ###
.vscode
### logs ###
/logs/
*.log
### temp ignore ###
*.cache
*.diff
*.patch
*.tmp
*.java~
*.properties~
*.xml~
### system ignore ###
.DS_Store
Thumbs.db
Servers
.metadata
.flattened-pom.xml
This diff is collapsed.
<p align="center">
<img src="https://img.shields.io/badge/Pig-3.9-success.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-2025-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-3.5-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Vue-3.5-blue.svg" alt="Downloads">
<img src="https://img.shields.io/github/license/pig-mesh/pig"/>
<img src="https://gitcode.com/pig-mesh/pig/star/badge.svg"/>
</p>
## 系统说明
- 基于 Spring Cloud 、Spring Boot、 OAuth2 的 RBAC **企业快速开发平台**, 同时支持微服务架构和单体架构
- 提供对 Spring Authorization Server 生产级实践,支持多种安全授权模式
- 提供对常见容器化方案支持 Kubernetes、Rancher2 、Kubesphere、EDAS、SAE 支持
#### 使用文档
PIG 提供了详尽的部署文档 👉 [wiki.pig4cloud.com](https://wiki.pig4cloud.com),涵盖开发环境配置、服务端启动、前端运行等关键步骤。
重要的事情说三遍:
- 🔥 [ 配套文档 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
- 🔥 [ 配套文档 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
- 🔥 [ 配套文档 wiki.pig4cloud.com](https://wiki.pig4cloud.com)
#### 其他产品
- 👉🏻 [PIGX 在线体验](http://home.pig4cloud.com:38081)
- 👉🏻 [自研BPMN工作流引擎](http://home.pig4cloud.com:38082)
- 👉🏻 [大模型 RAG 知识库](http://home.pig4cloud.com:38083)
## 微信群 [禁广告]
<img src='https://minio.pigx.vip/oss/202412/1735262426.png' alt='1735262426'/>
## 快速开始
#### Docker 快速体验
```shell
# 可用内存大于4G
curl -o docker-compose.yaml https://try.pig4cloud.com
# 等待5分钟
docker compose up
```
### 核心依赖
| 依赖 | 版本 |
|-----------------------------|------|
| Spring Boot | 3.5 |
| Spring Cloud | 2025 |
| Spring Cloud Alibaba | 2023 |
| Spring Authorization Server | 1.5 |
| Mybatis Plus | 3.5 |
| Vue | 3.5 |
| Element Plus | 2.7 |
### 模块说明
```lua
pig-ui -- https://gitee.com/log4j/pig-ui
pig
├── pig-boot -- 单体模式启动器[9999]
├── pig-auth -- 授权服务提供[3000]
└── pig-common -- 系统公共模块
├── pig-common-bom -- 全局依赖管理控制
├── pig-common-core -- 公共工具类核心包
├── pig-common-datasource -- 动态数据源包
├── pig-common-log -- 日志服务
├── pig-common-oss -- 文件上传工具类
├── pig-common-mybatis -- mybatis 扩展封装
├── pig-common-seata -- 分布式事务
├── pig-common-security -- 安全工具类
├── pig-common-swagger -- 接口文档
├── pig-common-feign -- feign 扩展封装
└── pig-common-xss -- xss 安全封装
├── pig-register -- Nacos Server[8848]
├── pig-gateway -- Spring Cloud Gateway网关[9999]
└── pig-upms -- 通用用户权限管理模块
└── pig-upms-api -- 通用用户权限管理系统公共api模块
└── pig-upms-biz -- 通用用户权限管理系统业务处理模块[4000]
└── pig-visual
└── pig-monitor -- 服务监控 [5001]
├── pig-codegen -- 图形化代码生成 [5002]
└── pig-quartz -- 定时任务管理台 [5007]
```
## 免费公开课
<table>
<tr>
<td><a href="https://www.bilibili.com/video/av45084065" target="_blank"><img src="https://foruda.gitee.com/images/1731647304254897555/88a9c2fa_441246.jpeg"></a></td>
<td><a href="https://www.bilibili.com/video/av77344954" target="_blank"><img src="https://foruda.gitee.com/images/1731647324953921510/39689640_441246.jpeg"></a></td>
</tr>
<tr>
<td><a href="https://www.bilibili.com/video/BV1J5411476V" target="_blank"><img src="https://foruda.gitee.com/images/1731647357502030768/7f31f392_441246.jpeg"></a></td>
<td><a href="https://www.bilibili.com/video/BV14p4y197K5" target="_blank"><img src="https://foruda.gitee.com/images/1731647375444479120/2b8fd494_441246.jpeg"></a></td>
</tr>
</table>
## 开源共建
### 开源协议
pig 开源软件遵循 [Apache 2.0 协议](https://www.apache.org/licenses/LICENSE-2.0.html)
允许商业使用,但务必保留类作者、Copyright 信息。
![](https://foruda.gitee.com/images/1731647419204307063/91217172_441246.jpeg)
### 其他说明
1. 欢迎提交 [PR](https://dwz.cn/2KURd5Vf),注意对应提交对应 `dev` 分支
代码规范 [spring-javaformat](https://github.com/spring-io/spring-javaformat)
<details>
<summary>代码规范说明</summary>
1. 由于 <a href="https://github.com/spring-io/spring-javaformat" target="_blank">spring-javaformat</a>
强制所有代码按照指定格式排版,未按此要求提交的代码将不能通过合并(打包)
2. 如果使用 IntelliJ IDEA
开发,请安装自动格式化软件 <a href="https://repo1.maven.org/maven2/io/spring/javaformat/spring-javaformat-intellij-idea-plugin/" target="_blank">
spring-javaformat-intellij-idea-plugin</a>
3. 其他开发工具,请参考 <a href="https://github.com/spring-io/spring-javaformat" target="_blank">
spring-javaformat</a>
说明,或`提交代码前`在项目根目录运行下列命令(需要开发者电脑支持`mvn`命令)进行代码格式化
```
mvn spring-javaformat:apply
```
</details>
2. 欢迎提交 [issue](https://gitee.com/log4j/pig/issues),请写清楚遇到问题的原因、开发环境、复显步骤。
services:
pig-mysql:
build:
context: ./db
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: root
restart: always
container_name: pig-mysql
image: pig-mysql
ports:
- 33306:3306
networks:
- spring_cloud_default
pig-redis:
image: registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/redis
ports:
- 36379:6379
restart: always
container_name: pig-redis
hostname: pig-redis
networks:
- spring_cloud_default
pig-register:
build:
context: ./pig-register
restart: always
ports:
- 8848:8848
- 9848:9848
- 8080:8080
environment:
MYSQL_HOST: pig-mysql
REDIS_HOST: pig-redis
container_name: pig-register
hostname: pig-register
image: pig-register
networks:
- spring_cloud_default
pig-gateway:
build:
context: ./pig-gateway
restart: always
ports:
- 9999:9999
container_name: pig-gateway
hostname: pig-gateway
image: pig-gateway
environment:
REDIS_HOST: pig-redis
NACOS_HOST: pig-register
networks:
- spring_cloud_default
pig-auth:
build:
context: ./pig-auth
restart: always
container_name: pig-auth
hostname: pig-auth
image: pig-auth
environment:
REDIS_HOST: pig-redis
NACOS_HOST: pig-register
networks:
- spring_cloud_default
pig-upms:
build:
context: ./pig-upms/pig-upms-biz
restart: always
container_name: pig-upms
hostname: pig-upms
image: pig-upms
environment:
MYSQL_HOST: pig-mysql
REDIS_HOST: pig-redis
NACOS_HOST: pig-register
networks:
- spring_cloud_default
pig-monitor:
build:
context: ./pig-visual/pig-monitor
restart: always
ports:
- 5001:5001
container_name: pig-monitor
hostname: pig-monitor
image: pig-monitor
environment:
NACOS_HOST: pig-register
networks:
- spring_cloud_default
pig-codegen:
build:
context: ./pig-visual/pig-codegen
restart: always
container_name: pig-codegen
hostname: pig-codegen
image: pig-codegen
environment:
MYSQL_HOST: pig-mysql
REDIS_HOST: pig-redis
NACOS_HOST: pig-register
networks:
- spring_cloud_default
pig-quartz:
build:
context: ./pig-visual/pig-quartz
restart: always
image: pig-quartz
container_name: pig-quartz
environment:
MYSQL_HOST: pig-mysql
REDIS_HOST: pig-redis
NACOS_HOST: pig-register
networks:
- spring_cloud_default
networks:
spring_cloud_default:
name: spring_cloud_default
driver: bridge
FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:17-anolis
WORKDIR /pig-boot
ARG JAR_FILE=target/pig-boot.jar
COPY ${JAR_FILE} app.jar
EXPOSE 9999
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom"
CMD sleep 60; java $JAVA_OPTS -jar app.jar
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>${revision}</version>
</parent>
<artifactId>pig-boot</artifactId>
<packaging>jar</packaging>
<description>pig 单体版本启动</description>
<dependencies>
<!--必备:认证中心模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-auth</artifactId>
<version>${revision}</version>
</dependency>
<!--必备:用户管理模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-biz</artifactId>
<version>${revision}</version>
</dependency>
<!--必备:AI模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-ask-biz</artifactId>
<version>${revision}</version>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
</dependency>
<!-- 接口文档UI -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
</dependency>
<dependency>
<groupId>io.springboot</groupId>
<artifactId>knife4j-boot-openapi3-ui</artifactId>
<version>${knife4j.version}</version>
</dependency>
<!--接口文档-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-swagger</artifactId>
</dependency>
<!--undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
/*
* 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;
import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer;
import com.pig4cloud.pig.common.swagger.annotation.EnablePigDoc;
import com.pig4cloud.pig.common.datasource.annotation.EnableDynamicDataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 单体版本启动器,运行此模块即可启动整个系统
*
* @author lengleng
* @date 2025/05/30
*/
@EnablePigDoc(value = "admin", isMicro = false)
@EnablePigResourceServer
@EnableDynamicDataSource
@SpringBootApplication
public class PigBootApplication {
public static void main(String[] args) {
SpringApplication.run(PigBootApplication.class, args);
}
}
spring:
cache:
type: redis # 缓存类型 Redis
data:
redis:
database: 7
host: 81.70.183.25
port: 16379
password: '123qwe!@#'
# 数据库相关配置
datasource:
dynamic:
primary: master
strict: true
datasource:
master:
url: jdbc:postgresql://81.70.183.25:25432/ask_data_ai_db
username: postgres
password: postgres123
driver-class-name: org.postgresql.Driver
ai:
vectorstore:
pgvector:
index-type: HNSW
distance-type: COSINE_DISTANCE
dimensions: 1024
max-document-batch-size: 10000 # Optional: Maximum number of documents per batch
schema-name: public
table-name: vector_store
chat:
memory:
repository:
jdbc:
initialize-schema: never # 开发环境可以使用 always,方便调试
platform: postgresql
openai:
base-url: https://dashscope.aliyuncs.com/compatible-mode
api-key: sk-ae96ff281ff644c992843c64a711a950
chat:
options:
model: qwen-plus
embedding:
base-url: https://dashscope.aliyuncs.com/compatible-mode
api-key: sk-ae96ff281ff644c992843c64a711a950
options:
model: text-embedding-v4
# 本地文件系统
file:
local:
enable: true
base-path: /Users/lengleng/Downloads/img
## 登录配置
security:
# 登录报文加密根密钥 ,必须是16位
encodeKey: thanks,pig4cloud
# 跳过验证码校验的客户端
ignore-clients:
- test
# 配置文件加密根密码
jasypt:
encryptor:
password: pig # 加密根密码
algorithm: PBEWithMD5AndDES # 加密算法
iv-generator-classname: org.jasypt.iv.NoIvGenerator # 无向量生成器
# 短信插件配置:https://www.yuque.com/vxixfq/pig/zw8udk
sms:
is-print: false # 是否打印日志
config-type: yaml # 配置类型,yaml
\ No newline at end of file
server:
port: 9999 # 项目端口
servlet:
context-path: /admin # 项目访问路径
spring:
application:
name: @project.artifactId@ # 服务名称,取 pom.xml 中的 artifactId
# 上传文件大小限制
servlet:
multipart:
max-file-size: 100MB # 单个文件最大
max-request-size: 100MB # 接收的最大请求大小
cloud:
nacos: # 单机版本关闭nacos 服务发现和配置管理的能力
config:
enabled: false
discovery:
enabled: false
freemarker: # freemarker 配置,授权码模式页面渲染使用
suffix: .ftl
template-loader-path: classpath:/templates/
request-context-attribute: request
main:
allow-bean-definition-overriding: true # 允许覆盖bean定义
profiles:
active: dev # 激活dev,对应 application-dev.yml
## spring security 对外暴露接口设置(不鉴权直接可访问)
security:
micro: false
oauth2:
ignore:
urls:
- /webjars/**
- /v3/api-docs/**
- /doc.html
- /swagger-ui.html
- /swagger-ui/**
- /swagger-resources
- /code/image
- /error
- /token/**
- /actuator/**
#--------------如下配置尽量不要变动-------------
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml # mapper文件位置
global-config:
banner: false # 是否打印 mybatis-plus banner
db-config:
id-type: auto # 主键类型
where-strategy: not_empty # where 条件策略
insert-strategy: not_empty # 插入策略
update-strategy: not_null # 更新策略
type-handlers-package: com.pig4cloud.pig.common.mybatis.handler # 类型处理器包
configuration:
jdbc-type-for-null: 'null' # 是否设置字段为null
call-setters-on-nulls: true # 是否调用set方法时传入null值
shrink-whitespaces-in-sql: true # 去掉sql中多余的空格
<?xml version="1.0" encoding="UTF-8"?>
<!--
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
<properties>
<log-path>/Users/lengleng</log-path>
</properties>
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
-->
<configuration debug="false" scan="false">
<property name="log.path" value="logs/${project.artifactId}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
class="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!--nacos 心跳 INFO 屏蔽-->
<logger name="com.alibaba.nacos" level="OFF">
<appender-ref ref="error"/>
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>${revision}</version>
</parent>
<artifactId>pig-upms-api</artifactId>
<packaging>jar</packaging>
<description>pig 通用用户权限管理系统公共api模块</description>
<dependencies>
<!--core 工具类-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
</dependency>
<!--feign 注解依赖-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-feign</artifactId>
</dependency>
<!--mybatis 依赖-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-mybatis</artifactId>
</dependency>
<!-- excel 导入导出 -->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-excel</artifactId>
</dependency>
</dependencies>
</project>
package com.pig4cloud.pig.admin.api.dto;
import lombok.Data;
/**
* 注册用户 DTO
*
* @author lengleng
* @date 2024/12/23
*/
@Data
public class RegisterUserDTO {
/**
* 用户名
*/
private String username;
/**
* 新密码
*/
private String password;
/**
* 电话
*/
private String phone;
}
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;
/**
* @author lengleng
* @date 2020/10/9
* <p>
* 日志查询传输对象
*/
@Data
@Schema(description = "日志查询对象")
public class SysLogDTO {
/**
* 编号
*/
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;
/**
* 创建时间区间 [开始时间,结束时间]
*/
private LocalDateTime[] createTime;
}
/*
*
* 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.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;
import java.util.List;
/**
* @author lengleng
* @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;
/**
* 岗位ID
*/
private List<Long> post;
/**
* 新密码
*/
@Schema(description = "新密码")
private String newpassword1;
}
/*
*
* 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.admin.api.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pig4cloud.pig.admin.api.vo.UserVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 用户信息实体类,继承自UserVO并实现Serializable接口 , spring security
*
* @author lengleng
* @date 2025/06/28
*/
@Data
@Schema(description = "spring security 用户信息")
@EqualsAndHashCode(callSuper = true)
public class UserInfo extends UserVO implements Serializable {
/**
* 密码
*/
@JsonIgnore(value = false)
private String password;
/**
* 随机盐
*/
@JsonIgnore(value = false)
private String salt;
/**
* 权限标识集合
*/
@Schema(description = "权限标识集合")
private List<String> permissions = new ArrayList<>();
}
/*
*
* 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.admin.api.entity;
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 lombok.experimental.FieldNameConstants;
import java.time.LocalDateTime;
/**
* <p>
* 部门管理
* </p>
*
* @author lengleng
* @since 2018-01-22
*/
@Data
@Schema(description = "部门")
@FieldNameConstants
@EqualsAndHashCode(callSuper = true)
public class SysDept extends Model<SysDept> {
private static final long serialVersionUID = 1L;
@TableId(value = "dept_id", type = IdType.AUTO)
@Schema(description = "部门id")
private Long deptId;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@Schema(description = "部门名称")
private String name;
/**
* 排序
*/
@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
*/
@Schema(description = "父级部门id")
private Long parentId;
/**
* 是否删除 1:已删除 0:正常
*/
@TableLogic
@Schema(description = "删除标记,1:已删除,0:正常")
@TableField(fill = FieldFill.INSERT)
private String delFlag;
}
/*
*
* 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.admin.api.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 部门关系表
* </p>
*
* @author lengleng
* @since 2018-01-22
*/
@Data
@Schema(description = "部门关系")
@EqualsAndHashCode(callSuper = true)
public class SysDeptRelation extends Model<SysDeptRelation> {
private static final long serialVersionUID = 1L;
/**
* 祖先节点
*/
@Schema(description = "祖先节点")
private Long ancestor;
/**
* 后代节点
*/
@Schema(description = "后代节点")
private Long descendant;
}
/*
* 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.admin.api.entity;
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;
/**
* 字典表
*
* @author lengleng
* @date 2019/03/19
*/
@Data
@Schema(description = "字典类型")
@EqualsAndHashCode(callSuper = true)
public class SysDict extends Model<SysDict> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@Schema(description = "字典编号")
private Long id;
/**
* 类型
*/
@Schema(description = "字典类型")
private String dictType;
/**
* 描述
*/
@Schema(description = "字典描述")
private String description;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/**
* 是否是系统内置
*/
@Schema(description = "是否系统内置")
private String systemFlag;
/**
* 备注信息
*/
@Schema(description = "备注信息")
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;
}
/*
* 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.admin.api.entity;
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;
/**
* 字典项
*
* @author lengleng
* @date 2019/03/19
*/
@Data
@Schema(description = "字典项")
@EqualsAndHashCode(callSuper = true)
public class SysDictItem extends Model<SysDictItem> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@Schema(description = "字典项id")
private Long id;
/**
* 所属字典类id
*/
@Schema(description = "所属字典类id")
private Long dictId;
/**
* 数据值
*/
@Schema(description = "数据值")
@JsonProperty(value = "value")
private String itemValue;
/**
* 标签名
*/
@Schema(description = "标签名")
private String label;
/**
* 类型
*/
@Schema(description = "类型")
private String dictType;
/**
* 描述
*/
@Schema(description = "描述")
private String description;
/**
* 排序(升序)
*/
@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 remarks;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}
/*
* 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.admin.api.entity;
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;
/**
* 文件管理
*
* @author Luckly
* @date 2019-06-18 17:18:42
*/
@Data
@Schema(description = "文件")
@EqualsAndHashCode(callSuper = true)
public class SysFile extends Model<SysFile> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@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
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}
/*
*
* 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.admin.api.entity;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 日志表
* </p>
*
* @author lengleng
* @since 2017-11-20
*/
@Data
@Schema(description = "日志")
public class SysLog implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@ExcelProperty("日志编号")
@Schema(description = "日志编号")
private Long id;
/**
* 日志类型
*/
@NotBlank(message = "日志类型不能为空")
@ExcelProperty("日志类型(0-正常 9-错误)")
@Schema(description = "日志类型")
private String logType;
/**
* 日志标题
*/
@NotBlank(message = "日志标题不能为空")
@ExcelProperty("日志标题")
@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地址")
@Schema(description = "操作ip地址")
private String remoteAddr;
/**
* 用户代理
*/
@Schema(description = "用户代理")
private String userAgent;
/**
* 请求URI
*/
@ExcelProperty("浏览器")
@Schema(description = "请求uri")
private String requestUri;
/**
* 操作方式
*/
@ExcelProperty("操作方式")
@Schema(description = "操作方式")
private String method;
/**
* 操作提交的数据
*/
@ExcelProperty("提交数据")
@Schema(description = "提交数据")
private String params;
/**
* 执行时间
*/
@ExcelProperty("执行时间")
@Schema(description = "方法执行时间")
private Long time;
/**
* 异常信息
*/
@ExcelProperty("异常信息")
@Schema(description = "异常信息")
private String exception;
/**
* 服务ID
*/
@ExcelProperty("应用标识")
@Schema(description = "应用标识")
private String serviceId;
/**
* 删除标记
*/
@TableLogic
@ExcelIgnore
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
}
/*
*
* 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.admin.api.entity;
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 lombok.experimental.FieldNameConstants;
import java.time.LocalDateTime;
/**
* <p>
* 菜单权限表
* </p>
*
* @author lengleng
* @since 2017-11-08
*/
@Data
@Schema(description = "菜单")
@FieldNameConstants
@EqualsAndHashCode(callSuper = true)
public class SysMenu extends Model<SysMenu> {
private static final long serialVersionUID = 1L;
/**
* 菜单ID
*/
@TableId(value = "menu_id", type = IdType.AUTO)
@Schema(description = "菜单id")
private Long menuId;
/**
* 菜单名称
*/
@NotBlank(message = "菜单名称不能为空")
@Schema(description = "菜单名称")
private String name;
/**
* 菜单名称
*/
@Schema(description = "菜单名称")
private String enName;
/**
* 菜单权限标识
*/
@Schema(description = "菜单权限标识")
private String permission;
/**
* 父菜单ID
*/
@NotNull(message = "菜单父ID不能为空")
@Schema(description = "菜单父id")
private Long parentId;
/**
* 图标
*/
@Schema(description = "菜单图标")
private String icon;
/**
* 前端路由标识路径,默认和 comment 保持一致 过期
*/
@Schema(description = "前端路由标识路径")
private String path;
/**
* 菜单显示隐藏控制
*/
@Schema(description = "菜单是否显示")
private String visible;
/**
* 排序值
*/
@Schema(description = "排序值")
private Integer sortOrder;
/**
* 菜单类型 (0菜单 1按钮)
*/
@NotNull(message = "菜单类型不能为空")
@Schema(description = "菜单类型,0:菜单 1:按钮")
private String menuType;
/**
* 路由缓冲
*/
@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;
}
/*
*
* 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.admin.api.entity;
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 java.time.LocalDateTime;
/**
* <p>
* 客户端信息
* </p>
*
* @author lengleng
* @since 2018-05-15
*/
@Data
@Schema(description = "客户端信息")
@EqualsAndHashCode(callSuper = true)
public class SysOauthClientDetails extends Model<SysOauthClientDetails> {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
@Schema(description = "id")
private Long id;
/**
* 客户端ID
*/
@NotBlank(message = "client_id 不能为空")
@Schema(description = "客户端id")
private String clientId;
/**
* 客户端密钥
*/
@NotBlank(message = "client_secret 不能为空")
@Schema(description = "客户端密钥")
private String clientSecret;
/**
* 资源ID
*/
@Schema(description = "资源id列表")
private String resourceIds;
/**
* 作用域
*/
@NotBlank(message = "scope 不能为空")
@Schema(description = "作用域")
private String scope;
/**
* 授权方式[A,B,C]
*/
@Schema(description = "授权方式")
private String[] authorizedGrantTypes;
/**
* 回调地址
*/
@Schema(description = "回调地址")
private String webServerRedirectUri;
/**
* 权限
*/
@Schema(description = "权限列表")
private String authorities;
/**
* 请求令牌有效时间
*/
@Schema(description = "请求令牌有效时间")
private Integer accessTokenValidity;
/**
* 刷新令牌有效时间
*/
@Schema(description = "刷新令牌有效时间")
private Integer refreshTokenValidity;
/**
* 扩展信息
*/
@Schema(description = "扩展信息")
private String additionalInformation;
/**
* 是否自动放行
*/
@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;
}
/*
* 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.admin.api.entity;
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-26 12:50:43
*/
@Data
@TableName("sys_post")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "岗位信息表")
public class SysPost extends Model<SysPost> {
private static final long serialVersionUID = 1L;
/**
* 岗位ID
*/
@TableId(value = "post_id", type = IdType.AUTO)
@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 = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
}
/*
* 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.admin.api.entity;
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;
/**
* 公共参数配置
*
* @author Lucky
* @date 2019-04-29
*/
@Data
@Schema(description = "公共参数")
@EqualsAndHashCode(callSuper = true)
public class SysPublicParam extends Model<SysPublicParam> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@Schema(description = "公共参数编号")
private Long publicId;
/**
* 公共参数名称
*/
@Schema(description = "公共参数名称", required = true, example = "公共参数名称")
private String publicName;
/**
* 公共参数地址值,英文大写+下划线
*/
@Schema(description = "键[英文大写+下划线]", required = true, example = "PIGX_PUBLIC_KEY")
private String publicKey;
/**
* 值
*/
@Schema(description = "值", required = true, example = "999")
private String publicValue;
/**
* 状态(1有效;2无效;)
*/
@Schema(description = "标识[1有效;2无效]", example = "1")
private String status;
/**
* 公共参数编码
*/
@Schema(description = "编码", example = "^(PIG|PIGX)$")
private String validateCode;
/**
* 是否是系统内置
*/
@Schema(description = "是否是系统内置")
private String systemFlag;
/**
* 配置类型:0-默认;1-检索;2-原文;3-报表;4-安全;5-文档;6-消息;9-其他
*/
@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;
}
/*
*
* 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.admin.api.entity;
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 java.time.LocalDateTime;
/**
* <p>
* 角色表
* </p>
*
* @author lengleng
* @since 2017-10-29
*/
@Data
@Schema(description = "角色")
@EqualsAndHashCode(callSuper = true)
public class SysRole extends Model<SysRole> {
private static final long serialVersionUID = 1L;
@TableId(value = "role_id", type = IdType.AUTO)
@Schema(description = "角色编号")
private Long roleId;
@NotBlank(message = "角色名称不能为空")
@Schema(description = "角色名称")
private String roleName;
@NotBlank(message = "角色标识不能为空")
@Schema(description = "角色标识")
private String roleCode;
@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;
}
/*
*
* 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.admin.api.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 角色菜单表
* </p>
*
* @author lengleng
* @since 2017-10-29
*/
@Data
@Schema(description = "角色菜单")
@EqualsAndHashCode(callSuper = true)
public class SysRoleMenu extends Model<SysRoleMenu> {
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
@Schema(description = "角色id")
private Long roleId;
/**
* 菜单ID
*/
@Schema(description = "菜单id")
private Long menuId;
}
/*
*
* 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.admin.api.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 用户表
* </p>
*
* @author lengleng
* @since 2017-10-29
*/
@Data
@Schema(description = "用户")
public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(value = "user_id", type = IdType.AUTO)
@Schema(description = "主键id")
private Long userId;
/**
* 用户名
*/
@Schema(description = "用户名")
private String username;
/**
* 密码
*/
@Schema(description = "密码")
private String password;
/**
* 随机盐
*/
@JsonIgnore
@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;
/**
* 锁定标记
*/
@Schema(description = "锁定标记")
private String lockFlag;
/**
* 手机号
*/
@Schema(description = "手机号")
private String phone;
/**
* 头像
*/
@Schema(description = "头像地址")
private String avatar;
/**
* 部门ID
*/
@Schema(description = "用户所属部门id")
private Long deptId;
/**
* 微信openid
*/
@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;
}
/*
* 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.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 用户岗位表
* </p>
*
* @author fxz
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysUserPost extends Model<SysUserPost> {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
@Schema(description = "用户id")
private Long userId;
/**
* 岗位ID
*/
@Schema(description = "岗位id")
private Long postId;
}
/*
*
* 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.admin.api.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 用户角色表
* </p>
*
* @author lengleng
* @since 2017-10-29
*/
@Data
@Schema(description = "用户角色")
@EqualsAndHashCode(callSuper = true)
public class SysUserRole extends Model<SysUserRole> {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
@Schema(description = "用户id")
private Long userId;
/**
* 角色ID
*/
@Schema(description = "角色id")
private Long roleId;
}
/*
*
* 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.admin.api.feign;
import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 远程客户端详情服务接口
*
* @author lengleng
* @date 2025/05/30
*/
@FeignClient(contextId = "remoteClientDetailsService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteClientDetailsService {
/**
* 通过clientId 查询客户端信息 (未登录,需要无token 内部调用)
* @param clientId 用户名
* @return R
*/
@NoToken
@GetMapping("/client/getClientDetailsById/{clientId}")
R<SysOauthClientDetails> getClientDetailsById(@PathVariable("clientId") String clientId);
}
package com.pig4cloud.pig.admin.api.feign;
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
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 lengleng
* @date 2025/05/30
*/
@FeignClient(contextId = "remoteDictService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteDictService {
/**
* 通过字典类型查找字典
* @param type 字典类型
* @return 同类型字典
*/
@NoToken
@GetMapping("/dict/remote/type/{type}")
R<List<SysDictItem>> getDictByType(@PathVariable("type") String type);
}
/*
*
* 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.admin.api.feign;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 远程日志服务接口
*
* @author lengleng
* @date 2025/05/30
*/
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteLogService {
/**
* 保存日志 (异步多线程调用,无token)
* @param sysLog 日志实体
* @return succes、false
*/
@NoToken
@PostMapping("/log/save")
R<Boolean> saveLog(@RequestBody SysLog sysLog);
}
package com.pig4cloud.pig.admin.api.feign;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 远程参数服务接口
* <p>
* 通过Feign客户端调用UPMS服务获取参数配置
* </p>
*
* @author lengleng
* @date 2025/05/30
* @see FeignClient
*/
@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteParamService {
/**
* 通过key 查询参数配置
* @param key key
* @NoToken 声明成内部调用,避免MQ 等无法调用
*/
@NoToken
@GetMapping("/param/publicValue/{key}")
R<String> getByKey(@PathVariable("key") String key);
}
/*
* 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.admin.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 远程令牌服务接口
*
* @author lengleng
* @date 2025/05/30
*/
@FeignClient(contextId = "remoteTokenService", value = ServiceNameConstants.AUTH_SERVICE)
public interface RemoteTokenService {
/**
* 分页查询token 信息
* @param params 分页参数
* @return page
*/
@NoToken
@PostMapping("/token/page")
R<Page> getTokenPage(@RequestBody Map<String, Object> params);
/**
* 根据token删除token信息
* @param token 要删除的token
* @return 删除操作结果,包含是否成功的布尔值
*/
@NoToken
@DeleteMapping("/token/remove/{token}")
R<Boolean> removeTokenById(@PathVariable("token") String token);
/**
* 根据令牌查询用户信息
* @param token 用户令牌
* @return 包含用户信息的响应结果
*/
@NoToken
@GetMapping("/token/query-token")
R<Map<String, Object>> queryToken(@RequestParam("token") String token);
}
/*
*
* 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.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.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
/**
* 远程用户服务接口:提供用户信息查询功能
*
* @author lengleng
* @date 2025/05/30
*/
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteUserService {
/**
* (未登录状态调用,需要加 @NoToken) 通过用户名查询用户、角色信息
* @param user 用户查询对象
* @return R
*/
@NoToken
@GetMapping("/user/info/query")
R<UserInfo> info(@SpringQueryMap UserDTO user);
}
package com.pig4cloud.pig.admin.api.util;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
import com.pig4cloud.pig.admin.api.feign.RemoteDictService;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import lombok.experimental.UtilityClass;
import java.util.List;
/**
* 字典解析工具类:提供字典数据的查询和解析功能
*
* @author lengleng
* @date 2025/05/30
*/
@UtilityClass
public class DictResolver {
/**
* 根据字典类型获取所有字典项
* @param type 字典类型
* @return 字典数据项集合
*/
public List<SysDictItem> getDictItemsByType(String type) {
Assert.isTrue(StringUtils.isNotBlank(type), "参数不合法");
RemoteDictService remoteDictService = SpringContextHolder.getBean(RemoteDictService.class);
return remoteDictService.getDictByType(type).getData();
}
/**
* 根据字典类型以及字典项字典值获取字典标签
* @param type 字典类型
* @param itemValue 字典项字典值
* @return 字典项标签值
*/
public String getDictItemLabel(String type, String itemValue) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemValue), "参数不合法");
SysDictItem sysDictItem = getDictItemByItemValue(type, itemValue);
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getLabel() : StringPool.EMPTY;
}
/**
* 根据字典类型以及字典标签获取字典值
* @param type 字典类型
* @param itemLabel 字典数据标签
* @return 字典数据项值
*/
public String getDictItemValue(String type, String itemLabel) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemLabel), "参数不合法");
SysDictItem sysDictItem = getDictItemByItemLabel(type, itemLabel);
return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getItemValue() : StringPool.EMPTY;
}
/**
* 根据字典类型以及字典值获取字典项
* @param type 字典类型
* @param itemValue 字典数据值
* @return 字典数据项
*/
public SysDictItem getDictItemByItemValue(String type, String itemValue) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemValue), "参数不合法");
List<SysDictItem> dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
return dictItemList.stream().filter(item -> itemValue.equals(item.getItemValue())).findFirst().orElse(null);
}
return null;
}
/**
* 根据字典类型以及字典标签获取字典项
* @param type 字典类型
* @param itemLabel 字典数据项标签
* @return 字典数据项
*/
public SysDictItem getDictItemByItemLabel(String type, String itemLabel) {
Assert.isTrue(StringUtils.isNotBlank(type) && StringUtils.isNotBlank(itemLabel), "参数不合法");
List<SysDictItem> dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
return dictItemList.stream().filter(item -> itemLabel.equals(item.getLabel())).findFirst().orElse(null);
}
return null;
}
}
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.util.SpringContextHolder;
import lombok.experimental.UtilityClass;
/**
* 系统参数配置解析器工具类
*
* @author lengleng
* @date 2025/05/30
*/
@UtilityClass
public class ParamResolver {
/**
* 根据key 查询value 配置
* @param key key
* @param defaultVal 默认值
* @return value
*/
public Long getLong(String key, Long... defaultVal) {
return checkAndGet(key, Long.class, defaultVal);
}
/**
* 根据key 查询value 配置
* @param key key
* @param defaultVal 默认值
* @return value
*/
public String getStr(String key, String... defaultVal) {
return checkAndGet(key, String.class, defaultVal);
}
/**
* 根据key获取远程参数值并转换为指定类型
* @param key 参数key
* @param clazz 目标类型
* @param defaultVal 默认值(可选,最多一个)
* @param <T> 泛型类型
* @return 转换后的参数值,未找到且无默认值时返回null
* @throws IllegalArgumentException 参数不合法时抛出异常
*/
private <T> T checkAndGet(String key, Class<T> clazz, T... defaultVal) {
// 校验入参是否合法
if (StrUtil.isBlank(key) || defaultVal.length > 1) {
throw new IllegalArgumentException("参数不合法");
}
RemoteParamService remoteParamService = SpringContextHolder.getBean(RemoteParamService.class);
String result = remoteParamService.getByKey(key).getData();
if (StrUtil.isNotBlank(result)) {
return Convert.convert(clazz, result);
}
if (defaultVal.length == 1) {
return Convert.convert(clazz, defaultVal.clone()[0]);
}
return null;
}
}
package com.pig4cloud.pig.admin.api.vo;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.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;
}
package com.pig4cloud.pig.admin.api.vo;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 岗位excel 对应的实体
*
* @author fxz
* @date 2022/3/21
*/
@Data
@ColumnWidth(30)
public class PostExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
private Long lineNum;
/**
* 主键ID
*/
@ExcelProperty("岗位编号")
private Long postId;
/**
* 岗位名称
*/
@NotBlank(message = "岗位名称不能为空")
@ExcelProperty("岗位名称")
private String postName;
/**
* 岗位标识
*/
@NotBlank(message = "岗位标识不能为空")
@ExcelProperty("岗位标识")
private String postCode;
/**
* 岗位排序
*/
@NotNull(message = "岗位排序不能为空")
@ExcelProperty("岗位排序")
private Integer postSort;
/**
* 岗位描述
*/
@NotBlank(message = "岗位描述不能为空")
@ExcelProperty(value = "岗位描述")
private String remark;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
/*
* 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.admin.api.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author lengleng
* @date 2018/8/27 前端日志vo
*/
@Data
@Schema(description = "前端日志展示对象")
public class PreLogVO {
/**
* 请求url
*/
@Schema(description = "请求url")
private String url;
/**
* 请求耗时
*/
@Schema(description = "请求耗时")
private String time;
/**
* 请求用户
*/
@Schema(description = "请求用户")
private String user;
/**
* 请求结果
*/
@Schema(description = "请求结果0:成功9:失败")
private String type;
/**
* 请求传递参数
*/
@Schema(description = "请求传递参数")
private String message;
/**
* 异常信息
*/
@Schema(description = "异常信息")
private String stack;
/**
* 日志标题
*/
@Schema(description = "日志标题")
private String info;
}
package com.pig4cloud.pig.admin.api.vo;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 角色excel 对应的实体
*
* @author fxz
* @date 2022/3/21
*/
@Data
@ColumnWidth(30)
public class RoleExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
private Long lineNum;
/**
* 主键ID
*/
@ExcelProperty("角色编号")
private Long roleId;
/**
* 角色名称
*/
@NotBlank(message = "角色名称不能为空")
@ExcelProperty("角色名称")
private String roleName;
/**
* 角色标识
*/
@NotBlank(message = "角色标识不能为空")
@ExcelProperty("角色标识")
private String roleCode;
/**
* 角色描述
*/
@NotBlank(message = "角色描述不能为空")
@ExcelProperty("角色描述")
private String roleDesc;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
/*
* 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.admin.api.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author lengleng
* @date 2020/2/10
*/
@Data
@Schema(description = "前端角色展示对象")
public class RoleVO {
/**
* 角色id
*/
private Long roleId;
/**
* 菜单列表
*/
private String menuIds;
}
package com.pig4cloud.pig.admin.api.vo;
import lombok.Data;
/**
* 前端展示令牌管理
*
* @author lengleng
* @date 2022/6/2
*/
@Data
public class TokenVo {
private String id;
private Long userId;
private String clientId;
private String username;
private String accessToken;
private String issuedAt;
private String expiresAt;
}
package com.pig4cloud.pig.admin.api.vo;
import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.DictTypeProperty;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户excel 对应的实体
*
* @author lengleng
* @date 2021/8/4
*/
@Data
@ColumnWidth(30)
public class UserExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
private Long lineNum;
/**
* 主键ID
*/
@ExcelProperty("用户编号")
private Long userId;
/**
* 用户名
*/
@NotBlank(message = "用户名不能为空")
@ExcelProperty("用户名")
private String username;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
@ExcelProperty("手机号")
private String phone;
/**
* 手机号
*/
@NotBlank(message = "昵称不能为空")
@ExcelProperty("昵称")
private String nickname;
/**
* 手机号
*/
@NotBlank(message = "姓名不能为空")
@ExcelProperty("姓名")
private String name;
/**
* 手机号
*/
@NotBlank(message = "邮箱不能为空")
@ExcelProperty("邮箱")
private String email;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空")
@ExcelProperty("部门名称")
private String deptName;
/**
* 角色列表
*/
@NotBlank(message = "角色不能为空")
@ExcelProperty("角色")
private String roleNameList;
/**
* 角色列表
*/
@NotBlank(message = "岗位不能为空")
@ExcelProperty("岗位名称")
private String postNameList;
/**
* 锁定标记
*/
@ExcelProperty("锁定标记,0:正常,9:已锁定")
@DictTypeProperty("lock_flag")
private String lockFlag;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
}
/*
*
* 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.admin.api.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pig4cloud.pig.admin.api.entity.SysDept;
import com.pig4cloud.pig.admin.api.entity.SysPost;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author lengleng
* @date 2017/10/29
*/
@Data
@Schema(description = "前端用户展示对象")
public class UserVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@Schema(description = "主键")
private Long userId;
/**
* 用户名
*/
@Schema(description = "用户名")
private String username;
/**
* 密码
*/
@JsonIgnore
private String password;
/**
* 随机盐
*/
@JsonIgnore
private String salt;
/**
* 微信openid
*/
@Schema(description = "微信open id")
private String wxOpenid;
/**
* QQ openid
*/
@Schema(description = "qq open id")
private String qqOpenid;
/**
* gitee openid
*/
@Schema(description = "gitee open id")
private String giteeOpenId;
/**
* 开源中国 openid
*/
@Schema(description = "开源中国 open id")
private String oscOpenId;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改时间
*/
@Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 0-正常,1-删除
*/
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
/**
* 锁定标记
*/
@Schema(description = "锁定标记,0:正常,9:已锁定")
private String lockFlag;
/**
* 手机号
*/
@Schema(description = "手机号")
private String phone;
/**
* 头像
*/
@Schema(description = "头像")
private String avatar;
/**
* 部门名称
*/
@Schema(description = "所属部门名称")
private SysDept dept;
/**
* 角色列表
*/
@Schema(description = "拥有的角色列表")
private List<SysRole> roleList;
/**
* 岗位列表
*/
private List<SysPost> postList;
/**
* 昵称
*/
@Schema(description = "昵称")
private String nickname;
/**
* 姓名
*/
@Schema(description = "姓名")
private String name;
/**
* 邮箱
*/
@Schema(description = "邮箱")
private String email;
}
com.pig4cloud.pig.admin.api.feign.RemoteClientDetailsService
com.pig4cloud.pig.admin.api.feign.RemoteDictService
com.pig4cloud.pig.admin.api.feign.RemoteLogService
com.pig4cloud.pig.admin.api.feign.RemoteParamService
com.pig4cloud.pig.admin.api.feign.RemoteTokenService
com.pig4cloud.pig.admin.api.feign.RemoteUserService
FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis
WORKDIR /pig-upms-biz
ARG JAR_FILE=target/pig-upms-biz.jar
COPY ${JAR_FILE} app.jar
EXPOSE 4000
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
CMD sleep 60; java $JAVA_OPTS -jar app.jar
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>${revision}</version>
</parent>
<artifactId>pig-upms-biz</artifactId>
<packaging>jar</packaging>
<description>pig 通用用户权限管理系统业务处理模块</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-ai.version>1.1.0-SNAPSHOT</spring-ai.version>
</properties>
<dependencies>
<!--upms api、model 模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
</dependency>
<!--文件管理-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-oss</artifactId>
</dependency>
<!--feign 调用-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-feign</artifactId>
</dependency>
<!--安全模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
</dependency>
<!--日志处理-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-log</artifactId>
</dependency>
<!--接口文档-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-swagger</artifactId>
</dependency>
<!-- orm 模块-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
</dependency>
<!-- PostgreSQL驱动 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!--注册中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!--配置中心客户端-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- 短信下发 -->
<dependency>
<groupId>org.dromara.sms4j</groupId>
<artifactId>sms4j-spring-boot-starter</artifactId>
</dependency>
<!--xss 过滤-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-xss</artifactId>
</dependency>
<!--undertow容器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>boot</id>
</profile>
<profile>
<id>cloud</id>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.xlsx</exclude>
<exclude>**/*.xls</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.xlsx</include>
<include>**/*.xls</include>
</includes>
</resource>
</resources>
</build>
</project>
/*
*
* 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.admin;
import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients;
import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer;
import com.pig4cloud.pig.common.swagger.annotation.EnablePigDoc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* 用户统一管理系统
*
* @author lengleng
* @date 2025/05/30
*/
@EnablePigDoc(value = "admin")
@EnablePigFeignClients
@EnablePigResourceServer
@EnableDiscoveryClient
@SpringBootApplication
public class PigAdminApplication {
public static void main(String[] args) {
SpringApplication.run(PigAdminApplication.class, args);
}
}
/*
*
* 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.admin.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.annotation.HasPermission;
import com.pig4cloud.pig.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 客户端管理模块前端控制器
*
* @author lengleng
* @date 2025/05/30
* @since 2018-05-15
*/
@RestController
@AllArgsConstructor
@RequestMapping("/client")
@Tag(description = "client", name = "客户端管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysClientController {
private final SysOauthClientDetailsService clientDetailsService;
/**
* 通过客户端ID查询客户端详情
* @param clientId 客户端ID
* @return 包含客户端详情的响应对象
*/
@GetMapping("/{clientId}")
public R getByClientId(@PathVariable String clientId) {
SysOauthClientDetails details = clientDetailsService
.getOne(Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId));
return R.ok(details);
}
/**
* 分页查询系统终端信息
* @param page 分页参数对象
* @param sysOauthClientDetails 系统终端查询条件
* @return 分页查询结果
*/
@GetMapping("/page")
public R getClientPage(@ParameterObject Page page, @ParameterObject SysOauthClientDetails sysOauthClientDetails) {
LambdaQueryWrapper<SysOauthClientDetails> wrapper = Wrappers.<SysOauthClientDetails>lambdaQuery()
.like(StrUtil.isNotBlank(sysOauthClientDetails.getClientId()), SysOauthClientDetails::getClientId,
sysOauthClientDetails.getClientId())
.like(StrUtil.isNotBlank(sysOauthClientDetails.getClientSecret()), SysOauthClientDetails::getClientSecret,
sysOauthClientDetails.getClientSecret());
return R.ok(clientDetailsService.page(page, wrapper));
}
/**
* 添加客户端终端
* @param clientDetails 客户端详情实体
* @return 操作结果,成功返回success,失败返回false
*/
@SysLog("添加终端")
@PostMapping
@HasPermission("sys_client_add")
public R saveClient(@Valid @RequestBody SysOauthClientDetails clientDetails) {
return R.ok(clientDetailsService.saveClient(clientDetails));
}
/**
* 根据ID列表批量删除终端
* @param ids 要删除的终端ID数组
* @return 操作结果,成功返回success
*/
@SysLog("删除终端")
@DeleteMapping
@HasPermission("sys_client_del")
public R removeById(@RequestBody Long[] ids) {
clientDetailsService.removeBatchByIds(CollUtil.toList(ids));
return R.ok();
}
/**
* 编辑终端信息
* @param clientDetails 终端实体信息
* @return 操作结果
*/
@SysLog("编辑终端")
@PutMapping
@HasPermission("sys_client_edit")
public R updateClient(@Valid @RequestBody SysOauthClientDetails clientDetails) {
return R.ok(clientDetailsService.updateClientById(clientDetails));
}
/**
* 根据客户端ID获取客户端详情
* @param clientId 客户端ID
* @return 包含客户端详情的响应结果
*/
@Inner
@GetMapping("/getClientDetailsById/{clientId}")
public R getClientDetailsById(@PathVariable String clientId) {
return R.ok(clientDetailsService.getOne(
Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false));
}
/**
* 同步缓存字典
* @return 操作结果
*/
@SysLog("同步终端")
@PutMapping("/sync")
public R syncClient() {
return clientDetailsService.syncClientCache();
}
/**
* 导出客户端信息到Excel
* @param sysOauthClientDetails 客户端查询条件
* @return 符合条件的客户端列表
*/
@ResponseExcel
@SysLog("导出excel")
@GetMapping("/export")
public List<SysOauthClientDetails> exportClients(SysOauthClientDetails sysOauthClientDetails) {
return clientDetailsService.list(Wrappers.query(sysOauthClientDetails));
}
}
/*
*
* 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.admin.controller;
import com.pig4cloud.pig.admin.api.entity.SysDept;
import com.pig4cloud.pig.admin.api.vo.DeptExcelVo;
import com.pig4cloud.pig.admin.service.SysDeptService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.annotation.HasPermission;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* 部门管理前端控制器
*
* @author lengleng
* @date 2025/05/30
* @since 2018-01-20
*/
@RestController
@AllArgsConstructor
@RequestMapping("/dept")
@Tag(description = "dept", name = "部门管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysDeptController {
private final SysDeptService sysDeptService;
/**
* 通过ID查询部门信息
* @param id 部门ID
* @return 包含部门信息的响应对象
*/
@GetMapping("/{id}")
public R getById(@PathVariable Long id) {
return R.ok(sysDeptService.getById(id));
}
/**
* 查询全部部门列表
* @return 包含全部部门列表的响应结果
*/
@GetMapping("/list")
public R listDepts() {
return R.ok(sysDeptService.list());
}
/**
* 获取树形菜单
* @param deptName 部门名称
* @return 包含树形菜单的响应结果
*/
@GetMapping(value = "/tree")
public R getDeptTree(String deptName) {
return R.ok(sysDeptService.getDeptTree(deptName));
}
/**
* 保存部门信息
* @param sysDept 部门实体
* @return 操作结果
*/
@SysLog("添加部门")
@PostMapping
@HasPermission("sys_dept_add")
public R saveDept(@Valid @RequestBody SysDept sysDept) {
return R.ok(sysDeptService.save(sysDept));
}
/**
* 根据ID删除部门
* @param id 部门ID
* @return 操作结果,成功返回true,失败返回false
*/
@SysLog("删除部门")
@DeleteMapping("/{id}")
@HasPermission("sys_dept_del")
public R removeById(@PathVariable Long id) {
return R.ok(sysDeptService.removeDeptById(id));
}
/**
* 编辑部门信息
* @param sysDept 部门实体对象
* @return 操作结果,成功返回success,失败返回false
*/
@SysLog("编辑部门")
@PutMapping
@HasPermission("sys_dept_edit")
public R updateDept(@Valid @RequestBody SysDept sysDept) {
sysDept.setUpdateTime(LocalDateTime.now());
return R.ok(sysDeptService.updateById(sysDept));
}
/**
* 获取部门子级列表
* @param deptId 部门ID
* @return 包含子级部门列表的响应结果
*/
@GetMapping(value = "/getDescendantList/{deptId}")
public R getDescendantList(@PathVariable Long deptId) {
return R.ok(sysDeptService.listDescendants(deptId));
}
/**
* 导出部门数据
* @return 部门数据列表
*/
@ResponseExcel
@GetMapping("/export")
public List<DeptExcelVo> exportDepts() {
return sysDeptService.exportDepts();
}
/**
* 导入部门信息
* @param excelVOList 部门Excel数据列表
* @param bindingResult 数据校验结果
* @return 导入结果
*/
@PostMapping("import")
public R importDept(@RequestExcel List<DeptExcelVo> excelVOList, BindingResult bindingResult) {
return sysDeptService.importDept(excelVOList, bindingResult);
}
}
/*
*
* 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.admin.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysDict;
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
import com.pig4cloud.pig.admin.service.SysDictItemService;
import com.pig4cloud.pig.admin.service.SysDictService;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 字典表前端控制器
*
* @author lengleng
* @date 2025/05/30
* @since 2019-03-19
*/
@RestController
@AllArgsConstructor
@RequestMapping("/dict")
@Tag(description = "dict", name = "字典管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysDictController {
private final SysDictService sysDictService;
private final SysDictItemService sysDictItemService;
/**
* 通过ID查询字典信息
* @param id 字典ID
* @return 包含字典信息的响应对象
*/
@GetMapping("/details/{id}")
public R getById(@PathVariable Long id) {
return R.ok(sysDictService.getById(id));
}
/**
* 查询字典详细信息
* @param query 字典查询条件对象
* @return 包含字典信息的响应结果
*/
@GetMapping("/details")
public R getDetails(@ParameterObject SysDict query) {
return R.ok(sysDictService.getOne(Wrappers.query(query), false));
}
/**
* 分页查询字典信息
* @param page 分页对象
* @param sysDict 字典查询条件
* @return 包含分页结果的响应对象
*/
@GetMapping("/page")
public R<IPage> getDictPage(@ParameterObject Page page, @ParameterObject SysDict sysDict) {
return R.ok(sysDictService.page(page,
Wrappers.<SysDict>lambdaQuery()
.eq(StrUtil.isNotBlank(sysDict.getSystemFlag()), SysDict::getSystemFlag, sysDict.getSystemFlag())
.like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType())));
}
/**
* 保存字典信息
* @param sysDict 字典信息对象
* @return 操作结果,包含保存的字典信息
*/
@SysLog("添加字典")
@PostMapping
@PreAuthorize("@pms.hasPermission('sys_dict_add')")
public R saveDict(@Valid @RequestBody SysDict sysDict) {
sysDictService.save(sysDict);
return R.ok(sysDict);
}
/**
* 删除字典并清除字典缓存
* @param ids 字典ID数组
* @return 操作结果
*/
@SysLog("删除字典")
@DeleteMapping
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
public R removeById(@RequestBody Long[] ids) {
return R.ok(sysDictService.removeDictByIds(ids));
}
/**
* 修改字典信息
* @param sysDict 字典信息
* @return 操作结果 success/false
*/
@PutMapping
@SysLog("修改字典")
@PreAuthorize("@pms.hasPermission('sys_dict_edit')")
public R updateDict(@Valid @RequestBody SysDict sysDict) {
return sysDictService.updateDict(sysDict);
}
/**
* 分页查询字典列表
* @param name 字典类型名称或描述
* @return 包含字典列表的响应结果
*/
@GetMapping("/list")
public R listDicts(String name) {
return R.ok(sysDictService.list(Wrappers.<SysDict>lambdaQuery()
.like(StrUtil.isNotBlank(name), SysDict::getDictType, name)
.or()
.like(StrUtil.isNotBlank(name), SysDict::getDescription, name)));
}
/**
* 分页查询字典项
* @param page 分页对象
* @param sysDictItem 字典项查询条件
* @return 分页查询结果
*/
@GetMapping("/item/page")
public R getDictItemPage(Page page, SysDictItem sysDictItem) {
return R.ok(sysDictItemService.page(page, Wrappers.query(sysDictItem)));
}
/**
* 通过id查询字典项详情
* @param id 字典项id
* @return 包含字典项详情的响应结果
*/
@GetMapping("/item/details/{id}")
public R getDictItemById(@PathVariable("id") Long id) {
return R.ok(sysDictItemService.getById(id));
}
/**
* 获取字典项详情
* @param query 字典项查询条件
* @return 包含字典项详情的响应结果
*/
@GetMapping("/item/details")
public R getDictItemDetails(SysDictItem query) {
return R.ok(sysDictItemService.getOne(Wrappers.query(query), false));
}
/**
* 新增字典项
* @param sysDictItem 字典项对象
* @return 操作结果
*/
@SysLog("新增字典项")
@PostMapping("/item")
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
public R saveDictItem(@RequestBody SysDictItem sysDictItem) {
return R.ok(sysDictItemService.save(sysDictItem));
}
/**
* 修改字典项
* @param sysDictItem 要修改的字典项对象
* @return 操作结果
*/
@SysLog("修改字典项")
@PutMapping("/item")
public R updateDictItem(@RequestBody SysDictItem sysDictItem) {
return sysDictItemService.updateDictItem(sysDictItem);
}
/**
* 通过id删除字典项
* @param id 字典项id
* @return 操作结果
*/
@SysLog("删除字典项")
@DeleteMapping("/item/{id}")
public R removeDictItemById(@PathVariable Long id) {
return sysDictItemService.removeDictItem(id);
}
/**
* 同步字典缓存
* @return 操作结果
*/
@SysLog("同步字典")
@PutMapping("/sync")
public R syncDict() {
return sysDictService.syncDictCache();
}
/**
* 导出字典项数据
* @param sysDictItem 字典项查询条件
* @return 符合条件的字典项列表
*/
@ResponseExcel
@GetMapping("/export")
public List<SysDictItem> exportDictItems(SysDictItem sysDictItem) {
return sysDictItemService.list(Wrappers.query(sysDictItem));
}
/**
* 通过字典类型查找字典
* @param type 类型
* @return 同类型字典
*/
@GetMapping("/type/{type}")
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
public R<List<SysDictItem>> getDictByType(@PathVariable String type) {
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictType, type)));
}
/**
* 通过字典类型查找字典 (针对feign调用) TODO: 兼容性方案,代码重复
* @param type 类型
* @return 同类型字典
*/
@Inner
@GetMapping("/remote/type/{type}")
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
public R<List<SysDictItem>> getRemoteDictByType(@PathVariable String type) {
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictType, type)));
}
}
/*
* 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.admin.controller;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysFile;
import com.pig4cloud.pig.admin.service.SysFileService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.annotation.HasPermission;
import com.pig4cloud.pig.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* 文件管理控制器
*
* @author lengleng
* @date 2025/05/30
*/
@RestController
@AllArgsConstructor
@RequestMapping("/sys-file")
@Tag(description = "sys-file", name = "文件管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysFileController {
private final SysFileService sysFileService;
/**
* 分页查询文件信息
* @param page 分页参数对象
* @param sysFile 文件查询条件对象
* @return 分页查询结果
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
public R getFilePage(@ParameterObject Page page, @ParameterObject SysFile sysFile) {
LambdaQueryWrapper<SysFile> wrapper = Wrappers.<SysFile>lambdaQuery()
.like(StrUtil.isNotBlank(sysFile.getOriginal()), SysFile::getOriginal, sysFile.getOriginal());
return R.ok(sysFileService.page(page, wrapper));
}
/**
* 通过id删除文件管理
* @param ids 要删除的文件id数组
* @return 操作结果
*/
@Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理")
@SysLog("删除文件管理")
@DeleteMapping
@HasPermission("sys_file_del")
public R removeById(@RequestBody Long[] ids) {
for (Long id : ids) {
sysFileService.removeFile(id);
}
return R.ok();
}
/**
* 上传文件
* @param file 上传的文件资源
* @return 包含文件路径的R对象,格式为(/admin/bucketName/filename)
*/
@PostMapping(value = "/upload")
public R upload(@RequestPart("file") MultipartFile file) {
return sysFileService.uploadFile(file);
}
/**
* 获取文件并写入响应流
* @param bucket 桶名称
* @param fileName 文件路径/名称
* @param response HTTP响应对象
*/
@Inner(false)
@GetMapping("/{bucket}/{fileName}")
public void file(@PathVariable String bucket, @PathVariable String fileName, HttpServletResponse response) {
sysFileService.getFile(bucket, fileName, response);
}
/**
* 获取本地resources目录下的文件并写入响应流
* @param fileName 文件名称
* @param response HTTP响应对象,用于输出文件内容
* @throws IOException 文件操作异常
*/
@SneakyThrows
@GetMapping("/local/file/{fileName}")
public void localFile(@PathVariable String fileName, HttpServletResponse response) {
ClassPathResource resource = new ClassPathResource("file/" + fileName);
response.setContentType("application/octet-stream; charset=UTF-8");
IoUtil.copy(resource.getInputStream(), response.getOutputStream());
}
}
/*
*
* 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.admin.controller;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
import com.pig4cloud.pig.admin.api.entity.SysLog;
import com.pig4cloud.pig.admin.service.SysLogService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.annotation.HasPermission;
import com.pig4cloud.pig.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 系统日志前端控制器
*
* @author lengleng
* @since 2017-11-20
*/
@RestController
@AllArgsConstructor
@RequestMapping("/log")
@Tag(description = "log", name = "日志管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysLogController {
private final SysLogService sysLogService;
/**
* 分页查询系统日志
* @param page 分页参数对象
* @param sysLog 系统日志查询条件
* @return 包含分页结果的响应对象
*/
@GetMapping("/page")
public R getLogPage(@ParameterObject Page page, @ParameterObject SysLogDTO sysLog) {
return R.ok(sysLogService.getLogPage(page, sysLog));
}
/**
* 批量删除日志
* @param ids 要删除的日志ID数组
* @return 操作结果,成功返回success,失败返回false
*/
@DeleteMapping
@HasPermission("sys_log_del")
public R removeByIds(@RequestBody Long[] ids) {
return R.ok(sysLogService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 保存日志
* @param sysLog 日志实体
* @return 操作结果,成功返回success,失败返回false
*/
@Inner
@PostMapping("/save")
public R saveLog(@Valid @RequestBody SysLog sysLog) {
return R.ok(sysLogService.saveLog(sysLog));
}
/**
* 导出系统日志到Excel表格
* @param sysLog 系统日志查询条件DTO
* @return 符合查询条件的系统日志列表
*/
@ResponseExcel
@GetMapping("/export")
@HasPermission("sys_log_export")
public List<SysLog> exportLogs(SysLogDTO sysLog) {
return sysLogService.listLogs(sysLog);
}
}
/*
* 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.admin.controller;
import com.pig4cloud.pig.admin.service.SysMobileService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 手机管理模块控制器:提供手机验证码相关服务
*
* @author lengleng
* @date 2018/11/14
*/
@RestController
@AllArgsConstructor
@RequestMapping("/mobile")
@Tag(description = "mobile", name = "手机管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysMobileController {
private final SysMobileService mobileService;
/**
* 发送短信验证码
* @param mobile 手机号码
* @return 操作结果
*/
@Inner(value = false)
@GetMapping("/{mobile}")
public R sendSmsCode(@PathVariable String mobile) {
return mobileService.sendSmsCode(mobile);
}
}
package com.pig4cloud.pig.admin.controller;
import com.pig4cloud.pig.admin.api.dto.RegisterUserDTO;
import com.pig4cloud.pig.admin.service.SysUserService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户注册控制器:提供用户注册功能
*
* @author lengleng
* @date 2025/05/30
* @see RegisterUserDTO 注册用户信息传输对象
* @see R 通用返回结果封装
*/
@RestController
@RequestMapping("/register")
@RequiredArgsConstructor
@Tag(description = "register", name = "注册用户管理模块")
@ConditionalOnProperty(name = "register.user", matchIfMissing = true)
public class SysRegisterController {
private final SysUserService userService;
/**
* 注册用户
* @param registerUserDTO 注册用户信息DTO
* @return 注册结果封装对象
*/
@Inner(value = false)
@SysLog("注册用户")
@PostMapping("/user")
public R<Boolean> registerUser(@RequestBody RegisterUserDTO registerUserDTO) {
return userService.registerUser(registerUserDTO);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment