Browse Source

修改jdbcTemplate 的实现类 ,解决实例化的问题。

CodeLife Leno 2 months ago
parent
commit
c3a6be3e06

+ 3 - 2
Procedure/backend/project/src/main/java/com/sundata/product/taskExecute/service/KingBase2GBaseService.java

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
 
 import javax.sql.DataSource;
@@ -66,8 +67,8 @@ public class KingBase2GBaseService {
             log.error("目标数据库中不存在对应的数据库表【{}】,请检查", tableName);
             throw new IllegalArgumentException("目标数据库中不存在对应的数据库表【{}】,请检查", e);
         }
-        JdbcTemplate thisJdbc = new JdbcTemplate(thisDatasource);
-        JdbcTemplate otherJdbc = new JdbcTemplate(otherDataSource);
+        NamedParameterJdbcTemplate thisJdbc = new NamedParameterJdbcTemplate(thisDatasource);
+        NamedParameterJdbcTemplate otherJdbc = new NamedParameterJdbcTemplate(otherDataSource);
 
 
         List<Map<String, Object>> data = thisJdbc.query("select * from " + tableName, new UpperMapRowMapper());