diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/create_tables.sql b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/create_tables.sql index 53d8594fe..c60230a4c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/resources/sql/create_tables.sql @@ -1,12 +1,12 @@ CREATE TABLE IF NOT EXISTS "infra_config" ( "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, - "group" varchar(50) NOT NULL, + "category" varchar(50) NOT NULL, "type" tinyint NOT NULL, "name" varchar(100) NOT NULL DEFAULT '', - "key" varchar(100) NOT NULL DEFAULT '', + "config_key" varchar(100) NOT NULL DEFAULT '', "value" varchar(500) NOT NULL DEFAULT '', - "sensitive" bit NOT NULL, + "visible" bit NOT NULL, "remark" varchar(500) DEFAULT NULL, "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java index 94367c55f..c8e0f2442 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.logger; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; 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.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; @@ -16,32 +16,32 @@ import java.util.List; public interface OperateLogMapper extends BaseMapperX { default PageResult selectPage(OperateLogPageReqVO reqVO, Collection userIds) { - QueryWrapperX query = new QueryWrapperX() - .likeIfPresent("module", reqVO.getModule()) - .inIfPresent("user_id", userIds) - .eqIfPresent("operate_type", reqVO.getType()) - .betweenIfPresent("start_time", reqVO.getBeginTime(), reqVO.getEndTime()); + LambdaQueryWrapperX query = new LambdaQueryWrapperX() + .likeIfPresent(OperateLogDO::getModule, reqVO.getModule()) + .inIfPresent(OperateLogDO::getUserId, userIds) + .eqIfPresent(OperateLogDO::getType, reqVO.getType()) + .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getBeginTime(), reqVO.getEndTime()); if (Boolean.TRUE.equals(reqVO.getSuccess())) { - query.eq("result_code", GlobalErrorCodeConstants.SUCCESS.getCode()); + query.eq(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } else if (Boolean.FALSE.equals(reqVO.getSuccess())) { - query.gt("result_code", GlobalErrorCodeConstants.SUCCESS.getCode()); + query.gt(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } - query.orderByDesc("id"); // 降序 + query.orderByDesc(OperateLogDO::getId); // 降序 return selectPage(reqVO, query); } default List selectList(OperateLogExportReqVO reqVO, Collection userIds) { - QueryWrapperX query = new QueryWrapperX() - .likeIfPresent("module", reqVO.getModule()) - .inIfPresent("user_id", userIds) - .eqIfPresent("operate_type", reqVO.getType()) - .betweenIfPresent("start_time", reqVO.getBeginTime(), reqVO.getEndTime()); + LambdaQueryWrapperX query = new LambdaQueryWrapperX() + .likeIfPresent(OperateLogDO::getModule, reqVO.getModule()) + .inIfPresent(OperateLogDO::getUserId, userIds) + .eqIfPresent(OperateLogDO::getType, reqVO.getType()) + .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getBeginTime(), reqVO.getEndTime()); if (Boolean.TRUE.equals(reqVO.getSuccess())) { - query.eq("result_code", GlobalErrorCodeConstants.SUCCESS.getCode()); + query.eq(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } else if (Boolean.FALSE.equals(reqVO.getSuccess())) { - query.gt("result_code", GlobalErrorCodeConstants.SUCCESS.getCode()); + query.gt(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } - query.orderByDesc("id"); // 降序 + query.orderByDesc(OperateLogDO::getId); // 降序 return selectList(query); } diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java index 5856e629a..47b767eb5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java @@ -1,5 +1,10 @@ package cn.iocoder.yudao.module.system.service.auth; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.framework.test.core.util.AssertUtils; +import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthLoginReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; @@ -8,12 +13,8 @@ import cn.iocoder.yudao.module.system.service.common.CaptchaService; import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.logger.LoginLogService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; -import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.system.service.social.SocialUserService; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.security.core.LoginUser; -import cn.iocoder.yudao.framework.test.core.util.AssertUtils; -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; @@ -30,11 +31,12 @@ import javax.annotation.Resource; import javax.validation.Validator; import java.util.Set; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static java.util.Collections.singleton; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; @@ -62,6 +64,8 @@ public class AuthServiceImplTest extends BaseDbUnitTest { private SocialUserService socialService; @MockBean private PostService postService; + @MockBean + private SmsCodeApi smsCodeApi; @MockBean private Validator validator; diff --git a/yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql b/yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql index d7dc61cd6..5cf1da35f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql +++ b/yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql @@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS "system_menu" ( "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, "name" varchar(50) NOT NULL, "permission" varchar(100) NOT NULL DEFAULT '', - "menu_type" tinyint NOT NULL, + "type" tinyint NOT NULL, "sort" int NOT NULL DEFAULT '0', "parent_id" bigint NOT NULL DEFAULT '0', "path" varchar(200) DEFAULT '', @@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS `system_operate_log` ( "user_type" tinyint not null default '0', `module` varchar(50) NOT NULL, `name` varchar(50) NOT NULL, - `operate_type` bigint(4) NOT NULL DEFAULT '0', + `type` bigint(4) NOT NULL DEFAULT '0', `content` varchar(2000) NOT NULL DEFAULT '', `exts` varchar(512) NOT NULL DEFAULT '', `request_method` varchar(16) DEFAULT '',