return result.toString();
}
DBService 采用的spring的数据库操作
//测试专有
public static int insert(final JT_po[] sqlArray) throws Exception {
String sql="insert into D_SRC_FLOW(MC,TYPE1,TYPE2,TYPE3,Ldbh,Lnglat,Type) values(?,?,?,?,?,?,?)";
try{
JdbcTemplate jdbcTemplate = jdbcTemplateMap.get(YJZHDEVICE);
int[] ii =jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter(){
public void setValues(PreparedStatement ps, int i)
throws SQLException {
JT_po jt= sqlArray[i];
ps.setString(1,jt.getId());
ps.setString(2,jt.getType1());
ps.setString(3,jt.getType2());
ps.setString(4,jt.getTitle());
ps.setString(5,jt.getNewstime());
ps.setString(6,jt.getAllcount());
ps.setString(7,jt.getNewstext());
}
@Override
public int getBatchSize() {
return sqlArray.length;
}
});
System.out.println("sql执行完成,长度为:"+ii.length);
return ii.length;
}catch (org.springframework.dao.DataAccessException e) {
e.printStackTrace();
}
return 0;
}