Commit 859cf74a6c9ad609cbf68c6ae82cdcb242e581eb
1 parent
21b37445
对齐 boot 与 cloud 的代码
Showing
25 changed files
with
63 additions
and
95 deletions
README.md
| @@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
| 102 | 102 | ||
| 103 | 系统内置多种多种业务功能,可以用于快速你的业务系统: | 103 | 系统内置多种多种业务功能,可以用于快速你的业务系统: |
| 104 | 104 | ||
| 105 | - | 105 | + |
| 106 | 106 | ||
| 107 | * 系统功能 | 107 | * 系统功能 |
| 108 | * 基础设施 | 108 | * 基础设施 |
yudao-dependencies/pom.xml
| @@ -216,10 +216,9 @@ | @@ -216,10 +216,9 @@ | ||
| 216 | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> | 216 | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> |
| 217 | <version>${dynamic-datasource.version}</version> | 217 | <version>${dynamic-datasource.version}</version> |
| 218 | </dependency> | 218 | </dependency> |
| 219 | - | ||
| 220 | <dependency> | 219 | <dependency> |
| 221 | <groupId>com.github.yulichang</groupId> | 220 | <groupId>com.github.yulichang</groupId> |
| 222 | - <artifactId>mybatis-plus-join-boot-starter</artifactId> | 221 | + <artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 --> |
| 223 | <version>${mybatis-plus-join-boot-starter.version}</version> | 222 | <version>${mybatis-plus-join-boot-starter.version}</version> |
| 224 | </dependency> | 223 | </dependency> |
| 225 | 224 |
yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
| @@ -64,9 +64,8 @@ | @@ -64,9 +64,8 @@ | ||
| 64 | 64 | ||
| 65 | <dependency> | 65 | <dependency> |
| 66 | <groupId>com.github.yulichang</groupId> | 66 | <groupId>com.github.yulichang</groupId> |
| 67 | - <artifactId>mybatis-plus-join-boot-starter</artifactId> | 67 | + <artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 --> |
| 68 | </dependency> | 68 | </dependency> |
| 69 | - | ||
| 70 | </dependencies> | 69 | </dependencies> |
| 71 | 70 | ||
| 72 | </project> | 71 | </project> |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
| @@ -6,10 +6,10 @@ import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | @@ -6,10 +6,10 @@ import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | ||
| 6 | import com.baomidou.mybatisplus.core.conditions.Wrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 8 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 8 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 9 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 9 | import com.baomidou.mybatisplus.core.metadata.IPage; | 10 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 10 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | 11 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| 11 | import com.baomidou.mybatisplus.extension.toolkit.Db; | 12 | import com.baomidou.mybatisplus.extension.toolkit.Db; |
| 12 | -import com.github.yulichang.base.MPJBaseMapper; | ||
| 13 | import org.apache.ibatis.annotations.Param; | 13 | import org.apache.ibatis.annotations.Param; |
| 14 | 14 | ||
| 15 | import java.util.Collection; | 15 | import java.util.Collection; |
| @@ -17,10 +17,8 @@ import java.util.List; | @@ -17,10 +17,8 @@ import java.util.List; | ||
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * 在 MyBatis Plus 的 BaseMapper 的基础上拓展,提供更多的能力 | 19 | * 在 MyBatis Plus 的 BaseMapper 的基础上拓展,提供更多的能力 |
| 20 | - * <p> | ||
| 21 | - * 为什么继承 MPJBaseMapper 接口?支持 MyBatis Plus 多表 Join 的能力。 | ||
| 22 | */ | 20 | */ |
| 23 | -public interface BaseMapperX<T> extends MPJBaseMapper<T> { | 21 | +public interface BaseMapperX<T> extends BaseMapper<T> { |
| 24 | 22 | ||
| 25 | default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) { | 23 | default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) { |
| 26 | // MyBatis Plus 查询 | 24 | // MyBatis Plus 查询 |
| @@ -46,18 +44,6 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | @@ -46,18 +44,6 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | ||
| 46 | return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2)); | 44 | return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2)); |
| 47 | } | 45 | } |
| 48 | 46 | ||
| 49 | - default T selectOne(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2, | ||
| 50 | - SFunction<T, ?> field3, Object value3) { | ||
| 51 | - return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2) | ||
| 52 | - .eq(field3, value3)); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - default T selectOne(SFunction<T, ?> field1, Object value1, SFunction<T, ?> field2, Object value2, | ||
| 56 | - SFunction<T, ?> field3, Object value3, SFunction<T, ?> field4, Object value4) { | ||
| 57 | - return selectOne(new LambdaQueryWrapper<T>().eq(field1, value1).eq(field2, value2) | ||
| 58 | - .eq(field3, value3).eq(field4, value4)); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | default Long selectCount() { | 47 | default Long selectCount() { |
| 62 | return selectCount(new QueryWrapper<T>()); | 48 | return selectCount(new QueryWrapper<T>()); |
| 63 | } | 49 | } |
| @@ -117,26 +103,8 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | @@ -117,26 +103,8 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | ||
| 117 | update(update, new QueryWrapper<>()); | 103 | update(update, new QueryWrapper<>()); |
| 118 | } | 104 | } |
| 119 | 105 | ||
| 120 | - /** | ||
| 121 | - * 根据ID 批量更新,适合大量数据更新 | ||
| 122 | - * | ||
| 123 | - * @param entities 实体们 | ||
| 124 | - */ | ||
| 125 | - default void updateBatch(Collection<T> entities) { | ||
| 126 | - Db.updateBatchById(entities); | ||
| 127 | - } | ||
| 128 | - | ||
| 129 | default void updateBatch(Collection<T> entities, int size) { | 106 | default void updateBatch(Collection<T> entities, int size) { |
| 130 | Db.updateBatchById(entities, size); | 107 | Db.updateBatchById(entities, size); |
| 131 | } | 108 | } |
| 132 | 109 | ||
| 133 | - /** | ||
| 134 | - * 批量修改插入, 会根据实体的主键是否为空,更新还是修改。默认为 1000 | ||
| 135 | - * | ||
| 136 | - * @param entities 实体们 | ||
| 137 | - */ | ||
| 138 | - default void saveOrUpdateBatch(Collection<T> entities){ | ||
| 139 | - Db.saveOrUpdateBatch(entities); | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | } | 110 | } |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
| @@ -60,7 +60,7 @@ public class YudaoWebSecurityConfigurerAdapter { | @@ -60,7 +60,7 @@ public class YudaoWebSecurityConfigurerAdapter { | ||
| 60 | /** | 60 | /** |
| 61 | * 自定义的权限映射 Bean 们 | 61 | * 自定义的权限映射 Bean 们 |
| 62 | * | 62 | * |
| 63 | - * @see #configure(HttpSecurity) | 63 | + * @see #filterChain(HttpSecurity) |
| 64 | */ | 64 | */ |
| 65 | @Resource | 65 | @Resource |
| 66 | private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers; | 66 | private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers; |
| @@ -79,7 +79,7 @@ public class YudaoWebSecurityConfigurerAdapter { | @@ -79,7 +79,7 @@ public class YudaoWebSecurityConfigurerAdapter { | ||
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * 配置 URL 的安全配置 | 81 | * 配置 URL 的安全配置 |
| 82 | - * <p> | 82 | + * |
| 83 | * anyRequest | 匹配所有请求路径 | 83 | * anyRequest | 匹配所有请求路径 |
| 84 | * access | SpringEl表达式结果为true时可以访问 | 84 | * access | SpringEl表达式结果为true时可以访问 |
| 85 | * anonymous | 匿名可以访问 | 85 | * anonymous | 匿名可以访问 |
| @@ -141,7 +141,6 @@ public class YudaoWebSecurityConfigurerAdapter { | @@ -141,7 +141,6 @@ public class YudaoWebSecurityConfigurerAdapter { | ||
| 141 | 141 | ||
| 142 | // 添加 Token Filter | 142 | // 添加 Token Filter |
| 143 | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); | 143 | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| 144 | - | ||
| 145 | return httpSecurity.build(); | 144 | return httpSecurity.build(); |
| 146 | } | 145 | } |
| 147 | 146 |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java
| @@ -40,6 +40,7 @@ public class BaseDbAndRedisUnitTest { | @@ -40,6 +40,7 @@ public class BaseDbAndRedisUnitTest { | ||
| 40 | 40 | ||
| 41 | // Redis 配置类 | 41 | // Redis 配置类 |
| 42 | RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer | 42 | RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer |
| 43 | +// RedisAutoConfiguration.class, // Spring Redis 自动配置类 | ||
| 43 | YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 | 44 | YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 |
| 44 | RedissonAutoConfiguration.class, // Redisson 自动高配置类 | 45 | RedissonAutoConfiguration.class, // Redisson 自动高配置类 |
| 45 | }) | 46 | }) |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| @@ -52,7 +52,8 @@ public class YudaoSwaggerAutoConfiguration { | @@ -52,7 +52,8 @@ public class YudaoSwaggerAutoConfiguration { | ||
| 52 | // 接口信息 | 52 | // 接口信息 |
| 53 | .info(buildInfo(properties)) | 53 | .info(buildInfo(properties)) |
| 54 | // 接口安全配置 | 54 | // 接口安全配置 |
| 55 | - .components(new Components().securitySchemes(securitySchemas)); | 55 | + .components(new Components().securitySchemes(securitySchemas)) |
| 56 | + .addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION)); | ||
| 56 | securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key))); | 57 | securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key))); |
| 57 | return openAPI; | 58 | return openAPI; |
| 58 | } | 59 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmTaskController.java
| @@ -47,7 +47,7 @@ public class BpmTaskController { | @@ -47,7 +47,7 @@ public class BpmTaskController { | ||
| 47 | @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true) | 47 | @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true) |
| 48 | @PreAuthorize("@ss.hasPermission('bpm:task:query')") | 48 | @PreAuthorize("@ss.hasPermission('bpm:task:query')") |
| 49 | public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( | 49 | public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( |
| 50 | - @RequestParam("processInstanceId") String processInstanceId) { | 50 | + @RequestParam("processInstanceId") String processInstanceId) { |
| 51 | return success(taskService.getTaskListByProcessInstanceId(processInstanceId)); | 51 | return success(taskService.getTaskListByProcessInstanceId(processInstanceId)); |
| 52 | } | 52 | } |
| 53 | 53 |
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java
| @@ -23,10 +23,10 @@ import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgn | @@ -23,10 +23,10 @@ import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgn | ||
| 23 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS; | 23 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS; |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | -* {@link BpmUserGroupServiceImpl} 的单元测试类 | ||
| 27 | -* | ||
| 28 | -* @author 芋道源码 | ||
| 29 | -*/ | 26 | + * {@link BpmUserGroupServiceImpl} 的单元测试类 |
| 27 | + * | ||
| 28 | + * @author 芋道源码 | ||
| 29 | + */ | ||
| 30 | @Import(BpmUserGroupServiceImpl.class) | 30 | @Import(BpmUserGroupServiceImpl.class) |
| 31 | public class BpmUserGroupServiceTest extends BaseDbUnitTest { | 31 | public class BpmUserGroupServiceTest extends BaseDbUnitTest { |
| 32 | 32 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
| @@ -149,7 +149,7 @@ public class AuthController { | @@ -149,7 +149,7 @@ public class AuthController { | ||
| 149 | @Parameter(name = "redirectUri", description = "回调路径") | 149 | @Parameter(name = "redirectUri", description = "回调路径") |
| 150 | }) | 150 | }) |
| 151 | public CommonResult<String> socialLogin(@RequestParam("type") Integer type, | 151 | public CommonResult<String> socialLogin(@RequestParam("type") Integer type, |
| 152 | - @RequestParam("redirectUri") String redirectUri) { | 152 | + @RequestParam("redirectUri") String redirectUri) { |
| 153 | return CommonResult.success(socialUserService.getAuthorizeUrl(type, redirectUri)); | 153 | return CommonResult.success(socialUserService.getAuthorizeUrl(type, redirectUri)); |
| 154 | } | 154 | } |
| 155 | 155 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthPermissionInfoRespVO.java
| @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; | @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; | ||
| 8 | 8 | ||
| 9 | import java.util.Set; | 9 | import java.util.Set; |
| 10 | 10 | ||
| 11 | -@Schema(description = "管理后台 - 登录用户的权限信息 Response VO,额外包括用户信息和角色列表") | 11 | +@Schema(description = "管理后台 - 登录用户的权限信息 Response VO,额外包括用户信息和角色列表") |
| 12 | @Data | 12 | @Data |
| 13 | @NoArgsConstructor | 13 | @NoArgsConstructor |
| 14 | @AllArgsConstructor | 14 | @AllArgsConstructor |
| @@ -37,7 +37,7 @@ public class AuthPermissionInfoRespVO { | @@ -37,7 +37,7 @@ public class AuthPermissionInfoRespVO { | ||
| 37 | @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") | 37 | @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") |
| 38 | private String nickname; | 38 | private String nickname; |
| 39 | 39 | ||
| 40 | - @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://www.iocoder.cn/xx.jpg") | 40 | + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.jpg") |
| 41 | private String avatar; | 41 | private String avatar; |
| 42 | 42 | ||
| 43 | } | 43 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogBaseVO.java
| @@ -11,9 +11,9 @@ import java.util.Map; | @@ -11,9 +11,9 @@ import java.util.Map; | ||
| 11 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 11 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | -* 邮件日志 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 15 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 16 | -*/ | 14 | + * 邮件日志 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 15 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 16 | + */ | ||
| 17 | @Data | 17 | @Data |
| 18 | public class MailLogBaseVO { | 18 | public class MailLogBaseVO { |
| 19 | 19 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.http
| @@ -40,6 +40,3 @@ tenant-id: {{adminTenentId}} | @@ -40,6 +40,3 @@ tenant-id: {{adminTenentId}} | ||
| 40 | GET {{baseUrl}}/system/role/page?pageNo=1&pageSize=10 | 40 | GET {{baseUrl}}/system/role/page?pageNo=1&pageSize=10 |
| 41 | Authorization: Bearer {{token}} | 41 | Authorization: Bearer {{token}} |
| 42 | tenant-id: {{adminTenentId}} | 42 | tenant-id: {{adminTenentId}} |
| 43 | - | ||
| 44 | -### | ||
| 45 | - |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/permission/PermissionAssignRoleDataScopeReqVO.java
| @@ -20,7 +20,7 @@ public class PermissionAssignRoleDataScopeReqVO { | @@ -20,7 +20,7 @@ public class PermissionAssignRoleDataScopeReqVO { | ||
| 20 | // TODO 这里要多一个枚举校验 | 20 | // TODO 这里要多一个枚举校验 |
| 21 | private Integer dataScope; | 21 | private Integer dataScope; |
| 22 | 22 | ||
| 23 | - @Schema(description = "部门编号列表,只有范围类型为 DEPT_CUSTOM 时,该字段才需要", example = "1,3,5") | 23 | + @Schema(description = "部门编号列表,只有范围类型为 DEPT_CUSTOM 时,该字段才需要", example = "1,3,5") |
| 24 | private Set<Long> dataScopeDeptIds = Collections.emptySet(); // 兜底 | 24 | private Set<Long> dataScopeDeptIds = Collections.emptySet(); // 兜底 |
| 25 | 25 | ||
| 26 | } | 26 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordBaseVO.java
| @@ -7,9 +7,9 @@ import javax.validation.constraints.NotNull; | @@ -7,9 +7,9 @@ import javax.validation.constraints.NotNull; | ||
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | -* 敏感词 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 11 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 12 | -*/ | 10 | + * 敏感词 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 11 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 12 | + */ | ||
| 13 | @Data | 13 | @Data |
| 14 | public class SensitiveWordBaseVO { | 14 | public class SensitiveWordBaseVO { |
| 15 | 15 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantBaseVO.java
| @@ -7,9 +7,9 @@ import javax.validation.constraints.*; | @@ -7,9 +7,9 @@ import javax.validation.constraints.*; | ||
| 7 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | -* 租户 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 11 | -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 12 | -*/ | 10 | + * 租户 Base VO,提供给添加、修改、详细的子 VO 使用 |
| 11 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 12 | + */ | ||
| 13 | @Data | 13 | @Data |
| 14 | public class TenantBaseVO { | 14 | public class TenantBaseVO { |
| 15 | 15 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java
| @@ -25,7 +25,7 @@ public class UserProfileUpdateReqVO { | @@ -25,7 +25,7 @@ public class UserProfileUpdateReqVO { | ||
| 25 | @Length(min = 11, max = 11, message = "手机号长度必须 11 位") | 25 | @Length(min = 11, max = 11, message = "手机号长度必须 11 位") |
| 26 | private String mobile; | 26 | private String mobile; |
| 27 | 27 | ||
| 28 | - @Schema(description = "用户性别-参见 SexEnum 枚举类", example = "1") | 28 | + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") |
| 29 | private Integer sex; | 29 | private Integer sex; |
| 30 | 30 | ||
| 31 | } | 31 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExportReqVO.java
| @@ -29,7 +29,7 @@ public class UserExportReqVO { | @@ -29,7 +29,7 @@ public class UserExportReqVO { | ||
| 29 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 29 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 30 | private LocalDateTime[] createTime; | 30 | private LocalDateTime[] createTime; |
| 31 | 31 | ||
| 32 | - @Schema(description = "部门编号,同时筛选子部门", example = "1024") | 32 | + @Schema(description = "部门编号,同时筛选子部门", example = "1024") |
| 33 | private Long deptId; | 33 | private Long deptId; |
| 34 | 34 | ||
| 35 | } | 35 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageItemRespVO.java
| @@ -6,7 +6,7 @@ import lombok.Data; | @@ -6,7 +6,7 @@ import lombok.Data; | ||
| 6 | import lombok.EqualsAndHashCode; | 6 | import lombok.EqualsAndHashCode; |
| 7 | import lombok.NoArgsConstructor; | 7 | import lombok.NoArgsConstructor; |
| 8 | 8 | ||
| 9 | -@Schema(description = "管理后台 - 用户分页时的信息 Response VO,相比用户基本信息来说,会多部门信息") | 9 | +@Schema(description = "管理后台 - 用户分页时的信息 Response VO,相比用户基本信息来说,会多部门信息") |
| 10 | @Data | 10 | @Data |
| 11 | @NoArgsConstructor | 11 | @NoArgsConstructor |
| 12 | @AllArgsConstructor | 12 | @AllArgsConstructor |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserUpdateStatusReqVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; | 1 | package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 5 | 7 | ||
| @@ -13,9 +15,9 @@ public class UserUpdateStatusReqVO { | @@ -13,9 +15,9 @@ public class UserUpdateStatusReqVO { | ||
| 13 | @NotNull(message = "角色编号不能为空") | 15 | @NotNull(message = "角色编号不能为空") |
| 14 | private Long id; | 16 | private Long id; |
| 15 | 17 | ||
| 16 | - @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 18 | + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 17 | @NotNull(message = "状态不能为空") | 19 | @NotNull(message = "状态不能为空") |
| 18 | -// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") | 20 | + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") |
| 19 | private Integer status; | 21 | private Integer status; |
| 20 | 22 | ||
| 21 | } | 23 | } |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceImpl.java
| @@ -197,8 +197,8 @@ public class MenuServiceImpl implements MenuService { | @@ -197,8 +197,8 @@ public class MenuServiceImpl implements MenuService { | ||
| 197 | return Collections.emptyList(); | 197 | return Collections.emptyList(); |
| 198 | } | 198 | } |
| 199 | return menuCache.values().stream().filter(menu -> menuIds.contains(menu.getId()) | 199 | return menuCache.values().stream().filter(menu -> menuIds.contains(menu.getId()) |
| 200 | - && menuTypes.contains(menu.getType()) | ||
| 201 | - && menusStatuses.contains(menu.getStatus())) | 200 | + && menuTypes.contains(menu.getType()) |
| 201 | + && menusStatuses.contains(menu.getStatus())) | ||
| 202 | .collect(Collectors.toList()); | 202 | .collect(Collectors.toList()); |
| 203 | } | 203 | } |
| 204 | 204 |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
| @@ -297,7 +297,7 @@ public class AdminUserServiceImpl implements AdminUserService { | @@ -297,7 +297,7 @@ public class AdminUserServiceImpl implements AdminUserService { | ||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | private void validateUserForCreateOrUpdate(Long id, String username, String mobile, String email, | 299 | private void validateUserForCreateOrUpdate(Long id, String username, String mobile, String email, |
| 300 | - Long deptId, Set<Long> postIds) { | 300 | + Long deptId, Set<Long> postIds) { |
| 301 | // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 | 301 | // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 |
| 302 | DataPermissionUtils.executeIgnore(() -> { | 302 | DataPermissionUtils.executeIgnore(() -> { |
| 303 | // 校验用户存在 | 303 | // 校验用户存在 |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImplTest.java
| @@ -148,7 +148,7 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | @@ -148,7 +148,7 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | ||
| 148 | ); | 148 | ); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | - @Test | 151 | + @Test |
| 152 | public void testLogin_success() { | 152 | public void testLogin_success() { |
| 153 | // 准备参数 | 153 | // 准备参数 |
| 154 | AuthLoginReqVO reqVO = randomPojo(AuthLoginReqVO.class, o -> | 154 | AuthLoginReqVO reqVO = randomPojo(AuthLoginReqVO.class, o -> |
| @@ -174,9 +174,9 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | @@ -174,9 +174,9 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | ||
| 174 | assertPojoEquals(accessTokenDO, loginRespVO); | 174 | assertPojoEquals(accessTokenDO, loginRespVO); |
| 175 | // 校验调用参数 | 175 | // 校验调用参数 |
| 176 | verify(loginLogService).createLoginLog( | 176 | verify(loginLogService).createLoginLog( |
| 177 | - argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) | ||
| 178 | - && o.getResult().equals(LoginResultEnum.SUCCESS.getResult()) | ||
| 179 | - && o.getUserId().equals(user.getId())) | 177 | + argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) |
| 178 | + && o.getResult().equals(LoginResultEnum.SUCCESS.getResult()) | ||
| 179 | + && o.getUserId().equals(user.getId())) | ||
| 180 | ); | 180 | ); |
| 181 | verify(socialUserService).bindSocialUser(eq(new SocialUserBindReqDTO( | 181 | verify(socialUserService).bindSocialUser(eq(new SocialUserBindReqDTO( |
| 182 | user.getId(), UserTypeEnum.ADMIN.getValue(), | 182 | user.getId(), UserTypeEnum.ADMIN.getValue(), |
| @@ -317,8 +317,8 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | @@ -317,8 +317,8 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | ||
| 317 | assertServiceException(() -> authService.validateCaptcha(reqVO), AUTH_LOGIN_CAPTCHA_CODE_ERROR, "就是不对"); | 317 | assertServiceException(() -> authService.validateCaptcha(reqVO), AUTH_LOGIN_CAPTCHA_CODE_ERROR, "就是不对"); |
| 318 | // 校验调用参数 | 318 | // 校验调用参数 |
| 319 | verify(loginLogService).createLoginLog( | 319 | verify(loginLogService).createLoginLog( |
| 320 | - argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) | ||
| 321 | - && o.getResult().equals(LoginResultEnum.CAPTCHA_CODE_ERROR.getResult())) | 320 | + argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) |
| 321 | + && o.getResult().equals(LoginResultEnum.CAPTCHA_CODE_ERROR.getResult())) | ||
| 322 | ); | 322 | ); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| @@ -349,8 +349,9 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | @@ -349,8 +349,9 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { | ||
| 349 | // 调用 | 349 | // 调用 |
| 350 | authService.logout(token, LoginLogTypeEnum.LOGOUT_SELF.getType()); | 350 | authService.logout(token, LoginLogTypeEnum.LOGOUT_SELF.getType()); |
| 351 | // 校验调用参数 | 351 | // 校验调用参数 |
| 352 | - verify(loginLogService).createLoginLog(argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGOUT_SELF.getType()) | ||
| 353 | - && o.getResult().equals(LoginResultEnum.SUCCESS.getResult())) | 352 | + verify(loginLogService).createLoginLog( |
| 353 | + argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGOUT_SELF.getType()) | ||
| 354 | + && o.getResult().equals(LoginResultEnum.SUCCESS.getResult())) | ||
| 354 | ); | 355 | ); |
| 355 | // 调用,并校验 | 356 | // 调用,并校验 |
| 356 | 357 |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImplTest.java
| @@ -25,10 +25,10 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | @@ -25,10 +25,10 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | ||
| 25 | import static org.junit.jupiter.api.Assertions.*; | 25 | import static org.junit.jupiter.api.Assertions.*; |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | -* {@link MailLogServiceImpl} 的单元测试类 | ||
| 29 | -* | ||
| 30 | -* @author 芋道源码 | ||
| 31 | -*/ | 28 | + * {@link MailLogServiceImpl} 的单元测试类 |
| 29 | + * | ||
| 30 | + * @author 芋道源码 | ||
| 31 | + */ | ||
| 32 | @Import(MailLogServiceImpl.class) | 32 | @Import(MailLogServiceImpl.class) |
| 33 | public class MailLogServiceImplTest extends BaseDbUnitTest { | 33 | public class MailLogServiceImplTest extends BaseDbUnitTest { |
| 34 | 34 |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImplTest.java
| @@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; | @@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| 33 | import static org.mockito.ArgumentMatchers.eq; | 33 | import static org.mockito.ArgumentMatchers.eq; |
| 34 | import static org.mockito.Mockito.*; | 34 | import static org.mockito.Mockito.*; |
| 35 | 35 | ||
| 36 | -class MailSendServiceImplTest extends BaseMockitoUnitTest { | 36 | +public class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 37 | 37 | ||
| 38 | @InjectMocks | 38 | @InjectMocks |
| 39 | private MailSendServiceImpl mailSendService; | 39 | private MailSendServiceImpl mailSendService; |
| @@ -278,16 +278,17 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { | @@ -278,16 +278,17 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { | ||
| 278 | 278 | ||
| 279 | // mock 方法(发送邮件) | 279 | // mock 方法(发送邮件) |
| 280 | String messageId = randomString(); | 280 | String messageId = randomString(); |
| 281 | - mailUtilMock.when(() -> MailUtil.send(argThat(mailAccount -> { | ||
| 282 | - assertEquals("芋艿 <7685@qq.com>", mailAccount.getFrom()); | ||
| 283 | - assertTrue(mailAccount.isAuth()); | ||
| 284 | - assertEquals(account.getUsername(), mailAccount.getUser()); | ||
| 285 | - assertEquals(account.getPassword(), mailAccount.getPass()); | ||
| 286 | - assertEquals(account.getHost(), mailAccount.getHost()); | ||
| 287 | - assertEquals(account.getPort(), mailAccount.getPort()); | ||
| 288 | - assertEquals(account.getSslEnable(), mailAccount.isSslEnable()); | ||
| 289 | - return true; | ||
| 290 | - }), eq(message.getMail()), eq(message.getTitle()), eq(message.getContent()), eq(true))) | 281 | + mailUtilMock.when(() -> MailUtil.send( |
| 282 | + argThat(mailAccount -> { | ||
| 283 | + assertEquals("芋艿 <7685@qq.com>", mailAccount.getFrom()); | ||
| 284 | + assertTrue(mailAccount.isAuth()); | ||
| 285 | + assertEquals(account.getUsername(), mailAccount.getUser()); | ||
| 286 | + assertEquals(account.getPassword(), mailAccount.getPass()); | ||
| 287 | + assertEquals(account.getHost(), mailAccount.getHost()); | ||
| 288 | + assertEquals(account.getPort(), mailAccount.getPort()); | ||
| 289 | + assertEquals(account.getSslEnable(), mailAccount.isSslEnable()); | ||
| 290 | + return true; | ||
| 291 | + }), eq(message.getMail()), eq(message.getTitle()), eq(message.getContent()), eq(true))) | ||
| 291 | .thenReturn(messageId); | 292 | .thenReturn(messageId); |
| 292 | 293 | ||
| 293 | // 调用 | 294 | // 调用 |