优化 Swagger 的版本依赖,避免冲突
This commit is contained in:
@@ -24,8 +24,9 @@
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-webmvc-core</artifactId>
|
||||
<groupId>io.swagger.core.v3</groupId> <!-- 接口文档:使用最新版本的 Swagger 模型 -->
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 -->
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
|
||||
@@ -35,12 +35,12 @@ public interface AdminUserApi {
|
||||
@GetMapping(PREFIX + "/list-by-dept-id")
|
||||
@Operation(summary = "获得指定部门的用户数组")
|
||||
@Parameter(name = "deptIds", description = "部门编号数组", example = "1,2", required = true)
|
||||
CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(@RequestParam("deptIds") Collection<Long> deptIds);
|
||||
CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(@RequestParam("deptIds") Collection<Long> deptIds);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-post-id")
|
||||
@Operation(summary = "获得指定岗位的用户数组")
|
||||
@Parameter(name = "postIds", description = "岗位编号数组", example = "2,3", required = true)
|
||||
CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(@RequestParam("postIds") Collection<Long> postIds);
|
||||
CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(@RequestParam("postIds") Collection<Long> postIds);
|
||||
|
||||
/**
|
||||
* 获得用户 Map
|
||||
@@ -55,6 +55,6 @@ public interface AdminUserApi {
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@Operation(summary = "校验用户们是否有效")
|
||||
@Parameter(name = "ids", description = "用户编号数组", example = "3,5", required = true)
|
||||
CommonResult<Boolean> validUsers(@RequestParam("ids") Set<Long> ids);
|
||||
CommonResult<Boolean> validUserList(@RequestParam("ids") Set<Long> ids);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,19 +39,19 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(Collection<Long> deptIds) {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(Collection<Long> deptIds) {
|
||||
List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(Collection<Long> postIds) {
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(Collection<Long> postIds) {
|
||||
List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validUsers(Set<Long> ids) {
|
||||
public CommonResult<Boolean> validUserList(Set<Long> ids) {
|
||||
userService.validateUserList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@ public class SecurityConfiguration {
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous();
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
// Druid 监控
|
||||
registry.antMatchers("/druid/**").anonymous();
|
||||
// Spring Boot Actuator 的安全配置
|
||||
|
||||
@@ -27,6 +27,21 @@ spring:
|
||||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||
path: /swagger-ui.html
|
||||
|
||||
knife4j:
|
||||
enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
|
||||
Reference in New Issue
Block a user