master
陈思豪 2024-09-10 15:32:44 +08:00
parent 0c4221d0b9
commit 95a0b84fa0
2 changed files with 22 additions and 6 deletions

View File

@ -351,16 +351,17 @@ public class MySqlDataSource extends BaseDataAbsSource {
//壮法
@Override
public DataValue[][] getRows () {
log.info("数据源开始调用111");
MySqlQuery query = getQuery();
log.info("拿到的值query{}",query.getSql());
Integer one = Math.toIntExact(query.getOne());
Integer two = query.getTwo();
String sql = query.getSql();
Long dataSourceId = query.getDataSourceId();
ConcurrentHashMap<Integer, DataValue> map = new ConcurrentHashMap<>();
System.out.println("aaaaaaaaaaaaa-----------");
Source dataSources = sourceRemote.findSourceById(dataSourceId);
log.info("0.调用一下在子");
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setPoolName("HikariCP 连接池");
hikariConfig.setDriverClassName(dataSources.getDriverName());
@ -369,9 +370,9 @@ public class MySqlDataSource extends BaseDataAbsSource {
hikariConfig.setPassword(dataSources.getPassword());
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(10);
log.info("1.准备一个二维数组");
DataValue[][] dataValues = new DataValue[one][two];
log.info("2.创建一个二维数组");
HikariDataSource hikariDataSource = new HikariDataSource(hikariConfig);
try {
Connection conn = hikariDataSource.getConnection();
@ -419,7 +420,7 @@ public class MySqlDataSource extends BaseDataAbsSource {
}finally {
close(hikariDataSource); // 关闭数据源
}
log.info("拿到的值aaaa为{}",dataValues.length);
return dataValues;
}
private static void close(HikariDataSource dataSource) {

View File

@ -7,6 +7,10 @@ import com.muyu.domain.Accredit;
import com.muyu.domain.rep.AccreditDeptRep;
import com.muyu.domain.rep.AccreditUserRep;
import com.muyu.domain.req.AccreditReq;
import com.muyu.mysql.MySqlDataSource;
import com.muyu.mysql.MySqlQuery;
import lombok.extern.java.Log;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -14,11 +18,14 @@ import java.util.List;
@RestController
@RequestMapping("/accredit")
@Log4j2
public class AccreditController {
@Autowired
private AccreditService accreditService;
@Autowired
private TableInfoService tableInfoService;
@Autowired
private MySqlDataSource mySqlDataSource;
//根据表Id查询数据库名称接入名称和表名称
@GetMapping("/findAccredit")
@ -59,6 +66,14 @@ public class AccreditController {
return i>0?Result.success(i):Result.error();
}
@PostMapping("texttt")
public Result remove(@RequestBody MySqlQuery query) {
mySqlDataSource.setQuery(query);
System.out.println("amnmnmnmnmnmmnnm");
mySqlDataSource.getRows();
return null;
}
}