fine:()修改规格
parent
530a80e4fe
commit
e001e2ea0d
|
@ -12,7 +12,7 @@ import java.util.function.Supplier;
|
|||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.common.domain
|
||||
* @Package:com.muyu.common.domain 配置类
|
||||
* @Project:cloud-integration
|
||||
* @name:Connection
|
||||
* @Date:2024/8/21 1:00
|
||||
|
|
|
@ -14,14 +14,13 @@ import java.util.function.Supplier;
|
|||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo
|
||||
* @Package:com.muyu.server.pojo //核心数据
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
//核心数据
|
||||
@TableName(value = "data_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
package com.muyu.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:张腾
|
||||
* @Package:com.muyu.server.pojo 数据源数据库初始化
|
||||
* @Project:cloud-integration
|
||||
* @name:DataSourceList
|
||||
* @Date:2024/8/20 18:47
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@TableName(value = "data_source")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
//
|
||||
public class DataSourceInfo extends BaseEntity {
|
||||
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private String id ;
|
||||
|
||||
private String name ;
|
||||
private String cardNo ;
|
||||
private String descriot ;
|
||||
private String ctfTp ;
|
||||
private String ctfId ;
|
||||
private String gender ;
|
||||
private String birthday ;
|
||||
private String address ;
|
||||
private String zip ;
|
||||
private String dirty ;
|
||||
private String district1 ;
|
||||
private String district2 ;
|
||||
private String district3 ;
|
||||
private String district4 ;
|
||||
private String district5 ;
|
||||
private String district6 ;
|
||||
private String firstNm ;
|
||||
private String lastNm ;
|
||||
private String duty ;
|
||||
private String mobile ;
|
||||
private String tel ;
|
||||
private String fax ;
|
||||
private String eMail ;
|
||||
private String nation ;
|
||||
private String taste ;
|
||||
private String education ;
|
||||
private String company ;
|
||||
private String cTel ;
|
||||
private String cAddress ;
|
||||
private String cZip ;
|
||||
private String family ;
|
||||
private String version ;
|
||||
|
||||
// public static DataSourceList updBuild(DataSourceList dataSourceList, Supplier<Long> idSupplier) {
|
||||
// return DataSourceList.builder()
|
||||
// .id(idSupplier.get())
|
||||
// .name(dataSourceList.getName())
|
||||
// .gender(dataSourceList.getGender())
|
||||
// .
|
||||
// ;
|
||||
// }
|
||||
}
|
|
@ -33,7 +33,7 @@ public class TableFie{
|
|||
* 字段名称
|
||||
*/
|
||||
@TableField(value = "field")
|
||||
private String fieId;
|
||||
private String field;
|
||||
/**
|
||||
* 字段类型
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ public class TableFie{
|
|||
|
||||
public static TableFie customerBuild(TableFie tableFie, Supplier<TableFie> function) {
|
||||
return com.muyu.common.domain.TableFie.builder()
|
||||
.fieId(tableFie.getFieId())
|
||||
.field(tableFie.getField())
|
||||
.type(tableFie.getType())
|
||||
.collation(tableFie.getCollation())
|
||||
.nullable(tableFie.getNullable())
|
||||
|
@ -93,7 +93,7 @@ public class TableFie{
|
|||
*/
|
||||
public static TableFie updBuild(TableFie req, Supplier<String> idSupplier) {
|
||||
return com.muyu.common.domain.TableFie.builder()
|
||||
.fieId(idSupplier.get())
|
||||
.field(idSupplier.get())
|
||||
.type(req.getType())
|
||||
.collation(req.getCollation())
|
||||
.nullable(req.getNullable())
|
||||
|
@ -104,8 +104,8 @@ public class TableFie{
|
|||
|
||||
|
||||
public TableFie buildTableField() {
|
||||
return com.muyu.common.domain.TableFie.builder()
|
||||
.fieId(this.getFieId())
|
||||
return TableFie.builder()
|
||||
.field(this.getField())
|
||||
.type(this.getType())
|
||||
.collation(this.getCollation())
|
||||
.nullable(this.getNullable())
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CoreDataListController {
|
|||
|
||||
/**
|
||||
* 查询核心数据库
|
||||
* @param dataSourceList 客户列表请求参数
|
||||
* @param dataSourceList 核心数据库列表请求参数
|
||||
* @return 核心数据库列表
|
||||
*/
|
||||
@PostMapping("/selectData")
|
||||
|
|
|
@ -15,6 +15,11 @@ import java.util.List;
|
|||
*/
|
||||
public interface DataSourceService extends IService<DataSourceList> {
|
||||
|
||||
/**
|
||||
* 抽取数据列表
|
||||
* @param connect 数据实体类
|
||||
* @return 返回试图
|
||||
*/
|
||||
List<DataSourceList> extractData(Connect connect);
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,20 +41,21 @@ public class DataNameServiceImpl
|
|||
String sql = null;
|
||||
DruidDataSource druidDataSource = JdbcHelper.getConnRs();
|
||||
sql = "SHOW DATABASES;";
|
||||
try (Connection conn = druidDataSource.getConnection()) {
|
||||
// 在这里执行你的数据库操作
|
||||
PreparedStatement preparedStatement = conn.prepareStatement(sql);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
try {
|
||||
assert druidDataSource != null;
|
||||
try (Connection conn = druidDataSource.getConnection()) {
|
||||
// 在这里执行你的数据库操作
|
||||
PreparedStatement preparedStatement = conn.prepareStatement(sql);
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
ArrayList<DataName> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String database = rs.getString("Database");
|
||||
ArrayList<DataName> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
list.add(new DataName(0, rs.getString("Database")));
|
||||
}
|
||||
JdbcHelper.close(conn,preparedStatement,rs);
|
||||
|
||||
list.add(new DataName(0,database));
|
||||
return list;
|
||||
}
|
||||
JdbcHelper.close(conn,preparedStatement,rs);
|
||||
|
||||
return list;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,11 @@ public class DataSourceServiceImpl
|
|||
extends ServiceImpl<DataSourceMapper, DataSourceList>
|
||||
implements DataSourceService {
|
||||
|
||||
/**
|
||||
* 抽取数据列表
|
||||
* @param connect 数据实体类
|
||||
* @return 返回试图
|
||||
*/
|
||||
@Override
|
||||
public List<DataSourceList> extractData(Connect connect) {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(100);
|
||||
|
@ -77,7 +82,6 @@ public class DataSourceServiceImpl
|
|||
if (substring.contains("id")){
|
||||
id = rs.getInt("id");
|
||||
}
|
||||
|
||||
String name = (rs.getString("COLUMN_NAME"));
|
||||
String gender = (rs.getString("gender"));
|
||||
Date birthday = (rs.getDate("birthday"));
|
||||
|
@ -140,12 +144,15 @@ public class DataSourceServiceImpl
|
|||
ResultSet rs = preparedStatement.executeQuery();
|
||||
ArrayList<TableFie> tableFIES = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String fieldId = rs.getString("Field"); // 使用正确的列名 Field
|
||||
// 使用正确的列名 Field
|
||||
|
||||
TableFie tableFie = TableFie.builder()
|
||||
.fieId(fieldId) // 假设你修改了字段名为 fieldId,以符合常规命名规范
|
||||
// 假设你修改了字段名为 fieldId,以符合常规命名规范
|
||||
.field(rs.getString("Field"))
|
||||
.type(rs.getString("Type"))
|
||||
.collation(rs.getString("Collation"))
|
||||
.nullable(rs.getString("Null")) // 转换为布尔值,假设你想要这个字段
|
||||
// 转换为布尔值,假设你想要这个字段
|
||||
.nullable(rs.getString("Null"))
|
||||
.primarys(rs.getString("Key"))
|
||||
.annotation(rs.getString("Comment"))
|
||||
.build();
|
||||
|
|
|
@ -12,6 +12,8 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.domain.TableFie.customerBuild;
|
||||
|
||||
/**
|
||||
* @Author:yang
|
||||
* @Package:com.muyu.server.service.impl
|
||||
|
@ -41,11 +43,11 @@ public class TableFieldServiceImpl
|
|||
);
|
||||
List<TableFie> tableFieList = this.list(queryWrapper);
|
||||
return tableFieList.stream()
|
||||
.map(orderPaytableField -> com.muyu.common.domain.TableFie.customerBuild(
|
||||
.map(orderPaytableField -> customerBuild(
|
||||
orderPaytableField,
|
||||
() -> (TableFie) tableFieldServicelimt.selectOrderPayByAppCodeAndLimit(orderPaytableField.getFieId(),5)
|
||||
.stream()
|
||||
.map(com.muyu.common.domain.TableFie::buildTableField)
|
||||
.map(TableFie::buildTableField)
|
||||
.toList()
|
||||
)
|
||||
)
|
||||
|
|
|
@ -43,7 +43,7 @@ public class TableRunNameServiceImpl
|
|||
ResultSet rs = preparedStatement.executeQuery();
|
||||
ArrayList<TableNames> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String tables = rs.getString("Tables_in_core_data_warehouse");
|
||||
String tables = rs.getString("Tables_in_"+name);
|
||||
list.add(new TableNames(tables,0));
|
||||
}
|
||||
JdbcHelper.close(conn,preparedStatement,rs);
|
||||
|
|
|
@ -19,7 +19,11 @@ import java.sql.*;
|
|||
@Log4j2
|
||||
public class JdbcHelper {
|
||||
|
||||
|
||||
/**
|
||||
* 连接池
|
||||
* @param connect 连接池对象参数 查询结构
|
||||
* @return 返回结果
|
||||
*/
|
||||
public static DruidDataSource getConn( Connect connect) {
|
||||
while (0<connect.getMaxWaitTimes()){
|
||||
try {
|
||||
|
@ -39,13 +43,17 @@ public class JdbcHelper {
|
|||
|
||||
return druidDataSource;
|
||||
} catch (Exception e) {
|
||||
log.error("异常为:{}"+e);
|
||||
log.error("异常为:{}", String.valueOf(e));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务器上说有数据库名 连接池
|
||||
* @return
|
||||
*/
|
||||
public static DruidDataSource getConnRs() {
|
||||
|
||||
try {
|
||||
|
@ -54,21 +62,21 @@ public class JdbcHelper {
|
|||
"=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
|
||||
druidDataSource.setUsername("root");
|
||||
druidDataSource.setPassword("Bwie-8666");
|
||||
//"com.mysql.cj.jdbc.Driver"
|
||||
druidDataSource.setDriverClassName(new ConnectReq().getDRIVER());
|
||||
// druidDataSource.setInitialSize(connect.getInitSize());
|
||||
// druidDataSource.setMaxActive(connect.getMaxNumConn());
|
||||
// druidDataSource.setMaxWait(connect.getMaxWaitTime());
|
||||
|
||||
return druidDataSource;
|
||||
} catch (Exception e) {
|
||||
log.error("异常为:{}"+e);
|
||||
log.error("异常为:{}", String.valueOf(e));
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询服务器上说有数据库中表名 连接池
|
||||
* @return
|
||||
*/
|
||||
public static DruidDataSource getDataConnRs(String name) {
|
||||
|
||||
try {
|
||||
|
@ -79,15 +87,11 @@ public class JdbcHelper {
|
|||
"utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
|
||||
druidDataSource.setUsername("root");
|
||||
druidDataSource.setPassword("Bwie-8666");
|
||||
//"com.mysql.cj.jdbc.Driver"
|
||||
druidDataSource.setDriverClassName(new ConnectReq().getDRIVER());
|
||||
// druidDataSource.setInitialSize(connect.getInitSize());
|
||||
// druidDataSource.setMaxActive(connect.getMaxNumConn());
|
||||
// druidDataSource.setMaxWait(connect.getMaxWaitTime());
|
||||
|
||||
return druidDataSource;
|
||||
} catch (Exception e) {
|
||||
log.error("异常为:{}"+e);
|
||||
log.error("异常为:{}", String.valueOf(e));
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue