master
parent
0c4221d0b9
commit
95a0b84fa0
|
@ -351,16 +351,17 @@ public class MySqlDataSource extends BaseDataAbsSource {
|
||||||
//壮法
|
//壮法
|
||||||
@Override
|
@Override
|
||||||
public DataValue[][] getRows () {
|
public DataValue[][] getRows () {
|
||||||
|
log.info("数据源开始调用111");
|
||||||
MySqlQuery query = getQuery();
|
MySqlQuery query = getQuery();
|
||||||
|
log.info("拿到的值query{}",query.getSql());
|
||||||
Integer one = Math.toIntExact(query.getOne());
|
Integer one = Math.toIntExact(query.getOne());
|
||||||
Integer two = query.getTwo();
|
Integer two = query.getTwo();
|
||||||
String sql = query.getSql();
|
String sql = query.getSql();
|
||||||
Long dataSourceId = query.getDataSourceId();
|
Long dataSourceId = query.getDataSourceId();
|
||||||
ConcurrentHashMap<Integer, DataValue> map = new ConcurrentHashMap<>();
|
ConcurrentHashMap<Integer, DataValue> map = new ConcurrentHashMap<>();
|
||||||
|
System.out.println("aaaaaaaaaaaaa-----------");
|
||||||
Source dataSources = sourceRemote.findSourceById(dataSourceId);
|
Source dataSources = sourceRemote.findSourceById(dataSourceId);
|
||||||
|
log.info("0.调用一下在子");
|
||||||
HikariConfig hikariConfig = new HikariConfig();
|
HikariConfig hikariConfig = new HikariConfig();
|
||||||
hikariConfig.setPoolName("HikariCP 连接池");
|
hikariConfig.setPoolName("HikariCP 连接池");
|
||||||
hikariConfig.setDriverClassName(dataSources.getDriverName());
|
hikariConfig.setDriverClassName(dataSources.getDriverName());
|
||||||
|
@ -369,9 +370,9 @@ public class MySqlDataSource extends BaseDataAbsSource {
|
||||||
hikariConfig.setPassword(dataSources.getPassword());
|
hikariConfig.setPassword(dataSources.getPassword());
|
||||||
hikariConfig.setMinimumIdle(2);
|
hikariConfig.setMinimumIdle(2);
|
||||||
hikariConfig.setMaximumPoolSize(10);
|
hikariConfig.setMaximumPoolSize(10);
|
||||||
|
log.info("1.准备一个二维数组");
|
||||||
DataValue[][] dataValues = new DataValue[one][two];
|
DataValue[][] dataValues = new DataValue[one][two];
|
||||||
|
log.info("2.创建一个二维数组");
|
||||||
HikariDataSource hikariDataSource = new HikariDataSource(hikariConfig);
|
HikariDataSource hikariDataSource = new HikariDataSource(hikariConfig);
|
||||||
try {
|
try {
|
||||||
Connection conn = hikariDataSource.getConnection();
|
Connection conn = hikariDataSource.getConnection();
|
||||||
|
@ -419,7 +420,7 @@ public class MySqlDataSource extends BaseDataAbsSource {
|
||||||
}finally {
|
}finally {
|
||||||
close(hikariDataSource); // 关闭数据源
|
close(hikariDataSource); // 关闭数据源
|
||||||
}
|
}
|
||||||
|
log.info("拿到的值aaaa为{}",dataValues.length);
|
||||||
return dataValues;
|
return dataValues;
|
||||||
}
|
}
|
||||||
private static void close(HikariDataSource dataSource) {
|
private static void close(HikariDataSource dataSource) {
|
||||||
|
|
|
@ -7,6 +7,10 @@ import com.muyu.domain.Accredit;
|
||||||
import com.muyu.domain.rep.AccreditDeptRep;
|
import com.muyu.domain.rep.AccreditDeptRep;
|
||||||
import com.muyu.domain.rep.AccreditUserRep;
|
import com.muyu.domain.rep.AccreditUserRep;
|
||||||
import com.muyu.domain.req.AccreditReq;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -14,11 +18,14 @@ import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/accredit")
|
@RequestMapping("/accredit")
|
||||||
|
@Log4j2
|
||||||
public class AccreditController {
|
public class AccreditController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccreditService accreditService;
|
private AccreditService accreditService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TableInfoService tableInfoService;
|
private TableInfoService tableInfoService;
|
||||||
|
@Autowired
|
||||||
|
private MySqlDataSource mySqlDataSource;
|
||||||
|
|
||||||
//根据表Id查询数据库名称接入名称和表名称
|
//根据表Id查询数据库名称接入名称和表名称
|
||||||
@GetMapping("/findAccredit")
|
@GetMapping("/findAccredit")
|
||||||
|
@ -59,6 +66,14 @@ public class AccreditController {
|
||||||
return i>0?Result.success(i):Result.error();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue