Commit 859cf74a6c9ad609cbf68c6ae82cdcb242e581eb
1 parent
21b37445
对齐 boot 与 cloud 的代码
Showing
25 changed files
with
63 additions
and
95 deletions
README.md
yudao-dependencies/pom.xml
| ... | ... | @@ -216,10 +216,9 @@ |
| 216 | 216 | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> |
| 217 | 217 | <version>${dynamic-datasource.version}</version> |
| 218 | 218 | </dependency> |
| 219 | - | |
| 220 | 219 | <dependency> |
| 221 | 220 | <groupId>com.github.yulichang</groupId> |
| 222 | - <artifactId>mybatis-plus-join-boot-starter</artifactId> | |
| 221 | + <artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 --> | |
| 223 | 222 | <version>${mybatis-plus-join-boot-starter.version}</version> |
| 224 | 223 | </dependency> |
| 225 | 224 | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
| ... | ... | @@ -64,9 +64,8 @@ |
| 64 | 64 | |
| 65 | 65 | <dependency> |
| 66 | 66 | <groupId>com.github.yulichang</groupId> |
| 67 | - <artifactId>mybatis-plus-join-boot-starter</artifactId> | |
| 67 | + <artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 --> | |
| 68 | 68 | </dependency> |
| 69 | - | |
| 70 | 69 | </dependencies> |
| 71 | 70 | |
| 72 | 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 | 6 | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| 7 | 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 8 | 8 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 9 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 9 | 10 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 10 | 11 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| 11 | 12 | import com.baomidou.mybatisplus.extension.toolkit.Db; |
| 12 | -import com.github.yulichang.base.MPJBaseMapper; | |
| 13 | 13 | import org.apache.ibatis.annotations.Param; |
| 14 | 14 | |
| 15 | 15 | import java.util.Collection; |
| ... | ... | @@ -17,10 +17,8 @@ import java.util.List; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 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 | 23 | default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) { |
| 26 | 24 | // MyBatis Plus 查询 |
| ... | ... | @@ -46,18 +44,6 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { |
| 46 | 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 | 47 | default Long selectCount() { |
| 62 | 48 | return selectCount(new QueryWrapper<T>()); |
| 63 | 49 | } |
| ... | ... | @@ -117,26 +103,8 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { |
| 117 | 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 | 106 | default void updateBatch(Collection<T> entities, int size) { |
| 130 | 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 | 60 | /** |
| 61 | 61 | * 自定义的权限映射 Bean 们 |
| 62 | 62 | * |
| 63 | - * @see #configure(HttpSecurity) | |
| 63 | + * @see #filterChain(HttpSecurity) | |
| 64 | 64 | */ |
| 65 | 65 | @Resource |
| 66 | 66 | private List<AuthorizeRequestsCustomizer> authorizeRequestsCustomizers; |
| ... | ... | @@ -79,7 +79,7 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * 配置 URL 的安全配置 |
| 82 | - * <p> | |
| 82 | + * | |
| 83 | 83 | * anyRequest | 匹配所有请求路径 |
| 84 | 84 | * access | SpringEl表达式结果为true时可以访问 |
| 85 | 85 | * anonymous | 匿名可以访问 |
| ... | ... | @@ -141,7 +141,6 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 141 | 141 | |
| 142 | 142 | // 添加 Token Filter |
| 143 | 143 | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| 144 | - | |
| 145 | 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 | 40 | |
| 41 | 41 | // Redis 配置类 |
| 42 | 42 | RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer |
| 43 | +// RedisAutoConfiguration.class, // Spring Redis 自动配置类 | |
| 43 | 44 | YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 |
| 44 | 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 | 52 | // 接口信息 |
| 53 | 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 | 57 | securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key))); |
| 57 | 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 | 47 | @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true) |
| 48 | 48 | @PreAuthorize("@ss.hasPermission('bpm:task:query')") |
| 49 | 49 | public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( |
| 50 | - @RequestParam("processInstanceId") String processInstanceId) { | |
| 50 | + @RequestParam("processInstanceId") String processInstanceId) { | |
| 51 | 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 | 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 | 30 | @Import(BpmUserGroupServiceImpl.class) |
| 31 | 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 | 149 | @Parameter(name = "redirectUri", description = "回调路径") |
| 150 | 150 | }) |
| 151 | 151 | public CommonResult<String> socialLogin(@RequestParam("type") Integer type, |
| 152 | - @RequestParam("redirectUri") String redirectUri) { | |
| 152 | + @RequestParam("redirectUri") String redirectUri) { | |
| 153 | 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 | 8 | |
| 9 | 9 | import java.util.Set; |
| 10 | 10 | |
| 11 | -@Schema(description = "管理后台 - 登录用户的权限信息 Response VO,额外包括用户信息和角色列表") | |
| 11 | +@Schema(description = "管理后台 - 登录用户的权限信息 Response VO,额外包括用户信息和角色列表") | |
| 12 | 12 | @Data |
| 13 | 13 | @NoArgsConstructor |
| 14 | 14 | @AllArgsConstructor |
| ... | ... | @@ -37,7 +37,7 @@ public class AuthPermissionInfoRespVO { |
| 37 | 37 | @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") |
| 38 | 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 | 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 | 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 | 17 | @Data |
| 18 | 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
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 | 20 | // TODO 这里要多一个枚举校验 |
| 21 | 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 | 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 | 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 | 13 | @Data |
| 14 | 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 | 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 | 13 | @Data |
| 14 | 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 | 25 | @Length(min = 11, max = 11, message = "手机号长度必须 11 位") |
| 26 | 26 | private String mobile; |
| 27 | 27 | |
| 28 | - @Schema(description = "用户性别-参见 SexEnum 枚举类", example = "1") | |
| 28 | + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") | |
| 29 | 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 | 29 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 30 | 30 | private LocalDateTime[] createTime; |
| 31 | 31 | |
| 32 | - @Schema(description = "部门编号,同时筛选子部门", example = "1024") | |
| 32 | + @Schema(description = "部门编号,同时筛选子部门", example = "1024") | |
| 33 | 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 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.NoArgsConstructor; |
| 8 | 8 | |
| 9 | -@Schema(description = "管理后台 - 用户分页时的信息 Response VO,相比用户基本信息来说,会多部门信息") | |
| 9 | +@Schema(description = "管理后台 - 用户分页时的信息 Response VO,相比用户基本信息来说,会多部门信息") | |
| 10 | 10 | @Data |
| 11 | 11 | @NoArgsConstructor |
| 12 | 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 | 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 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 6 | import lombok.Data; |
| 5 | 7 | |
| ... | ... | @@ -13,9 +15,9 @@ public class UserUpdateStatusReqVO { |
| 13 | 15 | @NotNull(message = "角色编号不能为空") |
| 14 | 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 | 19 | @NotNull(message = "状态不能为空") |
| 18 | -// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") | |
| 20 | + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") | |
| 19 | 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 | 197 | return Collections.emptyList(); |
| 198 | 198 | } |
| 199 | 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 | 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 | 297 | } |
| 298 | 298 | |
| 299 | 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 | 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 | 148 | ); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - @Test | |
| 151 | + @Test | |
| 152 | 152 | public void testLogin_success() { |
| 153 | 153 | // 准备参数 |
| 154 | 154 | AuthLoginReqVO reqVO = randomPojo(AuthLoginReqVO.class, o -> |
| ... | ... | @@ -174,9 +174,9 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { |
| 174 | 174 | assertPojoEquals(accessTokenDO, loginRespVO); |
| 175 | 175 | // 校验调用参数 |
| 176 | 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 | 181 | verify(socialUserService).bindSocialUser(eq(new SocialUserBindReqDTO( |
| 182 | 182 | user.getId(), UserTypeEnum.ADMIN.getValue(), |
| ... | ... | @@ -317,8 +317,8 @@ public class AdminAuthServiceImplTest extends BaseDbUnitTest { |
| 317 | 317 | assertServiceException(() -> authService.validateCaptcha(reqVO), AUTH_LOGIN_CAPTCHA_CODE_ERROR, "就是不对"); |
| 318 | 318 | // 校验调用参数 |
| 319 | 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 | 349 | // 调用 |
| 350 | 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 | 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 | 32 | @Import(MailLogServiceImpl.class) |
| 33 | 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 | 33 | import static org.mockito.ArgumentMatchers.eq; |
| 34 | 34 | import static org.mockito.Mockito.*; |
| 35 | 35 | |
| 36 | -class MailSendServiceImplTest extends BaseMockitoUnitTest { | |
| 36 | +public class MailSendServiceImplTest extends BaseMockitoUnitTest { | |
| 37 | 37 | |
| 38 | 38 | @InjectMocks |
| 39 | 39 | private MailSendServiceImpl mailSendService; |
| ... | ... | @@ -278,16 +278,17 @@ class MailSendServiceImplTest extends BaseMockitoUnitTest { |
| 278 | 278 | |
| 279 | 279 | // mock 方法(发送邮件) |
| 280 | 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 | 292 | .thenReturn(messageId); |
| 292 | 293 | |
| 293 | 294 | // 调用 | ... | ... |