Просмотр исходного кода

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
YunaiV 2 лет назад
Родитель
Сommit
848e0c897f

+ 1 - 1
.github/workflows/yudao-ui-admin.yml

@@ -21,7 +21,7 @@ jobs:
 
     strategy:
       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/
 
     steps:

+ 5 - 5
sql/postgresql/ruoyi-vue-pro.sql

@@ -2493,7 +2493,7 @@ CREATE TABLE "system_login_log" (
   "id" int8 NOT NULL,
   "log_type" int8 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,
   "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
   "result" int2 NOT NULL,
@@ -2866,7 +2866,7 @@ CREATE TABLE "system_oauth2_access_token" (
   "updater" varchar(64) COLLATE "pg_catalog"."default",
   "update_time" timestamp(6) NOT NULL,
   "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
 )
 ;
@@ -2909,7 +2909,7 @@ CREATE TABLE "system_oauth2_approve" (
   "updater" varchar(64) COLLATE "pg_catalog"."default",
   "update_time" timestamp(6) NOT NULL,
   "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 '编号';
@@ -3011,7 +3011,7 @@ CREATE TABLE "system_oauth2_code" (
   "updater" varchar(64) COLLATE "pg_catalog"."default",
   "update_time" timestamp(6) NOT NULL,
   "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 '编号';
@@ -3053,7 +3053,7 @@ CREATE TABLE "system_oauth2_refresh_token" (
   "updater" varchar(64) COLLATE "pg_catalog"."default",
   "update_time" timestamp(6) NOT NULL,
   "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
 )
 ;

+ 7 - 0
yudao-framework/yudao-spring-boot-starter-biz-dict/pom.xml

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

+ 48 - 0
yudao-framework/yudao-spring-boot-starter-biz-dict/src/test/java/cn/iocoder/yudao/framework/dict/core/util/DictFrameworkUtilsTest.java

@@ -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()));
+    }
+
+}

+ 3 - 3
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/annotations/OperateLog.java

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

+ 1 - 1
yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/config/YudaoMQAutoConfiguration.java

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

+ 1 - 2
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java

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

+ 1 - 1
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/codegen/CodegenServiceImpl.java

@@ -158,7 +158,7 @@ public class CodegenServiceImpl implements CodegenService {
 
         //计算需要修改的字段,插入时重新插入,删除时将原来的删除
         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.isKeyFlag() == codegenColumn.getPrimaryKey()
                         && tableField.getComment().equals(codegenColumn.getColumnComment());

+ 4 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@@ -123,7 +123,10 @@ public class UserController {
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('system:user:query')")
     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")

+ 4 - 2
yudao-server/src/main/resources/application-dev.yaml

@@ -44,11 +44,13 @@ spring:
       primary: master
       datasource:
         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
           password: 3WLiVUBEwTbvAfsh
         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
           password: 3WLiVUBEwTbvAfsh
 

+ 2 - 2
yudao-server/src/main/resources/application-local.yaml

@@ -44,7 +44,7 @@ spring:
       primary: master
       datasource:
         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:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
           #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@@ -54,7 +54,7 @@ spring:
         #          username: sa
         #          password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
         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:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
           #          url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例