From af4b93104f60c8061b3887cce627730f29e983ac Mon Sep 17 00:00:00 2001 From: lty <876263681@qq.com> Date: 星期六, 17 五月 2025 14:42:46 +0800 Subject: [PATCH] #调试 --- src/main/java/com/zy/common/service/erp/ErpSqlServer.java | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/zy/common/service/erp/ErpSqlServer.java b/src/main/java/com/zy/common/service/erp/ErpSqlServer.java index 3469eec..ccc6207 100644 --- a/src/main/java/com/zy/common/service/erp/ErpSqlServer.java +++ b/src/main/java/com/zy/common/service/erp/ErpSqlServer.java @@ -245,31 +245,42 @@ private List<Map<String, Object>> executeQuery(String sql) { Connection conn = null; + PreparedStatement pstm = null; + ResultSet rs = null; try { conn = getConn(); pstm = conn.prepareStatement(sql); - pstm.setQueryTimeout(QUERY_TIMEOUT_SECONDS); - rs = pstm.executeQuery(); -// List<Map<String, Object>> maps = convertList(rs); + + // 鉁� 鍏堟妸 rs 杞崲瀹屽啀鍏抽棴杩炴帴 return convertList(rs); + } catch (Exception e) { e.printStackTrace(); return null; } finally { - release(); - if (conn != null) { - try { + // 鉂椾笉鑳芥彁鍓嶈皟鐢� release()锛屾敼涓烘墜鍔ㄩ噴鏀惧悇瀵硅薄 + try { + if (rs != null) { + rs.close(); + rs = null; + } + if (pstm != null) { + pstm.close(); + pstm = null; + } + if (conn != null) { conn.close(); conn = null; - } catch (SQLException e) { - e.printStackTrace(); } + } catch (SQLException e) { + e.printStackTrace(); } } } + public Number executeQueryCount(String sql, String column) { Number value = 0; Connection conn = null; -- Gitblit v1.9.1