feat():集数据

master
yuan 2024-09-09 16:07:07 +08:00
parent 09c8a33046
commit 1fe0c92da7
3 changed files with 82 additions and 3 deletions

View File

@ -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
* @Packagecom.muyu.remote.feign
* @Projectcloud-integration-
* @nameBigDataFeignService
* @Date2024/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);
}

View File

@ -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
* @Packagecom.muyu.remote.feign.factory
* @Projectcloud-integration-
* @nameBigDataFeignFactory
* @Date2024/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());
}
};
}
}

View File

@ -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