feat: 临时提交

pull/25/head
gaibu 2023-02-10 15:42:01 +08:00
parent cca9807a4e
commit e28d73a76c
13 changed files with 78 additions and 45 deletions

View File

@ -199,14 +199,15 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>org.springdoc</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId> <artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>${knife4j.version}</version> <version>1.6.14</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-webmvc-core</artifactId>
<version>${springdoc.version}</version> <version>1.6.14</version>
</dependency> </dependency>
<!-- DB 相关 --> <!-- DB 相关 -->

View File

@ -60,8 +60,8 @@
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-webmvc-core</artifactId>
<scope>provided</scope> <!-- 设置为 provided主要是 PageParam 使用到 --> <scope>compile</scope>
</dependency> </dependency>
<!-- 监控相关 --> <!-- 监控相关 -->

View File

@ -21,6 +21,11 @@
<artifactId>yudao-common</artifactId> <artifactId>yudao-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
</dependency>
<!-- Web 相关 --> <!-- Web 相关 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -33,15 +38,6 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId> <artifactId>spring-boot-starter-validation</artifactId>

View File

@ -1,6 +1,5 @@
cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration cn.iocoder.yudao.framework.apilog.config.YudaoApiLogAutoConfiguration
cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration cn.iocoder.yudao.framework.jackson.config.YudaoJacksonAutoConfiguration
com.github.xiaoymin.knife4j.spring.configuration.Knife4jAutoConfiguration
cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration
cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration cn.iocoder.yudao.framework.web.config.YudaoWebAutoConfiguration
cn.iocoder.yudao.framework.xss.config.YudaoXssAutoConfiguration cn.iocoder.yudao.framework.apilog.config.YudaoApiLogRpcAutoConfiguration

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>yudao</artifactId> <artifactId>yudao</artifactId>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
@ -26,11 +26,23 @@
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-spring-boot-starter-banner</artifactId> <artifactId>yudao-spring-boot-starter-banner</artifactId>
<exclusions>
<exclusion>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-system-api</artifactId> <artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
<exclusions>
<exclusion>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- Gateway 网关相关 --> <!-- Gateway 网关相关 -->
@ -44,13 +56,9 @@
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-webflux-ui</artifactId>
</dependency> </dependency>
<!-- RPC 远程调用相关 --> <!-- RPC 远程调用相关 -->

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.gateway.config;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.cloud.gateway.route.RouteDefinitionLocator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Configuration
public class SpringDocConfiguration {
private static final String SERVER_NAME_SUFFIX = "-api";
@Bean
@Lazy(false)
public List<GroupedOpenApi> apis(RouteDefinitionLocator locator) {
List<GroupedOpenApi> groups = new ArrayList<>();
List<RouteDefinition> definitions = locator.getRouteDefinitions().collectList().block();
for (RouteDefinition definition : definitions) {
log.info("id: " + definition.getId() + " " + definition.getUri().toString());
}
definitions.stream()
.filter(routeDefinition -> routeDefinition.getId().matches(".*"+SERVER_NAME_SUFFIX))
.forEach(routeDefinition -> {
String name = routeDefinition.getId().replaceAll(SERVER_NAME_SUFFIX, "");
GroupedOpenApi.builder().pathsToMatch("/" + name + "/**").group(name).build();
});
return groups;
}
}

View File

@ -23,13 +23,9 @@
</dependency> </dependency>
<!-- Web 相关 --> <!-- Web 相关 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-webmvc-core</artifactId>
</dependency> </dependency>
<!-- 参数校验 --> <!-- 参数校验 -->

View File

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.infra; package cn.iocoder.yudao.module.infra;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
/** /**
* *
* * <p>
* https://cloud.iocoder.cn/quick-start/ 文章 * https://cloud.iocoder.cn/quick-start/ 文章
* https://cloud.iocoder.cn/quick-start/ 文章 * https://cloud.iocoder.cn/quick-start/ 文章
* https://cloud.iocoder.cn/quick-start/ 文章 * https://cloud.iocoder.cn/quick-start/ 文章

View File

@ -23,13 +23,9 @@
</dependency> </dependency>
<!-- Web 相关 --> <!-- Web 相关 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <artifactId>springdoc-openapi-webmvc-core</artifactId>
</dependency> </dependency>
<!-- 参数校验 --> <!-- 参数校验 -->

View File

@ -27,7 +27,7 @@ public interface ErrorCodeApi {
@PostMapping(PREFIX + "/auto-generate") @PostMapping(PREFIX + "/auto-generate")
@Operation(summary = "自动创建错误码") @Operation(summary = "自动创建错误码")
CommonResult<Boolean> autoGenerateErrorCodes(@Valid @RequestBody List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs); CommonResult<Boolean> autoGenerateErrorCodeList(@Valid @RequestBody List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
@GetMapping(PREFIX + "/list") @GetMapping(PREFIX + "/list")
@Operation(summary = "增量获得错误码数组", description = "如果 minUpdateTime 为空时,则获取所有错误码") @Operation(summary = "增量获得错误码数组", description = "如果 minUpdateTime 为空时,则获取所有错误码")

View File

@ -19,7 +19,7 @@ public interface TenantApi {
@GetMapping(PREFIX + "/id-list") @GetMapping(PREFIX + "/id-list")
@Operation(summary = "获得所有租户编号") @Operation(summary = "获得所有租户编号")
CommonResult<List<Long>> getTenantIds(); CommonResult<List<Long>> getTenantIdList();
@GetMapping(PREFIX + "/valid") @GetMapping(PREFIX + "/valid")
@Operation(summary = "校验租户是否合法") @Operation(summary = "校验租户是否合法")

View File

@ -33,25 +33,25 @@ public class AdminUserApiImpl implements AdminUserApi {
} }
@Override @Override
public CommonResult<List<AdminUserRespDTO>> getUserList(Collection<Long> ids) { public CommonResult<List<AdminUserRespDTO>> getUsers(Collection<Long> ids) {
List<AdminUserDO> users = userService.getUserList(ids); List<AdminUserDO> users = userService.getUserList(ids);
return success(UserConvert.INSTANCE.convertList4(users)); return success(UserConvert.INSTANCE.convertList4(users));
} }
@Override @Override
public CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(Collection<Long> deptIds) { public CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(Collection<Long> deptIds) {
List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds); List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
return success(UserConvert.INSTANCE.convertList4(users)); return success(UserConvert.INSTANCE.convertList4(users));
} }
@Override @Override
public CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(Collection<Long> postIds) { public CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(Collection<Long> postIds) {
List<AdminUserDO> users = userService.getUserListByPostIds(postIds); List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
return success(UserConvert.INSTANCE.convertList4(users)); return success(UserConvert.INSTANCE.convertList4(users));
} }
@Override @Override
public CommonResult<Boolean> validUserList(Set<Long> ids) { public CommonResult<Boolean> validUsers(Set<Long> ids) {
userService.validateUserList(ids); userService.validateUserList(ids);
return success(true); return success(true);
} }

View File

@ -113,7 +113,7 @@ public class UserController {
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() { public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() {
// 获用户门列表,只要开启状态的 // 获用户门列表,只要开启状态的
List<AdminUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus()); List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
// 排序后,返回给前端 // 排序后,返回给前端
return success(UserConvert.INSTANCE.convertList04(list)); return success(UserConvert.INSTANCE.convertList04(list));
} }
@ -133,7 +133,7 @@ public class UserController {
public void exportUsers(@Validated UserExportReqVO reqVO, public void exportUsers(@Validated UserExportReqVO reqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
// 获得用户列表 // 获得用户列表
List<AdminUserDO> users = userService.getUsers(reqVO); List<AdminUserDO> users = userService.getUserList(reqVO);
// 获得拼接需要的数据 // 获得拼接需要的数据
Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId); Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId);
@ -183,7 +183,7 @@ public class UserController {
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file, public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class); List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
return success(userService.importUsers(list, updateSupport)); return success(userService.importUserList(list, updateSupport));
} }
} }