|
@@ -1,38 +1,38 @@
|
|
|
-package com.example.sqlrun.schedule;
|
|
|
-
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import javax.annotation.PostConstruct;
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.sql.ResultSet;
|
|
|
-import java.sql.ResultSetMetaData;
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.sql.Statement;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-@Component
|
|
|
-public class TestSchedule {
|
|
|
- @Resource(name = "statement")
|
|
|
- private Statement statement;
|
|
|
-
|
|
|
-
|
|
|
- public void doSql() throws SQLException {
|
|
|
- String sql = "select * from BAYONET_DYNAMIC.GPSINFO_HISTORY where gpstime >= to_date('2023-10-20 00:00:00','yyyy-MM-dd hh24:mi:ss')";
|
|
|
- statement.execute(sql);
|
|
|
- ResultSet resultSet = statement.getResultSet();
|
|
|
- ResultSetMetaData metaData = resultSet.getMetaData();
|
|
|
- ArrayList<Map<String, Object>> list = new ArrayList<>();
|
|
|
- while (resultSet.next()) {
|
|
|
- Map<String, Object> dataMap = new HashMap<>();
|
|
|
- for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
|
|
- dataMap.put(metaData.getColumnLabel(i), resultSet.getObject(i));
|
|
|
- }
|
|
|
- list.add(dataMap);
|
|
|
- }
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
- System.out.println(map);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+//package com.example.sqlrun.schedule;
|
|
|
+//
|
|
|
+//import org.springframework.stereotype.Component;
|
|
|
+//
|
|
|
+//import javax.annotation.PostConstruct;
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//import java.sql.ResultSet;
|
|
|
+//import java.sql.ResultSetMetaData;
|
|
|
+//import java.sql.SQLException;
|
|
|
+//import java.sql.Statement;
|
|
|
+//import java.util.ArrayList;
|
|
|
+//import java.util.HashMap;
|
|
|
+//import java.util.Map;
|
|
|
+//
|
|
|
+//@Component
|
|
|
+//public class TestSchedule {
|
|
|
+// @Resource(name = "statement")
|
|
|
+// private Statement statement;
|
|
|
+//
|
|
|
+//
|
|
|
+// public void doSql() throws SQLException {
|
|
|
+// String sql = "select * from BAYONET_DYNAMIC.GPSINFO_HISTORY where gpstime >= to_date('2023-10-20 00:00:00','yyyy-MM-dd hh24:mi:ss')";
|
|
|
+// statement.execute(sql);
|
|
|
+// ResultSet resultSet = statement.getResultSet();
|
|
|
+// ResultSetMetaData metaData = resultSet.getMetaData();
|
|
|
+// ArrayList<Map<String, Object>> list = new ArrayList<>();
|
|
|
+// while (resultSet.next()) {
|
|
|
+// Map<String, Object> dataMap = new HashMap<>();
|
|
|
+// for (int i = 1; i <= metaData.getColumnCount(); i++) {
|
|
|
+// dataMap.put(metaData.getColumnLabel(i), resultSet.getObject(i));
|
|
|
+// }
|
|
|
+// list.add(dataMap);
|
|
|
+// }
|
|
|
+// for (Map<String, Object> map : list) {
|
|
|
+// System.out.println(map);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|