修复sql执行器页面取消执行未能正确运行的问题
sse推送模块已知问题修复
This commit is contained in:
@@ -121,7 +121,8 @@ public class DbSqlExecutorController {
|
||||
return DocDbResponseJson.warn("单次执行最多支持20条语句同时执行,当前语句条数:" + analysisQuerySqlList.size());
|
||||
}
|
||||
List<ColumnExecuteResult> resultList = new LinkedList<>();
|
||||
for (Map<String, Object> map : analysisQuerySqlList) {
|
||||
for (int i = 0; i < analysisQuerySqlList.size(); i++) {
|
||||
Map<String, Object> map = analysisQuerySqlList.get(i);
|
||||
ColumnExecuteResult executeResult;
|
||||
ColumnExecuteResult executeCountResult;
|
||||
//原始sql
|
||||
@@ -140,6 +141,10 @@ public class DbSqlExecutorController {
|
||||
if(map.get("sqlType").equals("select")){
|
||||
if(StrUtil.equals(type,"noPage")){
|
||||
executeParam = SqlParseUtil.getSingleExecuteParam(executeParam,originalSql, paramMap);
|
||||
//设置最后一次标志
|
||||
if(i==analysisQuerySqlList.size()-1){
|
||||
executeParam.setIsLastTime(true);
|
||||
}
|
||||
executeResult = columnSqlExecutor.execute(executeParam);
|
||||
resultList.add(executeResult);
|
||||
continue;
|
||||
@@ -153,6 +158,10 @@ public class DbSqlExecutorController {
|
||||
if(data!=null){
|
||||
count = Long.parseLong(data.get(0).get(0)+"");
|
||||
}
|
||||
//设置最后一次标志
|
||||
if(i==analysisQuerySqlList.size()-1){
|
||||
executeParam.setIsLastTime(true);
|
||||
}
|
||||
//总数据量大于1000进行分页
|
||||
if(count>1000){
|
||||
String pageSql = dbBaseService.getQueryPageSqlBySql(originalSql,pageSize,pageNum);
|
||||
|
||||
@@ -2,8 +2,12 @@ package com.zyplayer.doc.db.framework.db.mapper.base;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
|
||||
import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean;
|
||||
import com.zyplayer.doc.db.framework.sse.service.DbSseEmitterService;
|
||||
import com.zyplayer.doc.db.framework.sse.util.DbSseCacheUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
@@ -32,6 +36,9 @@ public class ColumnSqlExecutor {
|
||||
@Resource
|
||||
DatabaseRegistrationBean databaseRegistrationBean;
|
||||
|
||||
@Resource
|
||||
DbSseEmitterService dbSseEmitterService;
|
||||
|
||||
// 执行中的PreparedStatement信息,用于强制取消执行
|
||||
private static final Map<String, PreparedStatement> statementMap = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -136,6 +143,18 @@ public class ColumnSqlExecutor {
|
||||
}
|
||||
// 查询的结果集
|
||||
resultSet = preparedStatement.getResultSet();
|
||||
|
||||
//最后一次
|
||||
if(Boolean.TRUE.equals(executeParam.getIsLastTime())){
|
||||
//推送查询完成信息
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
String loginId = currentUser.getUserId().toString();
|
||||
String clientId = DbSseCacheUtil.getClientIdByLoginId(loginId);
|
||||
if(clientId!=null){
|
||||
dbSseEmitterService.sendMessageToOneClient(DbSseCacheUtil.getClientIdByLoginId(loginId),"1");
|
||||
}
|
||||
}
|
||||
|
||||
List<String> headerList = new LinkedList<>();
|
||||
List<List<Object>> dataList = new LinkedList<>();
|
||||
if (resultSet != null) {
|
||||
|
||||
@@ -21,4 +21,5 @@ public class ExecuteParam {
|
||||
private String executeId;
|
||||
private String prefixSql;
|
||||
private ExecuteType executeType;
|
||||
private Boolean isLastTime;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,9 @@ public class DbSseCacheUtil {
|
||||
}
|
||||
Map<String,Object> map = new ConcurrentHashMap<>();
|
||||
map.put(DbSseEmitterParameterEnum.EMITTER.getValue(),emitter);
|
||||
map.put(DbSseEmitterParameterEnum.FUTURE.getValue(), future);
|
||||
if(future!=null){
|
||||
map.put(DbSseEmitterParameterEnum.FUTURE.getValue(), future);
|
||||
}
|
||||
map.put(DbSseEmitterParameterEnum.LOGINID.getValue(), loginId);
|
||||
sseCache.put(clientId, map);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon-db.png"><title>数据库文档管理</title><link href="css/chunk-vendors.be60d3b3.css" rel="preload" as="style"><link href="css/index.dd934fd5.css" rel="preload" as="style"><link href="js/chunk-vendors.7871ff07.js" rel="preload" as="script"><link href="js/index.75921495.js" rel="preload" as="script"><link href="css/chunk-vendors.be60d3b3.css" rel="stylesheet"><link href="css/index.dd934fd5.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.7871ff07.js"></script><script src="js/index.75921495.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon-db.png"><title>数据库文档管理</title><link href="css/chunk-vendors.be60d3b3.css" rel="preload" as="style"><link href="css/index.90584c9a.css" rel="preload" as="style"><link href="js/chunk-vendors.5bc10fd8.js" rel="preload" as="script"><link href="js/index.e9cb8d9c.js" rel="preload" as="script"><link href="css/chunk-vendors.be60d3b3.css" rel="stylesheet"><link href="css/index.90584c9a.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.5bc10fd8.js"></script><script src="js/index.e9cb8d9c.js"></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
zyplayer-doc-db/src/main/resources/dist/js/index.e9cb8d9c.js
vendored
Normal file
1
zyplayer-doc-db/src/main/resources/dist/js/index.e9cb8d9c.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user