Bläddra i källkod

增加gen远程调用模块

shiqian 4 år sedan
förälder
incheckning
d5de1dbb7b

+ 34 - 0
boman-api/boman-api-gen/pom.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>boman-api</artifactId>
+        <groupId>com.boman</groupId>
+        <version>2.5.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>boman-api-ge</artifactId>
+
+    <description>
+        boman-api-gen生成代码接口模块
+    </description>
+
+    <dependencies>
+
+        <!-- RuoYi Common Core-->
+        <dependency>
+            <groupId>com.boman</groupId>
+            <artifactId>boman-common-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.boman</groupId>
+            <artifactId>boman-modules-gen</artifactId>
+            <version>2.5.0</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 29 - 0
boman-api/boman-api-gen/src/main/java/com/boman/gen/api/RemoteGenTableService.java

@@ -0,0 +1,29 @@
+package com.boman.gen.api;
+
+import com.boman.common.core.constant.ServiceNameConstants;
+import com.boman.gen.domain.GenTable;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+
+/**
+ * 生成代码模块,远程调用入口,如需其他接口,在此添加
+ *
+ * @author shiqian
+ * @date 2021年04月06日 14:22
+ **/
+@FeignClient(contextId = "remoteGenTableService", value = ServiceNameConstants.GEN_SERVICE)
+public interface RemoteGenTableService {
+
+
+    /**
+     * 功能描述: 通过表名查找表信息
+     *
+     * @param tableName tableName
+     * @return GenTable
+     */
+    @GetMapping(value = "/gen/table/{tableName}")
+    GenTable getByTableName(@PathVariable("tableName") String tableName);
+
+
+}

+ 1 - 0
boman-api/pom.xml

@@ -10,6 +10,7 @@
 
 
     <modules>
     <modules>
         <module>boman-api-system</module>
         <module>boman-api-system</module>
+        <module>boman-api-gen</module>
     </modules>
     </modules>
 
 
     <artifactId>boman-api</artifactId>
     <artifactId>boman-api</artifactId>

+ 11 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/controller/GenController.java

@@ -95,6 +95,17 @@ public class GenController extends BaseController {
         return dataInfo;
         return dataInfo;
     }
     }
 
 
+    /**
+     * 功能描述: 根据表名查询表信息
+     *
+     * @param tableName tableName
+     * @return GenTable
+     */
+    @GetMapping(value = "/table/{tableName}")
+    public GenTable getByTableName(@PathVariable String tableName) {
+        return genTableService.selectGenTableByName(tableName);
+    }
+
     /**
     /**
      * 导入表结构(保存)
      * 导入表结构(保存)
      */
      */

+ 7 - 0
boman-modules/boman-system/pom.xml

@@ -96,6 +96,13 @@
             <version>1.18.4</version>
             <version>1.18.4</version>
         </dependency>
         </dependency>
 
 
+<!--        远程调用-->
+        <dependency>
+            <groupId>com.boman</groupId>
+            <artifactId>boman-api-gen</artifactId>
+            <version>2.5.0</version>
+        </dependency>
+
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 3 - 3
boman-modules/boman-system/src/main/java/com/boman/system/common/TableServiceCmdService.java

@@ -9,11 +9,11 @@ import com.boman.common.core.utils.obj.ObjectUtils;
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.common.redis.RedisKey;
 import com.boman.common.redis.RedisKey;
 import com.boman.common.redis.service.RedisService;
 import com.boman.common.redis.service.RedisService;
+import com.boman.gen.api.RemoteGenTableService;
 import com.boman.gen.controller.MyController;
 import com.boman.gen.controller.MyController;
 import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.gen.domain.GenTableRelation;
 import com.boman.gen.domain.GenTableRelation;
-import com.boman.gen.service.IGenTableService;
 import com.boman.system.domain.SysDictData;
 import com.boman.system.domain.SysDictData;
 import com.boman.system.service.*;
 import com.boman.system.service.*;
 import com.boman.system.utils.IdUtils;
 import com.boman.system.utils.IdUtils;
@@ -59,7 +59,7 @@ public class TableServiceCmdService {
     @Resource
     @Resource
     private  ISysDictTypeService dictTypeService;
     private  ISysDictTypeService dictTypeService;
     @Resource
     @Resource
-    private IGenTableService genTableService;
+    private RemoteGenTableService remoteGenTableService;
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
     private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
 
 
@@ -506,7 +506,7 @@ public class TableServiceCmdService {
         String key = requireNonNull(redisKeyPrefix) + requireNonNull(tableName);
         String key = requireNonNull(redisKeyPrefix) + requireNonNull(tableName);
         GenTable genTable = redisService.getCacheObject(key);
         GenTable genTable = redisService.getCacheObject(key);
         if (ObjectUtils.isEmpty(genTable)) {
         if (ObjectUtils.isEmpty(genTable)) {
-            genTable = genTableService.selectGenTableByName(tableName);
+            genTable = remoteGenTableService.getByTableName(tableName);
             requireNonNull(genTable, "未找到表对应的信息");
             requireNonNull(genTable, "未找到表对应的信息");
             // {@link com.boman.gen.controller.MyController.packTableAndInsertToRedis} 失效时间
             // {@link com.boman.gen.controller.MyController.packTableAndInsertToRedis} 失效时间
             redisService.setCacheObject(key, genTable, 12L, TimeUnit.DAYS);
             redisService.setCacheObject(key, genTable, 12L, TimeUnit.DAYS);