!71 基于 Maven Module 的方式拆分多模块

Merge pull request !71 from 芋道源码/feature/multi-module
This commit is contained in:
芋道源码 2022-02-04 14:57:35 +00:00 committed by Gitee
commit bb02c8eccc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2493 changed files with 53679 additions and 18216 deletions

View File

@ -87,6 +87,11 @@ ps核心功能已经实现正在对接微信小程序中...
* 2022 Q2 => 完成对 <https://github.com/YunaiV/onemall> 的迁移,作为 onemall 的 Spring Boot 单体版本。
* 2022 Q4 => 完成对 <https://github.com/YunaiV/onemall>> 的重构,作为 onemall 的 Spring Cloud 微服务版本。
### 会员中心
正在开发中,大体计划如下:
* 2021 Q1 =》完成对 <https://github.com/YunaiV/onemall> 的迁移
### 基础设施
| | 功能 | 描述 |
@ -118,43 +123,45 @@ ps核心功能已经实现正在对接微信小程序中...
## 技术栈
| 项目 | 说明 |
| --- | --- |
| `yudao-dependencies` | Maven 依赖版本管理 |
| `yudao-framework` | Java 框架拓展 |
| `yudao-admin-server` | 管理后台的服务端 |
| `yudao-admin-ui` | 管理后台的 UI 界面 |
| `yudao-user-server` | 用户前台的服务端 |
| `yudao-user-ui` | 用户前台的 UI 界面 |
| `yudao-core-service` | 公共服务,提供共享逻辑 |
> 友情提示:`yudao-admin-server` 和 `yudao-user-server` 会存在需要复用的逻辑,通过 `yudao-core-service` 实现。
| 项目 | 说明 |
|-----------------------|--------------------|
| `yudao-dependencies` | Maven 依赖版本管理 |
| `yudao-framework` | Java 框架拓展 |
| `yudao-server` | 管理后台 + 用户 APP 的服务端 |
| `yudao-admin-ui` | 管理后台的 UI 界面 |
| `yudao-user-ui` | 用户 APP 的 UI 界面 |
| `yudao-module-system` | 系统功能的 Module 模块 |
| `yudao-module-member` | 会员中心的 Module 模块 |
| `yudao-module-infra` | 基础设施的 Module 模块 |
| `yudao-module-tool` | 研发工具的 Module 模块 |
| `yudao-module-bpm` | 工作流程的 Module 模块 |
| `yudao-module-pay` | 支付系统的 Module 模块 |
### 后端
| 框架 | 说明 | 版本 | 学习指南 |
| --- | --- | --- | --- |
| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.4.12 | [文档](https://github.com/YunaiV/SpringBoot-Labs) |
| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 | |
| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.4.3.4 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) |
| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [Redis](https://redis.io/) | key-value 数据库 | 5.0 | |
| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.16.6 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) |
| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.13 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) |
| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.4.9 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) |
| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.1.7 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) |
| 框架 | 说明 | 版本 | 学习指南 |
| --- | --- |----------| --- |
| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.5.9 | [文档](https://github.com/YunaiV/SpringBoot-Labs) |
| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 | |
| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.4.3.4 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) |
| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
| [Redis](https://redis.io/) | key-value 数据库 | 5.0 | |
| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.16.8 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) |
| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.15 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) |
| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.5.4 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) |
| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.0 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) |
| [Activiti](https://github.com/Activiti/Activiti) | 工作流引擎 | 7.1.0.M6 | [文档](TODO) |
| [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) |
| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.2 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) |
| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.0 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) |
| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) |
| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.4.2 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) |
| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.11.4 | |
| [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) |
| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) |
| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.7.1 | - |
| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 3.6.28 | - |
| [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) |
| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.2 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) |
| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.0 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) |
| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) |
| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.4.2 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) |
| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.12.6 | |
| [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) |
| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) |
| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.7.2 | - |
| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 3.9.0 | - |
### 前端

View File

@ -1,7 +1,11 @@
{
"local": {
"baseUrl": "http://127.0.0.1:48080/api",
"userServerUrl": "http://127.0.0.1:28080/api",
"token": "test1"
"baseUrl": "http://127.0.0.1:48080/admin-api",
"token": "test1",
"adminTenentId": "1",
"appApi": "http://127.0.0.1:48080/app-api",
"appToken": "test1",
"appTenentId": "1"
}
}

BIN
img.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 KiB

38
pom.xml
View File

@ -10,9 +10,15 @@
<modules>
<module>yudao-dependencies</module>
<module>yudao-framework</module>
<module>yudao-admin-server</module>
<module>yudao-user-server</module>
<module>yudao-core-service</module>
<!-- Server 主项目 -->
<module>yudao-server</module>
<!-- 各种 module 拓展 -->
<module>yudao-module-member</module>
<module>yudao-module-bpm</module>
<module>yudao-module-system</module>
<module>yudao-module-infra</module>
<module>yudao-module-tool</module>
<module>yudao-module-pay</module>
</modules>
<name>${artifactId}</name>
@ -20,12 +26,16 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties>
<revision>1.3.0-snapshot</revision>
<revision>1.4.0-snapshot</revision>
<!-- Maven 相关 -->
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<!-- 看看咋放到 bom 里 -->
<lombok.version>1.18.20</lombok.version>
<mapstruct.version>1.4.1.Final</mapstruct.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -51,6 +61,26 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<!-- maven-compiler-plugin 插件,解决 Lombok + MapStruct 组合 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

File diff suppressed because one or more lines are too long

View File

@ -1,168 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-admin-server</artifactId>
<packaging>jar</packaging>
<name>yudao-admin-server</name>
<description>管理后台 Server提供其 API 接口</description>
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<dependencies>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-core-service</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-dict</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-sms</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-activiti</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<!-- spring boot 配置所需依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<!-- Config 配置中心相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-config</artifactId>
</dependency>
<!-- Job 定时任务相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-job</artifactId>
</dependency>
<!-- 消息队列相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mq</artifactId>
</dependency>
<!-- 服务保障相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-protection</artifactId>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId> <!-- 实现 Spring Boot Admin Server 服务端 -->
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 -->
</dependency>
<!-- 三方云服务相关 -->
<dependency>
<groupId>com.xkcoding.justauth</groupId>
<artifactId>justauth-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>${artifactId}</finalName>
<plugins>
<!-- 打包 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,41 +0,0 @@
package cn.iocoder.yudao.adminserver.framework.security;
import cn.iocoder.yudao.framework.web.config.WebProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import javax.annotation.Resource;
@Configuration
public class SecurityConfiguration {
@Resource
private WebProperties webProperties;
@Value("${spring.boot.admin.context-path:''}")
private String adminSeverContextPath;
@Bean
public Customizer<ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry> authorizeRequestsCustomizer() {
return registry -> {
// 验证码的接口
registry.antMatchers(api("/system/captcha/**")).anonymous();
// 获得租户编号的接口
registry.antMatchers(api("/system/tenant/get-id-by-name")).anonymous();
// Spring Boot Admin Server 的安全配置
registry.antMatchers(adminSeverContextPath).anonymous()
.antMatchers(adminSeverContextPath + "/**").anonymous();
// 短信回调 API
registry.antMatchers(api("/system/sms/callback/**")).anonymous();
};
}
private String api(String url) {
return webProperties.getApiPrefix() + url;
}
}

View File

@ -1,57 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.bpm.convert.message;
import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import org.activiti.api.task.model.Task;
import org.activiti.engine.runtime.ProcessInstance;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface BpmMessageConvert {
BpmMessageConvert INSTANCE = Mappers.getMapper(BpmMessageConvert.class);
default BpmMessageSendWhenTaskCreatedReqDTO convert(ProcessInstance processInstance, SysUserDO startUser, Task task) {
BpmMessageSendWhenTaskCreatedReqDTO reqDTO = new BpmMessageSendWhenTaskCreatedReqDTO();
copyTo(processInstance, reqDTO);
copyTo(startUser, reqDTO);
copyTo(task, reqDTO);
return reqDTO;
}
@Mapping(source = "name", target = "processInstanceName")
void copyTo(ProcessInstance from, @MappingTarget BpmMessageSendWhenTaskCreatedReqDTO to);
@Mappings({
@Mapping(source = "id", target = "startUserId"),
@Mapping(source = "nickname", target = "startUserNickname")
})
void copyTo(SysUserDO from, @MappingTarget BpmMessageSendWhenTaskCreatedReqDTO to);
@Mappings({
@Mapping(source = "id", target = "taskId"),
@Mapping(source = "name", target = "taskName"),
@Mapping(source = "assignee", target = "assigneeUserId")
})
void copyTo(Task task, @MappingTarget BpmMessageSendWhenTaskCreatedReqDTO to);
default BpmMessageSendWhenProcessInstanceRejectReqDTO convert(ProcessInstance processInstance, String comment) {
BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO = new BpmMessageSendWhenProcessInstanceRejectReqDTO();
copyTo(processInstance, reqDTO);
reqDTO.setComment(comment);
return reqDTO;
}
@Mapping(source = "name", target = "processInstanceName")
void copyTo(ProcessInstance from, @MappingTarget BpmMessageSendWhenProcessInstanceRejectReqDTO to);
@Mappings({
@Mapping(source = "id", target = "processInstanceId"),
@Mapping(source = "name", target = "processInstanceName"),
@Mapping(source = "initiator", target = "startUserId")
})
BpmMessageSendWhenProcessInstanceApproveReqDTO convert(org.activiti.api.process.model.ProcessInstance processInstance);
}

View File

@ -1,7 +0,0 @@
/**
* 自定义各种 Activiti 的监听器实现流程示例流程任务的拓展表信息的同步
* 例如说{@link org.activiti.api.task.model.Task} 新建时我们也要新建对应的 {@link cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmTaskExtDO} 记录
*
* @author 芋道源码
*/
package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.listener;

View File

@ -1,20 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的")
@Data
public class InfJobExportReqVO {
@ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配")
private String name;
@ApiModelProperty(value = "任务状态", example = "1", notes = "参见 InfJobStatusEnum 枚举")
private Integer status;
@ApiModelProperty(value = "处理器的名字", example = "sysUserSessionTimeoutJob", notes = "模糊匹配")
private String handlerName;
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.config;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigExcelVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigRespVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigUpdateReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface InfConfigConvert {
InfConfigConvert INSTANCE = Mappers.getMapper(InfConfigConvert.class);
PageResult<InfConfigRespVO> convertPage(PageResult<InfConfigDO> page);
InfConfigRespVO convert(InfConfigDO bean);
InfConfigDO convert(InfConfigCreateReqVO bean);
InfConfigDO convert(InfConfigUpdateReqVO bean);
List<InfConfigExcelVO> convertList(List<InfConfigDO> list);
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.file;
import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface InfFileConvert {
InfFileConvert INSTANCE = Mappers.getMapper(InfFileConvert.class);
InfFileRespVO convert(InfFileDO bean);
PageResult<InfFileRespVO> convertPage(PageResult<InfFileDO> page);
}

View File

@ -1,36 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.job;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobExcelVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobRespVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 定时任务 Convert
*
* @author 芋道源码
*/
@Mapper
public interface InfJobConvert {
InfJobConvert INSTANCE = Mappers.getMapper(InfJobConvert.class);
InfJobDO convert(InfJobCreateReqVO bean);
InfJobDO convert(InfJobUpdateReqVO bean);
InfJobRespVO convert(InfJobDO bean);
List<InfJobRespVO> convertList(List<InfJobDO> list);
PageResult<InfJobRespVO> convertPage(PageResult<InfJobDO> page);
List<InfJobExcelVO> convertList02(List<InfJobDO> list);
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.job;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.log.InfJobLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.log.InfJobLogRespVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobLogDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 定时任务日志 Convert
*
* @author 芋艿
*/
@Mapper
public interface InfJobLogConvert {
InfJobLogConvert INSTANCE = Mappers.getMapper(InfJobLogConvert.class);
InfJobLogRespVO convert(InfJobLogDO bean);
List<InfJobLogRespVO> convertList(List<InfJobLogDO> list);
PageResult<InfJobLogRespVO> convertPage(PageResult<InfJobLogDO> page);
List<InfJobLogExcelVO> convertList02(List<InfJobLogDO> list);
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.logger;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* API 访问日志 Convert
*
* @author 芋道源码
*/
@Mapper
public interface InfApiAccessLogConvert {
InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class);
InfApiAccessLogRespVO convert(InfApiAccessLogDO bean);
List<InfApiAccessLogRespVO> convertList(List<InfApiAccessLogDO> list);
PageResult<InfApiAccessLogRespVO> convertPage(PageResult<InfApiAccessLogDO> page);
List<InfApiAccessLogExcelVO> convertList02(List<InfApiAccessLogDO> list);
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.convert.logger;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* API 错误日志 Convert
*
* @author 芋道源码
*/
@Mapper
public interface InfApiErrorLogConvert {
InfApiErrorLogConvert INSTANCE = Mappers.getMapper(InfApiErrorLogConvert.class);
InfApiErrorLogRespVO convert(InfApiErrorLogDO bean);
PageResult<InfApiErrorLogRespVO> convertPage(PageResult<InfApiErrorLogDO> page);
List<InfApiErrorLogExcelVO> convertList02(List<InfApiErrorLogDO> list);
}

View File

@ -1,6 +0,0 @@
/**
* 提供 POJO 类的实体转换
*
* 目前使用 MapStruct 框架
*/
package cn.iocoder.yudao.adminserver.modules.infra.convert;

View File

@ -1,24 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file;
import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
/**
* admin 文件操作 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface InfFileMapper extends BaseMapperX<InfFileDO> {
default PageResult<InfFileDO> selectPage(InfFilePageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<InfFileDO>()
.likeIfPresent("id", reqVO.getId())
.likeIfPresent("type", reqVO.getType())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc("create_time"));
}
}

View File

@ -1,41 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.job;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.InfJobPageReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 定时任务 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface InfJobMapper extends BaseMapperX<InfJobDO> {
default InfJobDO selectByHandlerName(String handlerName) {
return selectOne(InfJobDO::getHandlerName, handlerName);
}
default PageResult<InfJobDO> selectPage(InfJobPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InfJobDO>()
.likeIfPresent(InfJobDO::getName, reqVO.getName())
.eqIfPresent(InfJobDO::getStatus, reqVO.getStatus())
.likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName())
);
}
default List<InfJobDO> selectList(InfJobExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<InfJobDO>()
.likeIfPresent(InfJobDO::getName, reqVO.getName())
.eqIfPresent(InfJobDO::getStatus, reqVO.getStatus())
.likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName())
);
}
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.enums;
/**
* Infra 字典类型的枚举类
*
* @author 芋道源码
*/
public interface InfDictTypeConstants {
String REDIS_TIMEOUT_TYPE = "inf_redis_timeout_type"; // Redis 超时类型
String JOB_STATUS = "inf_job_status"; // 定时任务状态的枚举
String JOB_LOG_STATUS = "inf_job_log_status"; // 定时任务日志状态的枚举
String API_ERROR_LOG_PROCESS_STATUS = "inf_api_error_log_process_status"; // API 错误日志的处理状态的枚举
String ERROR_CODE_TYPE = "inf_error_code_type"; // 错误码的类型枚举
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.enums.logger;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* API 异常数据的处理状态
*
* @author 芋道源码
*/
@AllArgsConstructor
@Getter
public enum InfApiErrorLogProcessStatusEnum {
INIT(0, "未处理"),
DONE(1, "已处理"),
IGNORE(2, "已忽略");
/**
* 状态
*/
private final Integer status;
/**
* 资源类型名
*/
private final String name;
}

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.mq.consumer;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.mq.message;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.mq.producer;

View File

@ -1,7 +0,0 @@
/**
* infra 包下我们放基础设施的运维与管理支撑上层的通用与核心业务
* 例如说定时任务的管理服务器的信息等等
*
* 缩写inf
*/
package cn.iocoder.yudao.adminserver.modules.infra;

View File

@ -1,132 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.config.impl;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigPageReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.InfConfigUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.convert.config.InfConfigConvert;
import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.config.InfConfigMapper;
import cn.iocoder.yudao.adminserver.modules.infra.enums.config.InfConfigTypeEnum;
import cn.iocoder.yudao.adminserver.modules.infra.mq.producer.config.InfConfigProducer;
import cn.iocoder.yudao.adminserver.modules.infra.service.config.InfConfigService;
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.*;
/**
* 参数配置 Service 实现类
*/
@Service
@Slf4j
@Validated
public class InfConfigServiceImpl implements InfConfigService {
@Resource
private InfConfigMapper configMapper;
@Resource
private InfConfigProducer configProducer;
@Override
public Long createConfig(InfConfigCreateReqVO reqVO) {
// 校验正确性
checkCreateOrUpdate(null, reqVO.getKey());
// 插入参数配置
InfConfigDO config = InfConfigConvert.INSTANCE.convert(reqVO);
config.setType(InfConfigTypeEnum.CUSTOM.getType());
configMapper.insert(config);
// 发送刷新消息
configProducer.sendConfigRefreshMessage();
return config.getId();
}
@Override
public void updateConfig(InfConfigUpdateReqVO reqVO) {
// 校验正确性
checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key
// 更新参数配置
InfConfigDO updateObj = InfConfigConvert.INSTANCE.convert(reqVO);
configMapper.updateById(updateObj);
// 发送刷新消息
configProducer.sendConfigRefreshMessage();
}
@Override
public void deleteConfig(Long id) {
// 校验配置存在
InfConfigDO config = checkConfigExists(id);
// 内置配置不允许删除
if (InfConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
throw ServiceExceptionUtil.exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
}
// 删除
configMapper.deleteById(id);
// 发送刷新消息
configProducer.sendConfigRefreshMessage();
}
@Override
public InfConfigDO getConfig(Long id) {
return configMapper.selectById(id);
}
@Override
public InfConfigDO getConfigByKey(String key) {
return configMapper.selectByKey(key);
}
@Override
public PageResult<InfConfigDO> getConfigPage(InfConfigPageReqVO reqVO) {
return configMapper.selectPage(reqVO);
}
@Override
public List<InfConfigDO> getConfigList(InfConfigExportReqVO reqVO) {
return configMapper.selectList(reqVO);
}
private void checkCreateOrUpdate(Long id, String key) {
// 校验自己存在
checkConfigExists(id);
// 校验参数配置 key 的唯一性
checkConfigKeyUnique(id, key);
}
@VisibleForTesting
public InfConfigDO checkConfigExists(Long id) {
if (id == null) {
return null;
}
InfConfigDO config = configMapper.selectById(id);
if (config == null) {
throw ServiceExceptionUtil.exception(CONFIG_NOT_EXISTS);
}
return config;
}
@VisibleForTesting
public void checkConfigKeyUnique(Long id, String key) {
InfConfigDO config = configMapper.selectByKey(key);
if (config == null) {
return;
}
// 如果 id 为空说明不用比较是否为相同 id 的参数配置
if (id == null) {
throw ServiceExceptionUtil.exception(CONFIG_KEY_DUPLICATE);
}
if (!config.getId().equals(id)) {
throw ServiceExceptionUtil.exception(CONFIG_KEY_DUPLICATE);
}
}
}

View File

@ -1,22 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.file;
import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 文件 Service 接口
*
* @author 芋道源码
*/
public interface InfFileService {
/**
* 获得文件分页
*
* @param pageReqVO 分页查询
* @return 文件分页
*/
PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO);
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.file.impl;
import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.file.InfFileMapper;
import cn.iocoder.yudao.adminserver.modules.infra.service.file.InfFileService;
import cn.iocoder.yudao.adminserver.modules.infra.controller.file.vo.InfFilePageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 文件 Service 实现类
*
* @author 芋道源码
*/
@Service
public class InfFileServiceImpl implements InfFileService {
@Resource
private InfFileMapper fileMapper;
@Override
public PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO) {
return fileMapper.selectPage(pageReqVO);
}
}

View File

@ -1,74 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.job.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.log.InfJobLogExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.log.InfJobLogPageReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.dataobject.job.InfJobLogDO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.job.InfJobLogMapper;
import cn.iocoder.yudao.adminserver.modules.infra.enums.job.InfJobLogStatusEnum;
import cn.iocoder.yudao.adminserver.modules.infra.service.job.InfJobLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* Job 日志 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
@Slf4j
public class InfJobLogServiceImpl implements InfJobLogService {
@Resource
private InfJobLogMapper jobLogMapper;
@Override
public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) {
InfJobLogDO log = InfJobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex)
.beginTime(beginTime).status(InfJobLogStatusEnum.RUNNING.getStatus()).build();
jobLogMapper.insert(log);
return log.getId();
}
@Override
@Async
public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) {
try {
InfJobLogDO updateObj = InfJobLogDO.builder().id(logId).endTime(endTime).duration(duration)
.status(success ? InfJobLogStatusEnum.SUCCESS.getStatus() : InfJobLogStatusEnum.FAILURE.getStatus()).result(result).build();
jobLogMapper.updateById(updateObj);
} catch (Exception ex) {
log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]",
logId, endTime, duration, success, result);
}
}
@Override
public InfJobLogDO getJobLog(Long id) {
return jobLogMapper.selectById(id);
}
@Override
public List<InfJobLogDO> getJobLogList(Collection<Long> ids) {
return jobLogMapper.selectBatchIds(ids);
}
@Override
public PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO) {
return jobLogMapper.selectPage(pageReqVO);
}
@Override
public List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO) {
return jobLogMapper.selectList(exportReqVO);
}
}

View File

@ -1,33 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.logger;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.List;
/**
* API 访问日志 Service 接口
*
* @author 芋道源码
*/
public interface InfApiAccessLogService {
/**
* 获得 API 访问日志分页
*
* @param pageReqVO 分页查询
* @return API 访问日志分页
*/
PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO);
/**
* 获得 API 访问日志列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return API 访问日志分页
*/
List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO);
}

View File

@ -1,37 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.logger.impl;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiAccessLogMapper;
import cn.iocoder.yudao.adminserver.modules.infra.service.logger.InfApiAccessLogService;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* API 访问日志 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class InfApiAccessLogServiceImpl implements InfApiAccessLogService {
@Resource
private InfApiAccessLogMapper apiAccessLogMapper;
@Override
public PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) {
return apiAccessLogMapper.selectPage(pageReqVO);
}
@Override
public List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) {
return apiAccessLogMapper.selectList(exportReqVO);
}
}

View File

@ -1,57 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.infra.service.logger.impl;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogExportReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierrorlog.InfApiErrorLogPageReqVO;
import cn.iocoder.yudao.adminserver.modules.infra.dal.mysql.logger.InfApiErrorLogMapper;
import cn.iocoder.yudao.adminserver.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
import cn.iocoder.yudao.adminserver.modules.infra.service.logger.InfApiErrorLogService;
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;
import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_PROCESSED;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* API 错误日志 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class InfApiErrorLogServiceImpl implements InfApiErrorLogService {
@Resource
private InfApiErrorLogMapper apiErrorLogMapper;
@Override
public PageResult<InfApiErrorLogDO> getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO) {
return apiErrorLogMapper.selectPage(pageReqVO);
}
@Override
public List<InfApiErrorLogDO> getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO) {
return apiErrorLogMapper.selectList(exportReqVO);
}
@Override
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
InfApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
if (errorLog == null) {
throw exception(API_ERROR_LOG_NOT_FOUND);
}
if (!InfApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
throw exception(API_ERROR_LOG_PROCESSED);
}
// 标记处理
apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus)
.processUserId(processUserId).processTime(new Date()).build());
}
}

View File

@ -1,16 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
/**
* 支付订单 Mapper
*
* @author aquan
*/
@Mapper
public interface PayOrderExtensionMapper extends BaseMapperX<PayOrderExtensionDO> {
}

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.enums;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.job;

View File

@ -1,7 +0,0 @@
/**
* pay 包下我们放支付业务提供业务的支付能力
* 例如说商户应用支付退款等等
*
* 缩写pay
*/
package cn.iocoder.yudao.adminserver.modules.pay;

View File

@ -1,161 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.channel.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.channel.vo.PayChannelUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.convert.channel.PayChannelConvert;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.channel.PayChannelMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.channel.PayChannelService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.CHANNEL_EXIST_SAME_CHANNEL_ERROR;
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.CHANNEL_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 支付渠道 Service 实现类
*
* @author aquan
*/
@Service
@Slf4j
@Validated
public class PayChannelServiceImpl implements PayChannelService {
@Resource
private PayChannelMapper channelMapper;
@Resource
private Validator validator;
@Override
public Long createChannel(PayChannelCreateReqVO reqVO) {
// 断言是否有重复的
PayChannelDO channelDO = this.getChannelByConditions(reqVO.getMerchantId(), reqVO.getAppId(), reqVO.getCode());
if (ObjectUtil.isNotNull(channelDO)) {
throw exception(CHANNEL_EXIST_SAME_CHANNEL_ERROR);
}
// 新增渠道
PayChannelDO channel = PayChannelConvert.INSTANCE.convert(reqVO);
settingConfigAndCheckParam(channel, reqVO.getConfig());
channelMapper.insert(channel);
return channel.getId();
}
@Override
public void updateChannel(PayChannelUpdateReqVO updateReqVO) {
// 校验存在
this.validateChannelExists(updateReqVO.getId());
// 更新
PayChannelDO channel = PayChannelConvert.INSTANCE.convert(updateReqVO);
settingConfigAndCheckParam(channel, updateReqVO.getConfig());
channelMapper.updateById(channel);
}
@Override
public void deleteChannel(Long id) {
// 校验存在
this.validateChannelExists(id);
// 删除
channelMapper.deleteById(id);
}
private void validateChannelExists(Long id) {
if (channelMapper.selectById(id) == null) {
throw exception(CHANNEL_NOT_EXISTS);
}
}
@Override
public PayChannelDO getChannel(Long id) {
return channelMapper.selectById(id);
}
@Override
public List<PayChannelDO> getChannelList(Collection<Long> ids) {
return channelMapper.selectBatchIds(ids);
}
@Override
public PageResult<PayChannelDO> getChannelPage(PayChannelPageReqVO pageReqVO) {
return channelMapper.selectPage(pageReqVO);
}
@Override
public List<PayChannelDO> getChannelList(PayChannelExportReqVO exportReqVO) {
return channelMapper.selectList(exportReqVO);
}
/**
* 根据支付应用ID集合获得支付渠道列表
*
* @param appIds 应用编号集合
* @return 支付渠道列表
*/
@Override
public List<PayChannelDO> getChannelListByAppIds(Collection<Long> appIds) {
return channelMapper.getChannelListByAppIds(appIds);
}
/**
* 根据条件获取通道数量
*
* @param merchantId 商户编号
* @param appid 应用编号
* @param code 通道编码
* @return 数量
*/
@Override
public Integer getChannelCountByConditions(Long merchantId, Long appid, String code) {
return this.channelMapper.selectCount(merchantId, appid, code);
}
/**
* 根据条件获取通道
*
* @param merchantId 商户编号
* @param appid 应用编号
* @param code 通道编码
* @return 数量
*/
@Override
public PayChannelDO getChannelByConditions(Long merchantId, Long appid, String code) {
return this.channelMapper.selectOne(merchantId, appid, code);
}
/**
* 设置渠道配置以及参数校验
*
* @param channel 渠道
* @param configStr 配置
*/
private void settingConfigAndCheckParam(PayChannelDO channel, String configStr) {
// 得到这个渠道是微信的还是支付宝的
Class<? extends PayClientConfig> payClass = PayChannelEnum.getByCode(channel.getCode()).getConfigClass();
if (ObjectUtil.isNull(payClass)) {
throw exception(CHANNEL_NOT_EXISTS);
}
PayClientConfig config = JSONUtil.toBean(configStr, payClass);
// 验证参数
config.validate(validator);
channel.setConfig(config);
}
}

View File

@ -1,41 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.List;
/**
* 退款订单 Service 接口
*
* @author aquan
*/
public interface PayRefundService {
/**
* 获得退款订单
*
* @param id 编号
* @return 退款订单
*/
PayRefundDO getRefund(Long id);
/**
* 获得退款订单分页
*
* @param pageReqVO 分页查询
* @return 退款订单分页
*/
PageResult<PayRefundDO> getRefundPage(PayRefundPageReqVO pageReqVO);
/**
* 获得退款订单列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 退款订单列表
*/
List<PayRefundDO> getRefundList(PayRefundExportReqVO exportReqVO);
}

View File

@ -1,54 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order.PayOrderPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 支付订单 Service 实现类
*
* @author aquan
*/
@Service
@Validated
public class PayOrderServiceImpl implements PayOrderService {
@Resource
private PayOrderMapper orderMapper;
@Override
public PayOrderDO getOrder(Long id) {
return orderMapper.selectById(id);
}
@Override
public PageResult<PayOrderDO> getOrderPage(PayOrderPageReqVO pageReqVO) {
return orderMapper.selectPage(pageReqVO);
}
@Override
public List<PayOrderDO> getOrderList(PayOrderExportReqVO exportReqVO) {
return orderMapper.selectList(exportReqVO);
}
/**
* 根据 ID 集合获取只包含商品名称的订单集合
*
* @param idList 订单 ID 集合
* @return 只包含商品名称的订单集合
*/
@Override
public List<PayOrderDO> getOrderSubjectList(Collection<Long> idList) {
return orderMapper.findByIdListQueryOrderSubject(idList);
}
}

View File

@ -1,42 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo.PayRefundPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayRefundMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayRefundService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayRefundDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* 退款订单 Service 实现类
*
* @author aquan
*/
@Service
@Validated
public class PayRefundServiceImpl implements PayRefundService {
@Resource
private PayRefundMapper refundMapper;
@Override
public PayRefundDO getRefund(Long id) {
return refundMapper.selectById(id);
}
@Override
public PageResult<PayRefundDO> getRefundPage(PayRefundPageReqVO pageReqVO) {
return refundMapper.selectPage(pageReqVO);
}
@Override
public List<PayRefundDO> getRefundList(PayRefundExportReqVO exportReqVO) {
return refundMapper.selectList(exportReqVO);
}
}

View File

@ -1,11 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("岗位创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysPostCreateReqVO extends SysPostBaseVO {
}

View File

@ -1,12 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("字典数据创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysDictDataCreateReqVO extends SysDictDataBaseVO {
}

View File

@ -1,14 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("错误码创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class SysErrorCodeCreateReqVO extends SysErrorCodeBaseVO {
}

View File

@ -1,11 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("通知公告创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysNoticeCreateReqVO extends SysNoticeBaseVO {
}

View File

@ -1,10 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu;
import io.swagger.annotations.ApiModel;
import lombok.*;
@ApiModel("菜单创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysMenuCreateReqVO extends SysMenuBaseVO {
}

View File

@ -1,12 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("角色创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysRoleCreateReqVO extends SysRoleBaseVO {
}

View File

@ -1,14 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("短信模板创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class SysSmsTemplateCreateReqVO extends SysSmsTemplateBaseVO {
}

View File

@ -1,14 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("租户创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class SysTenantCreateReqVO extends SysTenantBaseVO {
}

View File

@ -1,110 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.controller.user;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.convert.user.SysUserConvert;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO;
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService;
import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.adminserver.modules.system.enums.SysErrorCodeConstants.FILE_IS_EMPTY;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Api(tags = "用户个人中心")
@RestController
@RequestMapping("/system/user/profile")
@Validated
@Slf4j
public class SysUserProfileController {
@Resource
private SysUserService userService;
@Resource
private SysUserCoreService userCoreService;
@Resource
private SysDeptService deptService;
@Resource
private SysPostService postService;
@Resource
private SysPermissionService permissionService;
@Resource
private SysRoleService roleService;
@Resource
private SysSocialCoreService socialService;
@GetMapping("/get")
@ApiOperation("获得登录用户信息")
public CommonResult<SysUserProfileRespVO> profile() {
// 获得用户基本信息
SysUserDO user = userCoreService.getUser(getLoginUserId());
SysUserProfileRespVO resp = SysUserConvert.INSTANCE.convert03(user);
// 获得用户角色
List<SysRoleDO> userRoles = roleService.getRolesFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
resp.setRoles(SysUserConvert.INSTANCE.convertList(userRoles));
// 获得部门信息
if (user.getDeptId() != null) {
SysDeptDO dept = deptService.getDept(user.getDeptId());
resp.setDept(SysUserConvert.INSTANCE.convert02(dept));
}
// 获得岗位信息
if (CollUtil.isNotEmpty(user.getPostIds())) {
List<SysPostDO> posts = postService.getPosts(user.getPostIds());
resp.setPosts(SysUserConvert.INSTANCE.convertList02(posts));
}
// 获得社交用户信息
List<SysSocialUserDO> socialUsers = socialService.getSocialUserList(user.getId(), UserTypeEnum.ADMIN);
resp.setSocialUsers(SysUserConvert.INSTANCE.convertList03(socialUsers));
return success(resp);
}
@PutMapping("/update")
@ApiOperation("修改用户个人信息")
public CommonResult<Boolean> updateUserProfile(@Valid @RequestBody SysUserProfileUpdateReqVO reqVO) {
userService.updateUserProfile(getLoginUserId(), reqVO);
return success(true);
}
@PutMapping("/update-password")
@ApiOperation("修改用户个人密码")
public CommonResult<Boolean> updateUserProfilePassword(@Valid @RequestBody SysUserProfileUpdatePasswordReqVO reqVO) {
userService.updateUserPassword(getLoginUserId(), reqVO);
return success(true);
}
@PutMapping("/update-avatar")
@ApiOperation("上传用户个人头像")
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException {
if (file.isEmpty()) {
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
}
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
return success(avatar);
}
}

View File

@ -1,74 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.auth;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.auth.SysAuthMenuRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.auth.SysAuthPermissionInfoRespVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO;
import cn.iocoder.yudao.adminserver.modules.system.enums.permission.MenuIdEnum;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import org.slf4j.LoggerFactory;
import java.util.*;
@Mapper
public interface SysAuthConvert {
SysAuthConvert INSTANCE = Mappers.getMapper(SysAuthConvert.class);
@Mapping(source = "updateTime", target = "updateTime", ignore = true) // 字段相同但是含义不同忽略
LoginUser convert0(SysUserDO bean);
default LoginUser convert(SysUserDO bean) {
// 目的为了设置 UserTypeEnum.ADMIN.getValue()
return convert0(bean).setUserType(UserTypeEnum.ADMIN.getValue());
}
default SysAuthPermissionInfoRespVO convert(SysUserDO user, List<SysRoleDO> roleList, List<SysMenuDO> menuList) {
return SysAuthPermissionInfoRespVO.builder()
.user(SysAuthPermissionInfoRespVO.UserVO.builder().id(user.getId()).nickname(user.getNickname()).avatar(user.getAvatar()).build())
.roles(CollectionUtils.convertSet(roleList, SysRoleDO::getCode))
.permissions(CollectionUtils.convertSet(menuList, SysMenuDO::getPermission))
.build();
}
SysAuthMenuRespVO convertTreeNode(SysMenuDO menu);
/**
* 将菜单列表构建成菜单树
*
* @param menuList 菜单列表
* @return 菜单树
*/
default List<SysAuthMenuRespVO> buildMenuTree(List<SysMenuDO> menuList) {
// 排序保证菜单的有序性
menuList.sort(Comparator.comparing(SysMenuDO::getSort));
// 构建菜单树
// 使用 LinkedHashMap 的原因是为了排序 实际也可以用 Stream API 就是太丑了
Map<Long, SysAuthMenuRespVO> treeNodeMap = new LinkedHashMap<>();
menuList.forEach(menu -> treeNodeMap.put(menu.getId(), SysAuthConvert.INSTANCE.convertTreeNode(menu)));
// 处理父子关系
treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(MenuIdEnum.ROOT.getId())).forEach(childNode -> {
// 获得父节点
SysAuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId());
if (parentNode == null) {
LoggerFactory.getLogger(getClass()).error("[buildRouterTree][resource({}) 找不到父资源({})]",
childNode.getId(), childNode.getParentId());
return;
}
// 将自己添加到父节点中
if (parentNode.getChildren() == null) {
parentNode.setChildren(new ArrayList<>());
}
parentNode.getChildren().add(childNode);
});
// 获得到所有的根节点
return CollectionUtils.filterList(treeNodeMap.values(), node -> MenuIdEnum.ROOT.getId().equals(node.getParentId()));
}
}

View File

@ -1,15 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.auth;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageItemRespVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SysUserSessionConvert {
SysUserSessionConvert INSTANCE = Mappers.getMapper(SysUserSessionConvert.class);
SysUserSessionPageItemRespVO convert(SysUserSessionDO session);
}

View File

@ -1,18 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.common;
import cn.hutool.captcha.AbstractCaptcha;
import cn.hutool.captcha.ICaptcha;
import cn.iocoder.yudao.adminserver.modules.system.controller.common.vo.SysCaptchaImageRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SysCaptchaConvert {
SysCaptchaConvert INSTANCE = Mappers.getMapper(SysCaptchaConvert.class);
default SysCaptchaImageRespVO convert(String uuid, AbstractCaptcha captcha) {
return SysCaptchaImageRespVO.builder().uuid(uuid).img(captcha.getImageBase64()).build();
}
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.dept;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptSimpleRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysDeptConvert {
SysDeptConvert INSTANCE = Mappers.getMapper(SysDeptConvert.class);
List<SysDeptRespVO> convertList(List<SysDeptDO> list);
List<SysDeptSimpleRespVO> convertList02(List<SysDeptDO> list);
SysDeptRespVO convert(SysDeptDO bean);
SysDeptDO convert(SysDeptCreateReqVO bean);
SysDeptDO convert(SysDeptUpdateReqVO bean);
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.dept;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.*;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysPostConvert {
SysPostConvert INSTANCE = Mappers.getMapper(SysPostConvert.class);
List<SysPostSimpleRespVO> convertList02(List<SysPostDO> list);
PageResult<SysPostRespVO> convertPage(PageResult<SysPostDO> page);
SysPostRespVO convert(SysPostDO id);
SysPostDO convert(SysPostCreateReqVO bean);
SysPostDO convert(SysPostUpdateReqVO reqVO);
List<SysPostExcelVO> convertList03(List<SysPostDO> list);
}

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.dict;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.*;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.Collection;
import java.util.List;
@Mapper
public interface SysDictDataConvert {
SysDictDataConvert INSTANCE = Mappers.getMapper(SysDictDataConvert.class);
List<SysDictDataSimpleRespVO> convertList(List<SysDictDataDO> list);
SysDictDataRespVO convert(SysDictDataDO bean);
PageResult<SysDictDataRespVO> convertPage(PageResult<SysDictDataDO> page);
SysDictDataDO convert(SysDictDataUpdateReqVO bean);
SysDictDataDO convert(SysDictDataCreateReqVO bean);
List<SysDictDataExcelVO> convertList02(List<SysDictDataDO> bean);
DictDataRespDTO convert02(SysDictDataDO bean);
List<DictDataRespDTO> convertList03(Collection<SysDictDataDO> list);
}

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.dict;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.*;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dict.SysDictTypeDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysDictTypeConvert {
SysDictTypeConvert INSTANCE = Mappers.getMapper(SysDictTypeConvert.class);
PageResult<SysDictTypeRespVO> convertPage(PageResult<SysDictTypeDO> bean);
SysDictTypeRespVO convert(SysDictTypeDO bean);
SysDictTypeDO convert(SysDictTypeCreateReqVO bean);
SysDictTypeDO convert(SysDictTypeUpdateReqVO bean);
List<SysDictTypeSimpleRespVO> convertList(List<SysDictTypeDO> list);
List<SysDictTypeExcelVO> convertList02(List<SysDictTypeDO> list);
}

View File

@ -1,42 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.errorcode;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO;
import cn.iocoder.yudao.adminserver.modules.tool.framework.errorcode.core.dto.ErrorCodeRespDTO;
import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 错误码 Convert
*
* @author 芋道源码
*/
@Mapper
public interface SysErrorCodeConvert {
SysErrorCodeConvert INSTANCE = Mappers.getMapper(SysErrorCodeConvert.class);
SysErrorCodeDO convert(SysErrorCodeCreateReqVO bean);
SysErrorCodeDO convert(SysErrorCodeUpdateReqVO bean);
SysErrorCodeRespVO convert(SysErrorCodeDO bean);
List<SysErrorCodeRespVO> convertList(List<SysErrorCodeDO> list);
PageResult<SysErrorCodeRespVO> convertPage(PageResult<SysErrorCodeDO> page);
List<SysErrorCodeExcelVO> convertList02(List<SysErrorCodeDO> list);
SysErrorCodeDO convert(ErrorCodeAutoGenerateReqDTO bean);
List<ErrorCodeRespDTO> convertList03(List<SysErrorCodeDO> list);
}

View File

@ -1,21 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.logger;
import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.loginlog.SysLoginLogRespVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysLoginLogConvert {
SysLoginLogConvert INSTANCE = Mappers.getMapper(SysLoginLogConvert.class);
PageResult<SysLoginLogRespVO> convertPage(PageResult<SysLoginLogDO> page);
List<SysLoginLogExcelVO> convertList(List<SysLoginLogDO> list);
}

View File

@ -1,41 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.logger;
import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.logger.vo.operatelog.SysOperateLogRespVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.logger.SysOperateLogDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
@Mapper
public interface SysOperateLogConvert {
SysOperateLogConvert INSTANCE = Mappers.getMapper(SysOperateLogConvert.class);
SysOperateLogDO convert(OperateLogCreateReqDTO bean);
PageResult<SysOperateLogRespVO> convertPage(PageResult<SysOperateLogDO> page);
SysOperateLogRespVO convert(SysOperateLogDO bean);
default List<SysOperateLogExcelVO> convertList(List<SysOperateLogDO> list, Map<Long, SysUserDO> userMap) {
return list.stream().map(operateLog -> {
SysOperateLogExcelVO excelVO = convert02(operateLog);
MapUtils.findAndThen(userMap, operateLog.getId(), user -> excelVO.setUserNickname(user.getNickname()));
excelVO.setSuccessStr(SUCCESS.getCode().equals(operateLog.getResultCode()) ? "成功" : "失败");
return excelVO;
}).collect(Collectors.toList());
}
SysOperateLogExcelVO convert02(SysOperateLogDO bean);
}

View File

@ -1,24 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.notice;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticeUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.notice.SysNoticeDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SysNoticeConvert {
SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class);
PageResult<SysNoticeRespVO> convertPage(PageResult<SysNoticeDO> page);
SysNoticeRespVO convert(SysNoticeDO bean);
SysNoticeDO convert(SysNoticeUpdateReqVO bean);
SysNoticeDO convert(SysNoticeCreateReqVO bean);
}

View File

@ -1,6 +0,0 @@
/**
* 提供 POJO 类的实体转换
*
* 目前使用 MapStruct 框架
*/
package cn.iocoder.yudao.adminserver.modules.system.convert;

View File

@ -1,28 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.permission;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuSimpleRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysMenuConvert {
SysMenuConvert INSTANCE = Mappers.getMapper(SysMenuConvert.class);
List<SysMenuRespVO> convertList(List<SysMenuDO> list);
SysMenuDO convert(SysMenuCreateReqVO bean);
SysMenuDO convert(SysMenuUpdateReqVO bean);
SysMenuRespVO convert(SysMenuDO bean);
List<SysMenuSimpleRespVO> convertList02(List<SysMenuDO> list);
}

View File

@ -1,25 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.permission;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.*;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysRoleConvert {
SysRoleConvert INSTANCE = Mappers.getMapper(SysRoleConvert.class);
SysRoleDO convert(SysRoleUpdateReqVO bean);
SysRoleRespVO convert(SysRoleDO bean);
SysRoleDO convert(SysRoleCreateReqVO bean);
List<SysRoleSimpleRespVO> convertList02(List<SysRoleDO> list);
List<SysRoleExcelVO> convertList03(List<SysRoleDO> list);
}

View File

@ -1,39 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.sms;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelSimpleRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.channel.SysSmsChannelUpdateReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 短信渠道 Convert
*
* @author 芋道源码
*/
@Mapper
public interface SysSmsChannelConvert {
SysSmsChannelConvert INSTANCE = Mappers.getMapper(SysSmsChannelConvert.class);
SysSmsChannelDO convert(SysSmsChannelCreateReqVO bean);
SysSmsChannelDO convert(SysSmsChannelUpdateReqVO bean);
SysSmsChannelRespVO convert(SysSmsChannelDO bean);
List<SysSmsChannelRespVO> convertList(List<SysSmsChannelDO> list);
PageResult<SysSmsChannelRespVO> convertPage(PageResult<SysSmsChannelDO> page);
List<SmsChannelProperties> convertList02(List<SysSmsChannelDO> list);
List<SysSmsChannelSimpleRespVO> convertList03(List<SysSmsChannelDO> list);
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.sms;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.log.SysSmsLogRespVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 短信日志 Convert
*
* @author 芋道源码
*/
@Mapper
public interface SysSmsLogConvert {
SysSmsLogConvert INSTANCE = Mappers.getMapper(SysSmsLogConvert.class);
SysSmsLogRespVO convert(SysSmsLogDO bean);
List<SysSmsLogRespVO> convertList(List<SysSmsLogDO> list);
PageResult<SysSmsLogRespVO> convertPage(PageResult<SysSmsLogDO> page);
List<SysSmsLogExcelVO> convertList02(List<SysSmsLogDO> list);
}

View File

@ -1,31 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.sms;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateUpdateReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysSmsTemplateConvert {
SysSmsTemplateConvert INSTANCE = Mappers.getMapper(SysSmsTemplateConvert.class);
SysSmsTemplateDO convert(SysSmsTemplateCreateReqVO bean);
SysSmsTemplateDO convert(SysSmsTemplateUpdateReqVO bean);
SysSmsTemplateRespVO convert(SysSmsTemplateDO bean);
List<SysSmsTemplateRespVO> convertList(List<SysSmsTemplateDO> list);
PageResult<SysSmsTemplateRespVO> convertPage(PageResult<SysSmsTemplateDO> page);
List<SysSmsTemplateExcelVO> convertList02(List<SysSmsTemplateDO> list);
}

View File

@ -1,36 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.tenant;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantExcelVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantUpdateReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 租户 Convert
*
* @author 芋道源码
*/
@Mapper
public interface SysTenantConvert {
SysTenantConvert INSTANCE = Mappers.getMapper(SysTenantConvert.class);
SysTenantDO convert(SysTenantCreateReqVO bean);
SysTenantDO convert(SysTenantUpdateReqVO bean);
SysTenantRespVO convert(SysTenantDO bean);
List<SysTenantRespVO> convertList(List<SysTenantDO> list);
PageResult<SysTenantRespVO> convertPage(PageResult<SysTenantDO> page);
List<SysTenantExcelVO> convertList02(List<SysTenantDO> list);
}

View File

@ -1,49 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.convert.user;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileRespVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.profile.SysUserProfileUpdateReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface SysUserConvert {
SysUserConvert INSTANCE = Mappers.getMapper(SysUserConvert.class);
SysUserPageItemRespVO convert(SysUserDO bean);
SysUserPageItemRespVO.Dept convert(SysDeptDO bean);
SysUserDO convert(SysUserCreateReqVO bean);
SysUserDO convert(SysUserUpdateReqVO bean);
SysUserExcelVO convert02(SysUserDO bean);
SysUserDO convert(SysUserImportExcelVO bean);
SysUserProfileRespVO convert03(SysUserDO bean);
List<SysUserProfileRespVO.Role> convertList(List<SysRoleDO> list);
SysUserProfileRespVO.Dept convert02(SysDeptDO bean);
SysUserDO convert(SysUserProfileUpdateReqVO bean);
SysUserDO convert(SysUserProfileUpdatePasswordReqVO bean);
List<SysUserProfileRespVO.Post> convertList02(List<SysPostDO> list);
List<SysUserProfileRespVO.SocialUser> convertList03(List<SysSocialUserDO> list);
List<SysUserSimpleRespVO> convertList04(List<SysUserDO> list);
}

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.auth;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Mapper
public interface SysUserSessionMapper extends BaseMapperX<SysUserSessionDO> {
default PageResult<SysUserSessionDO> selectPage(SysUserSessionPageReqVO reqVO, Collection<Long> userIds) {
return selectPage(reqVO, new QueryWrapperX<SysUserSessionDO>()
.inIfPresent("user_id", userIds)
.likeIfPresent("user_ip", reqVO.getUserIp()));
}
default List<SysUserSessionDO> selectListBySessionTimoutLt() {
return selectList(new QueryWrapperX<SysUserSessionDO>().lt("session_timeout",new Date()));
}
}

View File

@ -1,38 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept;
import cn.iocoder.yudao.adminserver.modules.tool.enums.SqlConstants;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.dept.SysDeptListReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
@Mapper
public interface SysDeptMapper extends BaseMapperX<SysDeptDO> {
default List<SysDeptDO> selectList(SysDeptListReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SysDeptDO>().likeIfPresent(SysDeptDO::getName, reqVO.getName())
.eqIfPresent(SysDeptDO::getStatus, reqVO.getStatus()));
}
default SysDeptDO selectByParentIdAndName(Long parentId, String name) {
return selectOne(new LambdaQueryWrapper<SysDeptDO>().eq(SysDeptDO::getParentId, parentId)
.eq(SysDeptDO::getName, name));
}
default Integer selectCountByParentId(Long parentId) {
return selectCount(SysDeptDO::getParentId, parentId);
}
default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
return selectOne(new LambdaQueryWrapper<SysDeptDO>().select(SysDeptDO::getId)
.gt(SysDeptDO::getUpdateTime, maxUpdateTime).last(SqlConstants.LIMIT1)) != null;
}
}

View File

@ -1,45 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dept.vo.post.SysPostPageReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
@Mapper
public interface SysPostMapper extends BaseMapperX<SysPostDO> {
default List<SysPostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
return selectList(new QueryWrapperX<SysPostDO>().inIfPresent("id", ids)
.inIfPresent("status", statuses));
}
default PageResult<SysPostDO> selectPage(SysPostPageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<SysPostDO>()
.likeIfPresent("code", reqVO.getCode())
.likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus()));
}
default List<SysPostDO> selectList(SysPostExportReqVO reqVO) {
return selectList(new QueryWrapperX<SysPostDO>()
.likeIfPresent("code", reqVO.getCode())
.likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus()));
}
default SysPostDO selectByName(String name) {
return selectOne(new QueryWrapper<SysPostDO>().eq("name", name));
}
default SysPostDO selectByCode(String code) {
return selectOne(new QueryWrapper<SysPostDO>().eq("code", code));
}
}

View File

@ -1,54 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dict;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.data.SysDictDataPageReqVO;
import cn.iocoder.yudao.adminserver.modules.tool.enums.SqlConstants;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Mapper
public interface SysDictDataMapper extends BaseMapperX<SysDictDataDO> {
default SysDictDataDO selectByDictTypeAndValue(String dictType, String value) {
return selectOne(new LambdaQueryWrapper<SysDictDataDO>().eq(SysDictDataDO::getDictType, dictType)
.eq(SysDictDataDO::getValue, value));
}
default List<SysDictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) {
return selectList(new LambdaQueryWrapper<SysDictDataDO>().eq(SysDictDataDO::getDictType, dictType)
.in(SysDictDataDO::getValue, values));
}
default int selectCountByDictType(String dictType) {
return selectCount(SysDictDataDO::getDictType, dictType);
}
default PageResult<SysDictDataDO> selectPage(SysDictDataPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SysDictDataDO>()
.likeIfPresent(SysDictDataDO::getLabel, reqVO.getLabel())
.likeIfPresent(SysDictDataDO::getDictType, reqVO.getDictType())
.eqIfPresent(SysDictDataDO::getStatus, reqVO.getStatus())
.orderByAsc(Arrays.asList(SysDictDataDO::getDictType, SysDictDataDO::getSort)));
}
default List<SysDictDataDO> selectList(SysDictDataExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SysDictDataDO>().likeIfPresent(SysDictDataDO::getLabel, reqVO.getLabel())
.likeIfPresent(SysDictDataDO::getDictType, reqVO.getDictType())
.eqIfPresent(SysDictDataDO::getStatus, reqVO.getStatus()));
}
default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
return selectOne(new LambdaQueryWrapper<SysDictDataDO>().select(SysDictDataDO::getId)
.gt(SysDictDataDO::getUpdateTime, maxUpdateTime).last(SqlConstants.LIMIT1)) != null;
}
}

View File

@ -1,40 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dict;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dict.SysDictTypeDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysDictTypeMapper extends BaseMapperX<SysDictTypeDO> {
default PageResult<SysDictTypeDO> selectPage(SysDictTypePageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<SysDictTypeDO>()
.likeIfPresent("name", reqVO.getName())
.likeIfPresent("`type`", reqVO.getType())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()));
}
default List<SysDictTypeDO> selectList(SysDictTypeExportReqVO reqVO) {
return selectList(new QueryWrapperX<SysDictTypeDO>()
.likeIfPresent("name", reqVO.getName())
.likeIfPresent("`type`", reqVO.getType())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()));
}
default SysDictTypeDO selectByType(String type) {
return selectOne(new QueryWrapperX<SysDictTypeDO>().eq("`type`", type));
}
default SysDictTypeDO selectByName(String name) {
return selectOne(new QueryWrapperX<SysDictTypeDO>().eq("name", name));
}
}

View File

@ -1,19 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.notice;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.adminserver.modules.system.controller.notice.vo.SysNoticePageReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.notice.SysNoticeDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysNoticeMapper extends BaseMapperX<SysNoticeDO> {
default PageResult<SysNoticeDO> selectPage(SysNoticePageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<SysNoticeDO>()
.likeIfPresent("title", reqVO.getTitle())
.eqIfPresent("status", reqVO.getStatus()));
}
}

View File

@ -1,36 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.permission;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.menu.SysMenuListReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysMenuDO;
import cn.iocoder.yudao.adminserver.modules.tool.enums.SqlConstants;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
@Mapper
public interface SysMenuMapper extends BaseMapperX<SysMenuDO> {
default SysMenuDO selectByParentIdAndName(Long parentId, String name) {
return selectOne(new LambdaQueryWrapper<SysMenuDO>().eq(SysMenuDO::getParentId, parentId)
.eq(SysMenuDO::getName, name));
}
default Integer selectCountByParentId(Long parentId) {
return selectCount(SysMenuDO::getParentId, parentId);
}
default List<SysMenuDO> selectList(SysMenuListReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SysMenuDO>().likeIfPresent(SysMenuDO::getName, reqVO.getName())
.eqIfPresent(SysMenuDO::getStatus, reqVO.getStatus()));
}
default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
return selectOne(new LambdaQueryWrapper<SysMenuDO>().select(SysMenuDO::getId)
.gt(SysMenuDO::getUpdateTime, maxUpdateTime).last(SqlConstants.LIMIT1)) != null;
}
}

View File

@ -1,51 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.permission;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRoleExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.permission.vo.role.SysRolePageReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.lang.Nullable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Mapper
public interface SysRoleMapper extends BaseMapperX<SysRoleDO> {
default PageResult<SysRoleDO> selectPage(SysRolePageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<SysRoleDO>().likeIfPresent("name", reqVO.getName())
.likeIfPresent("code", reqVO.getCode())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
}
default List<SysRoleDO> listRoles(SysRoleExportReqVO reqVO) {
return selectList(new QueryWrapperX<SysRoleDO>().likeIfPresent("name", reqVO.getName())
.likeIfPresent("code", reqVO.getCode())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
}
default SysRoleDO selectByName(String name) {
return selectOne(new QueryWrapperX<SysRoleDO>().eq("name", name));
}
default SysRoleDO selectByCode(String code) {
return selectOne(new QueryWrapperX<SysRoleDO>().eq("code", code));
}
default List<SysRoleDO> selectListByStatus(@Nullable Collection<Integer> statuses) {
return selectList(new QueryWrapperX<SysRoleDO>().in("status", statuses));
}
default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
return selectOne(new QueryWrapper<SysRoleDO>().select("id")
.gt("update_time", maxUpdateTime).last("LIMIT 1")) != null;
}
}

View File

@ -1,50 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.permission;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysUserRoleDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
@Mapper
public interface SysUserRoleMapper extends BaseMapperX<SysUserRoleDO> {
default List<SysUserRoleDO> selectListByUserId(Long userId) {
return selectList(new QueryWrapper<SysUserRoleDO>().eq("user_id", userId));
}
default List<SysUserRoleDO> selectListByRoleId(Long roleId) {
return selectList(new QueryWrapper<SysUserRoleDO>().eq("role_id", roleId));
}
default List<SysUserRoleDO> selectListByRoleIds(Collection<Long> roleIds) {
return selectList("role_id", roleIds);
}
default void insertList(Long userId, Collection<Long> roleIds) {
List<SysUserRoleDO> list = roleIds.stream().map(roleId -> {
SysUserRoleDO entity = new SysUserRoleDO();
entity.setUserId(userId);
entity.setRoleId(roleId);
return entity;
}).collect(Collectors.toList());
insertBatch(list);
}
default void deleteListByUserIdAndRoleIdIds(Long userId, Collection<Long> roleIds) {
delete(new QueryWrapper<SysUserRoleDO>().eq("user_id", userId)
.in("role_id", roleIds));
}
default void deleteListByUserId(Long userId) {
delete(new QueryWrapper<SysUserRoleDO>().eq("user_id", userId));
}
default void deleteListByRoleId(Long roleId) {
delete(new QueryWrapper<SysUserRoleDO>().eq("role_id", roleId));
}
}

View File

@ -1,49 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.sms;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplateExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.sms.vo.template.SysSmsTemplatePageReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysSmsTemplateMapper extends BaseMapperX<SysSmsTemplateDO> {
default SysSmsTemplateDO selectByCode(String code) {
return selectOne(SysSmsTemplateDO::getCode, code);
}
// TODO 这种参数都一样的得想办法封装一下
default PageResult<SysSmsTemplateDO> selectPage(SysSmsTemplatePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SysSmsTemplateDO>()
.eqIfPresent(SysSmsTemplateDO::getType, reqVO.getType())
.eqIfPresent(SysSmsTemplateDO::getStatus, reqVO.getStatus())
.likeIfPresent(SysSmsTemplateDO::getCode, reqVO.getCode())
.likeIfPresent(SysSmsTemplateDO::getContent, reqVO.getContent())
.likeIfPresent(SysSmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId())
.eqIfPresent(SysSmsTemplateDO::getChannelId, reqVO.getChannelId())
.betweenIfPresent(SysSmsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(SysSmsTemplateDO::getId));
}
default List<SysSmsTemplateDO> selectList(SysSmsTemplateExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SysSmsTemplateDO>()
.eqIfPresent(SysSmsTemplateDO::getType, reqVO.getType())
.eqIfPresent(SysSmsTemplateDO::getStatus, reqVO.getStatus())
.likeIfPresent(SysSmsTemplateDO::getCode, reqVO.getCode())
.likeIfPresent(SysSmsTemplateDO::getContent, reqVO.getContent())
.likeIfPresent(SysSmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId())
.eqIfPresent(SysSmsTemplateDO::getChannelId, reqVO.getChannelId())
.betweenIfPresent(SysSmsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(SysSmsTemplateDO::getId));
}
default Integer selectCountByChannelId(Long channelId) {
return selectCount(SysSmsTemplateDO::getChannelId, channelId);
}
}

View File

@ -1,44 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.tenant;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.tenant.vo.SysTenantPageReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 租户 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface SysTenantMapper extends BaseMapperX<SysTenantDO> {
default PageResult<SysTenantDO> selectPage(SysTenantPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SysTenantDO>()
.likeIfPresent(SysTenantDO::getName, reqVO.getName())
.likeIfPresent(SysTenantDO::getContactName, reqVO.getContactName())
.likeIfPresent(SysTenantDO::getContactMobile, reqVO.getContactMobile())
.eqIfPresent(SysTenantDO::getStatus, reqVO.getStatus())
.betweenIfPresent(SysTenantDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(SysTenantDO::getId));
}
default List<SysTenantDO> selectList(SysTenantExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SysTenantDO>()
.likeIfPresent(SysTenantDO::getName, reqVO.getName())
.likeIfPresent(SysTenantDO::getContactName, reqVO.getContactName())
.likeIfPresent(SysTenantDO::getContactMobile, reqVO.getContactMobile())
.eqIfPresent(SysTenantDO::getStatus, reqVO.getStatus())
.betweenIfPresent(SysTenantDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(SysTenantDO::getId));
}
default SysTenantDO selectByName(String name) {
return selectOne(SysTenantDO::getName, name);
}
}

View File

@ -1,77 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.mysql.user;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserExportReqVO;
import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserPageReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jodd.util.StringPool;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
@Mapper
public interface SysUserMapper extends BaseMapperX<SysUserDO> {
default SysUserDO selectByUsername(String username) {
return selectOne(new LambdaQueryWrapper<SysUserDO>().eq(SysUserDO::getUsername, username));
}
default SysUserDO selectByEmail(String email) {
return selectOne(new LambdaQueryWrapper<SysUserDO>().eq(SysUserDO::getEmail, email));
}
default SysUserDO selectByMobile(String mobile) {
return selectOne(new LambdaQueryWrapper<SysUserDO>().eq(SysUserDO::getMobile, mobile));
}
default PageResult<SysUserDO> selectPage(SysUserPageReqVO reqVO, Collection<Long> deptIds) {
return selectPage(reqVO, new LambdaQueryWrapperX<SysUserDO>()
.likeIfPresent(SysUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(SysUserDO::getMobile, reqVO.getMobile())
.eqIfPresent(SysUserDO::getStatus, reqVO.getStatus())
.betweenIfPresent(SysUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime())
.inIfPresent(SysUserDO::getDeptId, deptIds));
}
default List<SysUserDO> selectList(SysUserExportReqVO reqVO, Collection<Long> deptIds) {
return selectList(new LambdaQueryWrapperX<SysUserDO>()
.likeIfPresent(SysUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(SysUserDO::getMobile, reqVO.getMobile())
.eqIfPresent(SysUserDO::getStatus, reqVO.getStatus())
.betweenIfPresent(SysUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime())
.inIfPresent(SysUserDO::getDeptId, deptIds));
}
default List<SysUserDO> selectListByNickname(String nickname) {
return selectList(new LambdaQueryWrapperX<SysUserDO>().like(SysUserDO::getNickname, nickname));
}
default List<SysUserDO> selectListByUsername(String username) {
return selectList(new LambdaQueryWrapperX<SysUserDO>().like(SysUserDO::getUsername, username));
}
// TODO 芋艿可废弃该方法
default List<SysUserDO> selectListByDepartIdAndPostId(Long departId, Long postId) {
return selectList(new LambdaQueryWrapperX<SysUserDO>()
.eq(SysUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.eq(SysUserDO::getDeptId, departId)
// TODO @jason: 封装一个 StringUtils .toString 如果空的时候设置为 null会更简洁
.likeIfPresent(SysUserDO::getPostIds, Optional.ofNullable(postId).map(t -> String.valueOf(postId)).orElse(StringPool.EMPTY)));
}
default List<SysUserDO> selectListByStatus(Integer status) {
return selectList(SysUserDO::getStatus, status);
}
default List<SysUserDO> selectListByDeptIds(Collection<Long> deptIds) {
return selectList(SysUserDO::getDeptId, deptIds);
}
}

View File

@ -1,23 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.dal.redis;
import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import me.zhyd.oauth.model.AuthUser;
import java.time.Duration;
import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING;
/**
* System Redis Key 枚举类
*
* @author 芋道源码
*/
public interface SysRedisKeyConstants {
RedisKeyDefine CAPTCHA_CODE = new RedisKeyDefine("验证码的缓存",
"captcha_code:%s", // 参数为 uuid
STRING, String.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC);
}

View File

@ -1,53 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.enums;
/**
* System 字典类型的枚举类
*
* @author 芋道源码
*/
public interface SysDictTypeConstants {
String USER_TYPE = "user_type"; // 用户类型
String COMMON_STATUS = "sys_common_status"; // 系统状态
String USER_SEX = "sys_user_sex"; // 用户性别
String OPERATE_TYPE = "sys_operate_type"; // 操作类型
String LOGIN_TYPE = "sys_login_type"; // 登录日志的类型
String LOGIN_RESULT = "sys_login_result"; // 登录结果
String CONFIG_TYPE = "sys_config_type"; // 参数配置类型
String BOOLEAN_STRING = "sys_boolean_string"; // Boolean 是否类型
String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码
String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型
String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态
String SMS_RECEIVE_STATUS = "sys_sms_receive_status"; // 短信接收状态
/**
* 支付-订单-订单状态
*/
String PAY_ORDER_STATUS = "pay_order_status";
/**
* 支付-订单-订单回调商户状态
*/
String PAY_ORDER_NOTIFY_STATUS = "pay_order_notify_status";
/**
* 支付-订单-订单退款状态
*/
String PAY_ORDER_REFUND_STATUS = "pay_order_refund_status";
/**
* 支付-退款订单-退款状态
*/
String PAY_REFUND_ORDER_STATUS = "pay_refund_order_status";
/**
* 支付-退款订单-退款类别
*/
String PAY_REFUND_ORDER_TYPE = "pay_refund_order_type";
String BPM_TASK_ASSIGN_RULE_TYPE = "bpm_task_assign_rule_type"; // 任务分配规则类型
String BPM_TASK_ASSIGN_SCRIPT = "bpm_task_assign_script"; // 任务分配自定义脚本
}

View File

@ -1,4 +0,0 @@
/**
* 基于 Hutool captcha 实现验证码功能
*/
package cn.iocoder.yudao.adminserver.modules.system.framework.captcha;

View File

@ -1,4 +0,0 @@
/**
* 代码生成器
*/
package cn.iocoder.yudao.adminserver.modules.system.framework.codegen;

View File

@ -1,4 +0,0 @@
/**
* system 模块的数据权限配置
*/
package cn.iocoder.yudao.adminserver.modules.system.framework.datapermission;

View File

@ -1,6 +0,0 @@
/**
* 属于 system 模块的 framework 封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.adminserver.modules.system.framework;

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.job;

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.dept;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.dept.SysDeptRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysDeptRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysDeptRefreshConsumer extends AbstractChannelMessageListener<SysDeptRefreshMessage> {
@Resource
private SysDeptService deptService;
@Override
public void onMessage(SysDeptRefreshMessage message) {
log.info("[onMessage][收到 Dept 刷新消息]");
deptService.initLocalCache();
}
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.dict;
import cn.iocoder.yudao.coreservice.modules.system.service.dict.SysDictDataCoreService;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.dict.SysDictDataRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.dict.SysDictDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysDictDataRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysDictDataRefreshConsumer extends AbstractChannelMessageListener<SysDictDataRefreshMessage> {
@Resource
private SysDictDataCoreService dictDataCoreService;
@Override
public void onMessage(SysDictDataRefreshMessage message) {
log.info("[onMessage][收到 DictData 刷新消息]");
dictDataCoreService.initLocalCache();
}
}

View File

@ -1,17 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.mail;
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.mail.SysMailSendMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class SysMailSendConsumer extends AbstractStreamMessageListener<SysMailSendMessage> {
@Override
public void onMessage(SysMailSendMessage message) {
log.info("[onMessage][消息内容({})]", message);
}
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysMenuRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysMenuRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysMenuRefreshConsumer extends AbstractChannelMessageListener<SysMenuRefreshMessage> {
@Resource
private SysMenuService menuService;
@Override
public void onMessage(SysMenuRefreshMessage message) {
log.info("[onMessage][收到 Menu 刷新消息]");
menuService.initLocalCache();
}
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleMenuRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysRoleMenuRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysRoleMenuRefreshConsumer extends AbstractChannelMessageListener<SysRoleMenuRefreshMessage> {
@Resource
private SysPermissionService permissionService;
@Override
public void onMessage(SysRoleMenuRefreshMessage message) {
log.info("[onMessage][收到 Role 与 Menu 的关联刷新消息]");
permissionService.initLocalCache();
}
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.permission;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.permission.SysRoleRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysRoleRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysRoleRefreshConsumer extends AbstractChannelMessageListener<SysRoleRefreshMessage> {
@Resource
private SysRoleService roleService;
@Override
public void onMessage(SysRoleRefreshMessage message) {
log.info("[onMessage][收到 Role 刷新消息]");
roleService.initLocalCache();
}
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsChannelRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.service.sms.SysSmsChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysSmsChannelRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysSmsChannelRefreshConsumer extends AbstractChannelMessageListener<SysSmsChannelRefreshMessage> {
@Resource
private SysSmsChannelService smsChannelService;
@Override
public void onMessage(SysSmsChannelRefreshMessage message) {
log.info("[onMessage][收到 SmsChannel 刷新消息]");
smsChannelService.initSmsClients();
}
}

View File

@ -1,30 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms;
import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage;
import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService;
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysSmsSendMessage} 的消费者
*
* @author zzf
* @date 2021/3/9 16:35
*/
@Component
@Slf4j
public class SysSmsSendConsumer extends AbstractStreamMessageListener<SysSmsSendMessage> {
@Resource
private SysSmsCoreService smsCoreService;
@Override
public void onMessage(SysSmsSendMessage message) {
log.info("[onMessage][消息内容({})]", message);
smsCoreService.doSendSms(message);
}
}

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.consumer.sms;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsTemplateRefreshMessage;
import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsTemplateCoreService;
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SysSmsTemplateRefreshMessage} 的消费者
*
* @author 芋道源码
*/
@Component
@Slf4j
public class SysSmsTemplateRefreshConsumer extends AbstractChannelMessageListener<SysSmsTemplateRefreshMessage> {
@Resource
private SysSmsTemplateCoreService smsTemplateCoreService;
@Override
public void onMessage(SysSmsTemplateRefreshMessage message) {
log.info("[onMessage][收到 SmsTemplate 刷新消息]");
smsTemplateCoreService.initLocalCache();
}
}

View File

@ -1,40 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.mq.producer.sms;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsChannelRefreshMessage;
import cn.iocoder.yudao.adminserver.modules.system.mq.message.sms.SysSmsTemplateRefreshMessage;
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* Sms 短信相关消息的 Producer
*
* @author zzf
* @date 2021/3/9 16:35
*/
@Slf4j
@Component
public class SysSmsProducer {
@Resource
private RedisMQTemplate redisMQTemplate;
/**
* 发送 {@link SysSmsChannelRefreshMessage} 消息
*/
public void sendSmsChannelRefreshMessage() {
SysSmsChannelRefreshMessage message = new SysSmsChannelRefreshMessage();
redisMQTemplate.send(message);
}
/**
* 发送 {@link SysSmsTemplateRefreshMessage} 消息
*/
public void sendSmsTemplateRefreshMessage() {
SysSmsTemplateRefreshMessage message = new SysSmsTemplateRefreshMessage();
redisMQTemplate.send(message);
}
}

View File

@ -1,7 +0,0 @@
/**
* system 包下我们放通用业务支撑上层的核心业务
* 例如说用户部门权限数据字典等等
*
* 缩写sys
*/
package cn.iocoder.yudao.adminserver.modules.system;

View File

@ -1,29 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.service.auth;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 在线用户 Session Service 接口
*
* @author 芋道源码
*/
public interface SysUserSessionService {
/**
* 获得在线用户分页列表
*
* @param reqVO 分页条件
* @return 份额与列表
*/
PageResult<SysUserSessionDO> getUserSessionPage(SysUserSessionPageReqVO reqVO);
/**
* 移除超时的在线用户
*
* @return {@link Long } 移出的超时用户数量
**/
long clearSessionTimeout();
}

View File

@ -1,97 +0,0 @@
package cn.iocoder.yudao.adminserver.modules.system.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.session.SysUserSessionPageReqVO;
import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.auth.SysUserSessionMapper;
import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginLogTypeEnum;
import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginResultEnum;
import cn.iocoder.yudao.adminserver.modules.system.service.auth.SysUserSessionService;
import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO;
import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService;
import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
/**
* 在线用户 Session Service 实现类
*
* @author 芋道源码
*/
@Slf4j
@Service
public class SysUserSessionServiceImpl implements SysUserSessionService {
@Resource
private SysUserSessionMapper userSessionMapper;
@Resource
private SysUserService userService;
@Resource
private SysLoginLogCoreService loginLogCoreService;
@Resource
private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO;
@Override
public PageResult<SysUserSessionDO> getUserSessionPage(SysUserSessionPageReqVO reqVO) {
// 处理基于用户昵称的查询
Collection<Long> userIds = null;
if (StrUtil.isNotEmpty(reqVO.getUsername())) {
userIds = convertSet(userService.getUsersByUsername(reqVO.getUsername()), SysUserDO::getId);
if (CollUtil.isEmpty(userIds)) {
return PageResult.empty();
}
}
return userSessionMapper.selectPage(reqVO, userIds);
}
// TODO @芋艿优化下该方法
@Override
public long clearSessionTimeout() {
// 获取db里已经超时的用户列表
List<SysUserSessionDO> sessionTimeoutDOS = userSessionMapper.selectListBySessionTimoutLt();
Map<String, SysUserSessionDO> timeoutSessionDOMap = sessionTimeoutDOS
.stream()
.filter(sessionDO -> loginUserCoreRedisDAO.get(sessionDO.getId()) == null)
.collect(Collectors.toMap(SysUserSessionDO::getId, o -> o));
// 确认已经超时,按批次移出在线用户列表
if (CollUtil.isNotEmpty(timeoutSessionDOMap)) {
Lists.partition(new ArrayList<>(timeoutSessionDOMap.keySet()), 100)
.forEach(userSessionMapper::deleteBatchIds);
// 记录用户超时退出日志
createTimeoutLogoutLog(timeoutSessionDOMap.values());
}
return timeoutSessionDOMap.size();
}
private void createTimeoutLogoutLog(Collection<SysUserSessionDO> timeoutSessionDOS) {
for (SysUserSessionDO timeoutSessionDO : timeoutSessionDOS) {
SysLoginLogCreateReqDTO reqDTO = new SysLoginLogCreateReqDTO();
reqDTO.setLogType(SysLoginLogTypeEnum.LOGOUT_TIMEOUT.getType());
reqDTO.setTraceId(TracerUtils.getTraceId());
reqDTO.setUserId(timeoutSessionDO.getUserId());
reqDTO.setUserType(timeoutSessionDO.getUserType());
reqDTO.setUsername(timeoutSessionDO.getUsername());
reqDTO.setUserAgent(timeoutSessionDO.getUserAgent());
reqDTO.setUserIp(timeoutSessionDO.getUserIp());
reqDTO.setResult(SysLoginResultEnum.SUCCESS.getResult());
loginLogCoreService.createLoginLog(reqDTO);
}
}
}

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