feat():集数据
parent
09c8a33046
commit
1fe0c92da7
|
@ -0,0 +1,40 @@
|
|||
package com.muyu.remote.feign;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.DataName;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
import com.muyu.remote.feign.factory.BigDataFeignFactory;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.remote.feign
|
||||
* @Project:cloud-integration-
|
||||
* @name:BigDataFeignService
|
||||
* @Date:2024/8/29 20:10
|
||||
*/
|
||||
@FeignClient(name = "cloud-property",fallbackFactory = BigDataFeignFactory.class)
|
||||
public interface BigDataFeignService {
|
||||
/**
|
||||
* 连接数据库获取当前所有的数据库名称
|
||||
* @return 所有数据库以及所有表的结果集
|
||||
*/
|
||||
@PostMapping("/dataRunName/extractDataName")
|
||||
@Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集")
|
||||
public Result<List<DataName>> getDatabase();
|
||||
|
||||
/**
|
||||
* 功能:根据表名查询所有字段信息
|
||||
* @param tableName 表名
|
||||
* @return 字段集合
|
||||
*/
|
||||
@PostMapping("/tableField/selectByTableName")
|
||||
@Operation(summary = "根据表名获取所有字段")
|
||||
public Result<List<TableFie>> selectByName(@RequestParam("tableName") String tableName);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.remote.feign.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.domain.DataName;
|
||||
import com.muyu.common.domain.TableFie;
|
||||
import com.muyu.remote.feign.BigDataFeignService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.remote.feign.factory
|
||||
* @Project:cloud-integration-
|
||||
* @name:BigDataFeignFactory
|
||||
* @Date:2024/8/29 20:10
|
||||
*/
|
||||
@Component
|
||||
public class BigDataFeignFactory implements FallbackFactory<BigDataFeignService> {
|
||||
|
||||
|
||||
@Override
|
||||
public BigDataFeignService create(Throwable cause) {
|
||||
return new BigDataFeignService() {
|
||||
@Override
|
||||
public Result<List<DataName>> getDatabase() {
|
||||
throw new RuntimeException(cause.getCause());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<List<TableFie>> selectByName(String tableName) {
|
||||
throw new RuntimeException(cause.getCause());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.muyu.constant.MethodSuffix;
|
|||
import com.muyu.engine.basic.BasicEngine;
|
||||
import com.muyu.load.OSSFileLoad;
|
||||
import com.muyu.mapper.RuleVersionMapper;
|
||||
import com.muyu.remote.feign.BigDataFeignService;
|
||||
import com.muyu.remote.feign.SelectFeignService;
|
||||
import com.muyu.servier.RuleDataService;
|
||||
import com.muyu.servier.RuleVersionService;
|
||||
|
@ -45,6 +46,7 @@ public class RuleVersionServiceImpl
|
|||
@Autowired private RuleVersionMapper ruleVersionMapper;
|
||||
@Autowired private RuleDataService ruleDataService;
|
||||
@Autowired private SelectFeignService selectFeignService;
|
||||
@Autowired private BigDataFeignService bigDataFeignService;
|
||||
|
||||
public static final String ClassPath = "/home/lib/com/muyu/generate/";
|
||||
|
||||
|
@ -150,9 +152,9 @@ public class RuleVersionServiceImpl
|
|||
|
||||
@Override
|
||||
public List<DataName> selectDatabase() {
|
||||
Result<List<DataName>> listResult = selectFeignService.extractDataName();
|
||||
log.info("查询数据库数据:[{}]",listResult.getData());
|
||||
return listResult.getData();
|
||||
Result<List<DataName>> database = bigDataFeignService.getDatabase();
|
||||
log.info("查询数据库数据:[{}]",database.getData());
|
||||
return database.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue