fix:修复规则引擎版本bug
parent
7615d0401c
commit
c7d2206009
|
@ -22,5 +22,11 @@
|
||||||
<artifactId>muyu-data-source-remote</artifactId>
|
<artifactId>muyu-data-source-remote</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule_engine-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,22 @@
|
||||||
package com.muyu.data.source.client.config;
|
package com.muyu.data.source.client.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.Children;
|
||||||
|
import com.muyu.data.source.domain.DataSource;
|
||||||
|
import com.muyu.data.source.domain.DatabaseType;
|
||||||
|
import com.muyu.data.source.remote.RemoteChildrenService;
|
||||||
|
import com.muyu.data.source.remote.RemoteDataSourceService;
|
||||||
|
import com.muyu.data.source.remote.RemoteDataTypeService;
|
||||||
|
import com.muyu.ruleEngine.model.DataModel;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
@ -12,5 +29,57 @@ import org.springframework.context.annotation.Import;
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@Import(value = {SourceClientRunner.class})
|
@Import(value = {SourceClientRunner.class})
|
||||||
public class SourceClientConfig {
|
public class SourceClientConfig {
|
||||||
|
@Autowired
|
||||||
|
private RemoteDataSourceService remoteDataSourceService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteDataTypeService remoteDataTypeService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteChildrenService remoteChildrenService;
|
||||||
|
|
||||||
|
|
||||||
|
public List<List<DataModel>> getDataModel(Long id) {
|
||||||
|
List<List<DataModel>> list=new ArrayList<>();
|
||||||
|
Result<Children> childrenResult = remoteChildrenService.selectChildren(id);
|
||||||
|
Children children = childrenResult.getData();
|
||||||
|
Result<DataSource> dataSourceResult = remoteDataSourceService.getDataSourceById(children.getAssetId());
|
||||||
|
DataSource dataSource = dataSourceResult.getData();
|
||||||
|
Result<DatabaseType> databaseTypeResult = remoteDataTypeService.getDataType(dataSource.getDataType());
|
||||||
|
DatabaseType databaseType = databaseTypeResult.getData();
|
||||||
|
String jdbcUrl=databaseType.getUrlPre()+dataSource.getHost()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName()+"?"+dataSource.getConnectionParam();
|
||||||
|
String sql="";
|
||||||
|
if ("mysql".equals(dataSource.getDataType())){
|
||||||
|
sql="select * from" +children.getName();
|
||||||
|
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Class.forName(databaseType.getDriverManager());
|
||||||
|
Connection connection = DriverManager.getConnection(jdbcUrl, dataSource.getUser(), dataSource.getPassword());
|
||||||
|
PreparedStatement ps = connection.prepareStatement(sql);
|
||||||
|
ResultSet rs = ps.executeQuery();
|
||||||
|
ResultSetMetaData metaData = rs.getMetaData();
|
||||||
|
List<DataModel> dataModelList = new ArrayList<>();
|
||||||
|
while (rs.next()){
|
||||||
|
for (int i = 1; i<= metaData.getColumnCount(); i++) {
|
||||||
|
String columnName = metaData.getColumnName(i);
|
||||||
|
Object value = rs.getObject(i);
|
||||||
|
String columnTypeName = metaData.getColumnTypeName(i);
|
||||||
|
String columnClassName = metaData.getColumnClassName(i);
|
||||||
|
DataModel dataModel = DataModel.builder()
|
||||||
|
.key(columnName)
|
||||||
|
.value(value)
|
||||||
|
.sourceType(columnTypeName)
|
||||||
|
.processType(columnClassName)
|
||||||
|
.processClass(Class.forName(columnClassName))
|
||||||
|
.build();
|
||||||
|
dataModelList.add(dataModel);
|
||||||
|
}
|
||||||
|
list.add(dataModelList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,25 +43,25 @@ public class SourceClientRunner implements ApplicationRunner {
|
||||||
DatabaseType databaseType = databaseTypeResult.getData();
|
DatabaseType databaseType = databaseTypeResult.getData();
|
||||||
DataSourceConfig.init(dataSource,databaseType);
|
DataSourceConfig.init(dataSource,databaseType);
|
||||||
});
|
});
|
||||||
Long key = dataSourceList.get(0).getId();
|
// Long key = dataSourceList.get(0).getId();
|
||||||
log.info("查看连接池");
|
// log.info("查看连接池");
|
||||||
DataSourceConfig.size(key);
|
// DataSourceConfig.size(key);
|
||||||
Thread.sleep(500);
|
// Thread.sleep(500);
|
||||||
log.info("取出一个连接,查看连接池");
|
// log.info("取出一个连接,查看连接池");
|
||||||
Connection connection = DataSourceConfig.getConnection(key);
|
// Connection connection = DataSourceConfig.getConnection(key);
|
||||||
DataSourceConfig.size(key);
|
// DataSourceConfig.size(key);
|
||||||
Thread.sleep(500);
|
// Thread.sleep(500);
|
||||||
JDBCConcreteClass jdbcConcreteClass = new JDBCConcreteClass();
|
// JDBCConcreteClass jdbcConcreteClass = new JDBCConcreteClass();
|
||||||
ResultSet resultSet = jdbcConcreteClass.getResultSet(connection, "select * from engine_maintenance");
|
// ResultSet resultSet = jdbcConcreteClass.getResultSet(connection, "select * from engine_maintenance");
|
||||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
// ResultSetMetaData metaData = resultSet.getMetaData();
|
||||||
for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
// for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
||||||
log.info("字段名称:{}",metaData.getColumnClassName(i));
|
// log.info("字段名称:{}",metaData.getColumnClassName(i));
|
||||||
log.info("数据库类型:{}",metaData.getColumnTypeName(i));
|
// log.info("数据库类型:{}",metaData.getColumnTypeName(i));
|
||||||
log.info("java类型:{}",metaData.getColumnClassName(i));
|
// log.info("java类型:{}",metaData.getColumnClassName(i));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
log.info("返回一个连接,查看连接池");
|
// log.info("返回一个连接,查看连接池");
|
||||||
DataSourceConfig.returnConn(connection);
|
// DataSourceConfig.returnConn(connection);
|
||||||
DataSourceConfig.size(key);
|
// DataSourceConfig.size(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.data.source.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.Children;
|
||||||
|
import com.muyu.data.source.remote.factory.RemoteChildrenFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型远程调用
|
||||||
|
*
|
||||||
|
* @author CHX
|
||||||
|
* on 2024/5/10 星期五
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "RemoteChildrenService",
|
||||||
|
value = ServiceNameConstants.SOURCE_SERVICE,
|
||||||
|
fallbackFactory = RemoteChildrenFactory.class,
|
||||||
|
path = "/children"
|
||||||
|
)
|
||||||
|
public interface RemoteChildrenService {
|
||||||
|
@GetMapping("/selectChildren/{id}")
|
||||||
|
public Result<Children> selectChildren(@PathVariable("id") Long id);
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import com.muyu.data.source.remote.factory.RemoteDataSourceFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源远程调用
|
* 数据源远程调用
|
||||||
|
@ -24,4 +25,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
public interface RemoteDataSourceService {
|
public interface RemoteDataSourceService {
|
||||||
@GetMapping("getDataSourceList/")
|
@GetMapping("getDataSourceList/")
|
||||||
public Result<List<DataSource>> getDataSourceList();
|
public Result<List<DataSource>> getDataSourceList();
|
||||||
|
|
||||||
|
@GetMapping("/getDataSourceById/{id}")
|
||||||
|
public Result<DataSource> getDataSourceById(@PathVariable("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.data.source.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.Children;
|
||||||
|
import com.muyu.data.source.remote.RemoteChildrenService;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 熔断
|
||||||
|
*
|
||||||
|
* @author CHX
|
||||||
|
* on 2024/5/10 星期五
|
||||||
|
*/
|
||||||
|
public class RemoteChildrenFactory implements FallbackFactory<RemoteChildrenService> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteChildrenService create(Throwable cause) {
|
||||||
|
return new RemoteChildrenService() {
|
||||||
|
@Override
|
||||||
|
public Result<Children> selectChildren(Long id) {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,11 @@ public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSource
|
||||||
public Result<List<DataSource>> getDataSourceList() {
|
public Result<List<DataSource>> getDataSourceList() {
|
||||||
return Result.error(cause.getMessage());
|
return Result.error(cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<DataSource> getDataSourceById(Long id) {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
com.muyu.data.source.remote.factory.RemoteDataSourceFactory
|
com.muyu.data.source.remote.factory.RemoteDataSourceFactory
|
||||||
com.muyu.data.source.remote.factory.RemoteDataTypeFactory
|
com.muyu.data.source.remote.factory.RemoteDataTypeFactory
|
||||||
|
com.muyu.data.source.remote.factory.RemoteChildrenFactory
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package com.muyu.data.source.controller;
|
package com.muyu.data.source.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.data.source.domain.Children;
|
||||||
|
import com.muyu.data.source.service.ChildrenService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -15,4 +21,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@RequestMapping("/children")
|
@RequestMapping("/children")
|
||||||
public class ChildrenController {
|
public class ChildrenController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChildrenService childrenService;
|
||||||
|
|
||||||
|
@GetMapping("/selectChildren/{id}")
|
||||||
|
public Result<Children> selectChildren(@PathVariable("id") Long id){
|
||||||
|
Children children=childrenService.getById(id);
|
||||||
|
return Result.success(children);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,12 +203,18 @@ public class DataSourceController extends BaseController {
|
||||||
return Result.success(countResp);
|
return Result.success(countResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* 获取数据实例集合
|
// * 获取数据实例集合
|
||||||
*/
|
// */
|
||||||
@GetMapping("/getDataModel/{id}")
|
//@GetMapping("/getDataModel/{id}")
|
||||||
public Result getDataModel(@PathVariable("id")Long id){
|
// public Result getDataModel(@PathVariable("id")Long id){
|
||||||
List<HashMap<String, Object>> dataModelMapList= dataSourceService.getDataModel(id);
|
// List<HashMap<String, Object>> dataModelMapList= dataSourceService.getDataModel(id);
|
||||||
return Result.success(dataModelMapList);
|
//return Result.success(dataModelMapList);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
@GetMapping("/getDataSourceById/{id}")
|
||||||
|
public Result<DataSource> getDataSourceById(@PathVariable("id") Long id) {
|
||||||
|
DataSource dataSource = dataSourceService.getById(id);
|
||||||
|
return success(dataSource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,5 @@ public interface DataSourceService extends IService<DataSource> {
|
||||||
|
|
||||||
Result updTableData(TableData tableData);
|
Result updTableData(TableData tableData);
|
||||||
|
|
||||||
List<HashMap<String, Object>> getDataModel(Long id);
|
// List<HashMap<String, Object>> getDataModel(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
while (columnsRs.next()) {
|
while (columnsRs.next()) {
|
||||||
String columnName = columnsRs.getString("COLUMN_NAME");
|
String columnName = columnsRs.getString("COLUMN_NAME");
|
||||||
String columnComment = columnsRs.getString("REMARKS");
|
String columnComment = columnsRs.getString("REMARKS");
|
||||||
String columnType = columnsRs.getString("DATA_TYPE");
|
String columnType = columnsRs.getString("TYPE_NAME");
|
||||||
String javaType = getJavaType(dataType.getDriverManager(), jdbcUrl, dataSource, tableName, columnName);
|
String javaType = getJavaType(dataType.getDriverManager(), jdbcUrl, dataSource, tableName, columnName);
|
||||||
int columnSize = columnsRs.getInt("COLUMN_SIZE");
|
int columnSize = columnsRs.getInt("COLUMN_SIZE");
|
||||||
int decimalDigits = columnsRs.getInt("DECIMAL_DIGITS");
|
int decimalDigits = columnsRs.getInt("DECIMAL_DIGITS");
|
||||||
|
@ -417,7 +417,7 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
.comment(columnComment)
|
.comment(columnComment)
|
||||||
.isPrimaryKey(columnName.equals(primaryKeyColumnName) ? "Y" : "N")
|
.isPrimaryKey(columnName.equals(primaryKeyColumnName) ? "Y" : "N")
|
||||||
.type(columnType)
|
.type(columnType)
|
||||||
.mappingType(javaType)
|
.mappingType(javaType.split("\\.")[2])
|
||||||
.length(columnSize)
|
.length(columnSize)
|
||||||
.decimalPlaces((long) decimalDigits)
|
.decimalPlaces((long) decimalDigits)
|
||||||
.isNull(isNullable.equals("YES") ? "Y" : "N")
|
.isNull(isNullable.equals("YES") ? "Y" : "N")
|
||||||
|
@ -479,54 +479,54 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
return Result.success(tableDataService.updateById(tableData));
|
return Result.success(tableDataService.updateById(tableData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<HashMap<String, Object>> getDataModel(Long id) {
|
// public List<HashMap<String, Object>> getDataModel(Long id) {
|
||||||
List<HashMap<String, Object>> list = new ArrayList<>();
|
// List<HashMap<String, Object>> list = new ArrayList<>();
|
||||||
Children children = childrenService.getOne(new LambdaQueryWrapper<>() {{
|
// Children children = childrenService.getOne(new LambdaQueryWrapper<>() {{
|
||||||
eq(Children::getId, id);
|
// eq(Children::getId, id);
|
||||||
}});
|
// }});
|
||||||
DataSource dataSource = this.getOne(new LambdaQueryWrapper<>() {{
|
// DataSource dataSource = this.getOne(new LambdaQueryWrapper<>() {{
|
||||||
eq(DataSource::getId, children.getAssetId());
|
// eq(DataSource::getId, children.getAssetId());
|
||||||
}});
|
// }});
|
||||||
DatabaseType databaseType = databaseTypeService.getOne(new LambdaQueryWrapper<>() {{
|
// DatabaseType databaseType = databaseTypeService.getOne(new LambdaQueryWrapper<>() {{
|
||||||
eq(DatabaseType::getDatabaseName, dataSource.getDataType());
|
// eq(DatabaseType::getDatabaseName, dataSource.getDataType());
|
||||||
}});
|
// }});
|
||||||
List<TableData> tableDataList = tableDataService.list(new LambdaQueryWrapper<>() {{
|
// List<TableData> tableDataList = tableDataService.list(new LambdaQueryWrapper<>() {{
|
||||||
eq(TableData::getChildrenId, id);
|
// eq(TableData::getChildrenId, id);
|
||||||
}});
|
// }});
|
||||||
String sql="";
|
// String sql="";
|
||||||
String query="";
|
// String query="";
|
||||||
String url=databaseType.getUrlPre()+dataSource.getHost()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName()+"?"+dataSource.getConnectionParam();
|
// String url=databaseType.getUrlPre()+dataSource.getHost()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName()+"?"+dataSource.getConnectionParam();
|
||||||
for (TableData tableData : tableDataList) {
|
// for (TableData tableData : tableDataList) {
|
||||||
query+=tableData.getName()+",";
|
// query+=tableData.getName()+",";
|
||||||
}
|
// }
|
||||||
query=query.substring(0,query.length()-1);
|
// query=query.substring(0,query.length()-1);
|
||||||
if ("mysql".equals(dataSource.getDataType())){
|
// if ("mysql".equals(dataSource.getDataType())){
|
||||||
sql="select"+query+"from"+children.getName();
|
// sql="select"+query+"from"+children.getName();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
Class.forName(databaseType.getDriverManager());
|
// Class.forName(databaseType.getDriverManager());
|
||||||
Connection connection=DriverManager.getConnection(url,dataSource.getUser(),dataSource.getPassword());
|
// Connection connection=DriverManager.getConnection(url,dataSource.getUser(),dataSource.getPassword());
|
||||||
Statement statement = connection.createStatement();
|
// Statement statement = connection.createStatement();
|
||||||
ResultSet rs = statement.executeQuery(sql);
|
// ResultSet rs = statement.executeQuery(sql);
|
||||||
ResultSetMetaData metaData = rs.getMetaData();
|
// ResultSetMetaData metaData = rs.getMetaData();
|
||||||
while (rs.next()){
|
//while (rs.next()){
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
// HashMap<String, Object> map = new HashMap<>();
|
||||||
for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
// for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
||||||
String columnName = metaData.getColumnName(i);
|
// String columnName = metaData.getColumnName(i);
|
||||||
Object value = rs.getObject(i);
|
// Object value = rs.getObject(i);
|
||||||
map.put(columnName, value);
|
// map.put(columnName, value);
|
||||||
}
|
// }
|
||||||
list.add(map);
|
// list.add(map);
|
||||||
}
|
//}
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
// } catch (ClassNotFoundException | SQLException e) {
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
return list;
|
// return list;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// 获取字段在java中的映射类型
|
||||||
public static String getJavaType(String driveClass, String jdbcUrl, DataSource dataSource, String tableName,
|
public static String getJavaType(String driveClass, String jdbcUrl, DataSource dataSource, String tableName,
|
||||||
String columnName) {
|
String columnName) {
|
||||||
String sql = "";
|
String sql = "";
|
||||||
|
@ -549,11 +549,9 @@ while (rs.next()){
|
||||||
ResultSetMetaData rsd = pst.executeQuery().getMetaData();
|
ResultSetMetaData rsd = pst.executeQuery().getMetaData();
|
||||||
for (int i = 1; i <= rsd.getColumnCount(); i++) {
|
for (int i = 1; i <= rsd.getColumnCount(); i++) {
|
||||||
if (rsd.getColumnName(i).equals(columnName)) {
|
if (rsd.getColumnName(i).equals(columnName)) {
|
||||||
if (rsd.getColumnClassName(i).equals("java.time.LocalDateTime")) {
|
javaType = rsd.getColumnClassName(i);
|
||||||
javaType = "LocalDateTime";
|
// String[] split = rsd.getColumnClassName(i).split("\\.");
|
||||||
} else {
|
// javaType = split[2];
|
||||||
javaType = rsd.getColumnClassName(i).replace("java.lang.", "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pst.close();
|
pst.close();
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package data.test.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.ruleEngine.model.DataModel;
|
||||||
|
import data.test.service.TestService;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试控制层
|
||||||
|
*
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: TestController
|
||||||
|
* @createTime: 2024/5/14 11:37
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestController {
|
||||||
|
@Autowired
|
||||||
|
private TestService testService;
|
||||||
|
|
||||||
|
@GetMapping("/getDataModelList/{id}")
|
||||||
|
public Result<List<List<DataModel>>> getDataModelList(@PathVariable("id")Long id){
|
||||||
|
List<List<DataModel>> dataModelList=testService.getDataModelList(id);
|
||||||
|
return Result.success(dataModelList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package data.test.service;
|
||||||
|
|
||||||
|
import com.muyu.ruleEngine.model.DataModel;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: TestService
|
||||||
|
* @createTime: 2024/5/14 11:39
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public interface TestService {
|
||||||
|
|
||||||
|
List<List<DataModel>> getDataModelList(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package data.test.service.impl;
|
||||||
|
|
||||||
|
import com.muyu.data.source.client.config.SourceClientConfig;
|
||||||
|
import com.muyu.ruleEngine.model.DataModel;
|
||||||
|
import data.test.service.TestService;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author HuFangMing
|
||||||
|
* @ClassName: TestServiceImpl
|
||||||
|
* @createTime: 2024/5/14 11:39
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TestServiceImpl implements TestService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SourceClientConfig sourceClientConfig;
|
||||||
|
@Override
|
||||||
|
public List<List<DataModel>> getDataModelList(Long id) {
|
||||||
|
List<List<DataModel>> dataModelList = sourceClientConfig.getDataModel(id);
|
||||||
|
|
||||||
|
return dataModelList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,5 +22,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-common-core</artifactId>
|
<artifactId>muyu-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-rule_engine-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue