Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/dev-yunai

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
#	yudao-server/src/main/resources/application-dev.yaml
#	yudao-server/src/main/resources/application-local.yaml
This commit is contained in:
YunaiV 2023-03-02 23:54:37 +08:00
commit 848e0c897f
11 changed files with 77 additions and 18 deletions

View File

@ -21,7 +21,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [14.x, 16.x] node_version: [14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:

View File

@ -2493,7 +2493,7 @@ CREATE TABLE "system_login_log" (
"id" int8 NOT NULL, "id" int8 NOT NULL,
"log_type" int8 NOT NULL, "log_type" int8 NOT NULL,
"trace_id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, "trace_id" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
"user_id" int8 NOT NULL, "user_id" int8 NOT NULL DEFAULT 0,
"user_type" int2 NOT NULL, "user_type" int2 NOT NULL,
"username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"result" int2 NOT NULL, "result" int2 NOT NULL,
@ -2866,7 +2866,7 @@ CREATE TABLE "system_oauth2_access_token" (
"updater" varchar(64) COLLATE "pg_catalog"."default", "updater" varchar(64) COLLATE "pg_catalog"."default",
"update_time" timestamp(6) NOT NULL, "update_time" timestamp(6) NOT NULL,
"deleted" int2 NOT NULL DEFAULT 0, "deleted" int2 NOT NULL DEFAULT 0,
"tenant_id" int8 NOT NULL, "tenant_id" int8 NOT NULL DEFAULT 0,
"scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying
) )
; ;
@ -2909,7 +2909,7 @@ CREATE TABLE "system_oauth2_approve" (
"updater" varchar(64) COLLATE "pg_catalog"."default", "updater" varchar(64) COLLATE "pg_catalog"."default",
"update_time" timestamp(6) NOT NULL, "update_time" timestamp(6) NOT NULL,
"deleted" int2 NOT NULL DEFAULT 0, "deleted" int2 NOT NULL DEFAULT 0,
"tenant_id" int8 NOT NULL "tenant_id" int8 NOT NULL DEFAULT 0
) )
; ;
COMMENT ON COLUMN "system_oauth2_approve"."id" IS '编号'; COMMENT ON COLUMN "system_oauth2_approve"."id" IS '编号';
@ -3011,7 +3011,7 @@ CREATE TABLE "system_oauth2_code" (
"updater" varchar(64) COLLATE "pg_catalog"."default", "updater" varchar(64) COLLATE "pg_catalog"."default",
"update_time" timestamp(6) NOT NULL, "update_time" timestamp(6) NOT NULL,
"deleted" int2 NOT NULL DEFAULT 0, "deleted" int2 NOT NULL DEFAULT 0,
"tenant_id" int8 NOT NULL "tenant_id" int8 NOT NULL DEFAULT 0
) )
; ;
COMMENT ON COLUMN "system_oauth2_code"."id" IS '编号'; COMMENT ON COLUMN "system_oauth2_code"."id" IS '编号';
@ -3053,7 +3053,7 @@ CREATE TABLE "system_oauth2_refresh_token" (
"updater" varchar(64) COLLATE "pg_catalog"."default", "updater" varchar(64) COLLATE "pg_catalog"."default",
"update_time" timestamp(6) NOT NULL, "update_time" timestamp(6) NOT NULL,
"deleted" int2 NOT NULL DEFAULT 0, "deleted" int2 NOT NULL DEFAULT 0,
"tenant_id" int8 NOT NULL, "tenant_id" int8 NOT NULL DEFAULT 0,
"scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying "scopes" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying
) )
; ;

View File

@ -39,5 +39,12 @@
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
</dependency> </dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.framework.dict.core.util;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;
/**
* {@link DictFrameworkUtils} 的单元测试
*/
public class DictFrameworkUtilsTest extends BaseMockitoUnitTest {
@Mock
private DictDataApi dictDataApi;
@BeforeEach
public void setUp() {
DictFrameworkUtils.init(dictDataApi);
}
@Test
public void testGetDictDataLabel() {
// mock 数据
DictDataRespDTO dataRespDTO = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
// mock 方法
when(dictDataApi.getDictData(dataRespDTO.getDictType(), dataRespDTO.getValue())).thenReturn(dataRespDTO);
// 断言返回值
assertEquals(dataRespDTO.getLabel(), DictFrameworkUtils.getDictDataLabel(dataRespDTO.getDictType(), dataRespDTO.getValue()));
}
@Test
public void testParseDictDataValue() {
// mock 数据
DictDataRespDTO resp = randomPojo(DictDataRespDTO.class, o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()));
// mock 方法
when(dictDataApi.parseDictData(resp.getDictType(), resp.getLabel())).thenReturn(resp);
// 断言返回值
assertEquals(resp.getValue(), DictFrameworkUtils.parseDictDataValue(resp.getDictType(), resp.getLabel()));
}
}

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.framework.operatelog.core.annotations; package cn.iocoder.yudao.framework.operatelog.core.annotations;
import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum; import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@ -23,13 +23,13 @@ public @interface OperateLog {
/** /**
* 操作模块 * 操作模块
* *
* 为空时会尝试读取 {@link Api#value()} 属性 * 为空时会尝试读取 {@link Tag#name()} 属性
*/ */
String module() default ""; String module() default "";
/** /**
* 操作名 * 操作名
* *
* 为空时会尝试读取 {@link ApiOperation#value()} 属性 * 为空时会尝试读取 {@link Operation#summary()} 属性
*/ */
String name() default ""; String name() default "";
/** /**

View File

@ -56,7 +56,7 @@ public class YudaoMQAutoConfiguration {
/** /**
* 创建 Redis Pub/Sub 广播消费的容器 * 创建 Redis Pub/Sub 广播消费的容器
*/ */
@Bean @Bean(initMethod = "start", destroyMethod = "stop")
public RedisMessageListenerContainer redisMessageListenerContainer( public RedisMessageListenerContainer redisMessageListenerContainer(
RedisMQTemplate redisMQTemplate, List<AbstractChannelMessageListener<?>> listeners) { RedisMQTemplate redisMQTemplate, List<AbstractChannelMessageListener<?>> listeners) {
// 创建 RedisMessageListenerContainer 对象 // 创建 RedisMessageListenerContainer 对象

View File

@ -52,8 +52,7 @@ public class YudaoSwaggerAutoConfiguration {
// 接口信息 // 接口信息
.info(buildInfo(properties)) .info(buildInfo(properties))
// 接口安全配置 // 接口安全配置
.components(new Components().securitySchemes(securitySchemas)) .components(new Components().securitySchemes(securitySchemas));
.addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION));
securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key))); securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key)));
return openAPI; return openAPI;
} }

View File

@ -158,7 +158,7 @@ public class CodegenServiceImpl implements CodegenService {
//计算需要修改的字段插入时重新插入删除时将原来的删除 //计算需要修改的字段插入时重新插入删除时将原来的删除
BiPredicate<TableField, CodegenColumnDO> pr = BiPredicate<TableField, CodegenColumnDO> pr =
(tableField, codegenColumn) -> tableField.getType().equals(codegenColumn.getDataType()) (tableField, codegenColumn) -> tableField.getMetaInfo().getJdbcType().name().equals(codegenColumn.getDataType())
&& tableField.getMetaInfo().isNullable() == codegenColumn.getNullable() && tableField.getMetaInfo().isNullable() == codegenColumn.getNullable()
&& tableField.isKeyFlag() == codegenColumn.getPrimaryKey() && tableField.isKeyFlag() == codegenColumn.getPrimaryKey()
&& tableField.getComment().equals(codegenColumn.getColumnComment()); && tableField.getComment().equals(codegenColumn.getColumnComment());

View File

@ -123,7 +123,10 @@ public class UserController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:user:query')") @PreAuthorize("@ss.hasPermission('system:user:query')")
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) { public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
return success(UserConvert.INSTANCE.convert(userService.getUser(id))); AdminUserDO user = userService.getUser(id);
// 获得部门数据
DeptDO dept = deptService.getDept(user.getDeptId());
return success(UserConvert.INSTANCE.convert(user).setDept(UserConvert.INSTANCE.convert(dept)));
} }
@GetMapping("/export") @GetMapping("/export")

View File

@ -44,11 +44,13 @@ spring:
primary: master primary: master
datasource: datasource:
master: master:
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://400-infra.server.iocoder.cn:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: 3WLiVUBEwTbvAfsh password: 3WLiVUBEwTbvAfsh
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改 slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
url: jdbc:mysql://400-infra.server.iocoder.cn:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://400-infra.server.iocoder.cn:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=CTT&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: 3WLiVUBEwTbvAfsh password: 3WLiVUBEwTbvAfsh

View File

@ -44,7 +44,7 @@ spring:
primary: master primary: master
datasource: datasource:
master: master:
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro-master?useSSL=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true # MySQL Connector/J 8.X 连接的示例 url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro-master?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro-master?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro-master?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@ -54,7 +54,7 @@ spring:
# username: sa # username: sa
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
slave: # 模拟从库,可根据自己需要修改 slave: # 模拟从库,可根据自己需要修改
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true # MySQL Connector/J 8.X 连接的示例 url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例