Commit fa20f54341c52ec52e5297cd9c4022f995b5452c
1 parent
c9cf9e03b4
Exists in
master
and in
6 other branches
update code
Showing 2 changed files with 27 additions and 2 deletions
platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
View file @
fa20f54
| 1 | 1 | package com.lyms.platform.data.util; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.enums.AmsServiceTypeEnum; |
| 4 | -import com.lyms.platform.common.utils.HttpClientUtil; | |
| 5 | 4 | import com.lyms.platform.common.utils.HttpRequest; |
| 6 | 5 | import com.lyms.platform.common.utils.PropertiesUtils; |
| 7 | 6 | import com.lyms.platform.common.utils.StringUtils; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/JdbcUtil.java
View file @
fa20f54
| ... | ... | @@ -135,6 +135,32 @@ |
| 135 | 135 | return list; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | + public static Object getOralceSingleObjBySql(String driver, String url, String username, String password,String sql) | |
| 139 | + { | |
| 140 | + Connection conn = getOracleConnection(driver, url, username, password); | |
| 141 | + PreparedStatement pst = null; | |
| 142 | + ResultSet rs = null; | |
| 143 | + try { | |
| 144 | + pst = conn.prepareStatement(sql); | |
| 145 | + rs = pst.executeQuery(); | |
| 146 | + int count = rs.getMetaData().getColumnCount(); | |
| 147 | + for (int i = 1 ; i <= count ;i++) | |
| 148 | + { | |
| 149 | + String columnName = rs.getMetaData().getColumnName(i); | |
| 150 | + while (rs.next()){ | |
| 151 | + return rs.getObject(columnName); | |
| 152 | + } | |
| 153 | + | |
| 154 | + } | |
| 155 | + }catch (Exception e) | |
| 156 | + { | |
| 157 | + e.printStackTrace(); | |
| 158 | + } finally { | |
| 159 | + freeConnection(conn,pst,rs); | |
| 160 | + } | |
| 161 | + return null; | |
| 162 | + } | |
| 163 | + | |
| 138 | 164 | public static Object getOralceSingleObjBySql(String sql) |
| 139 | 165 | { |
| 140 | 166 | Connection conn = getOracleConnection(); |
| ... | ... | @@ -148,7 +174,7 @@ |
| 148 | 174 | { |
| 149 | 175 | String columnName = rs.getMetaData().getColumnName(i); |
| 150 | 176 | while (rs.next()){ |
| 151 | - return rs.getObject(columnName); | |
| 177 | + return rs.getObject(columnName); | |
| 152 | 178 | } |
| 153 | 179 | |
| 154 | 180 | } |