数据合并
This commit is contained in:
@@ -30,7 +30,7 @@ public class DataMigrationUtil extends Thread {
|
||||
// courseCatalogueChapter();
|
||||
// courseCatalogueChapterVideo();
|
||||
// user();//用的都是copy表里的数据
|
||||
|
||||
//TRUNCATE
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@ public class DataMigrationUtil extends Thread {
|
||||
Map map = new HashMap();
|
||||
map.put("oid",resultSet.getString("oid"));
|
||||
map.put("title",resultSet.getString("title"));
|
||||
map.put("sort",resultSet.getString("orderNo"));
|
||||
map.put("image",resultSet.getString("thumbnail"));
|
||||
map.put("content",resultSet.getString("introduceTxt"));
|
||||
map.put("createDate",resultSet.getString("createDate"));
|
||||
list.add(map);
|
||||
}
|
||||
@@ -62,11 +65,14 @@ public class DataMigrationUtil extends Thread {
|
||||
connection.setAutoCommit(false);
|
||||
System.out.println("===== 开始插入数据 =====");
|
||||
long startTime = System.currentTimeMillis();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT ignore INTO course (uid,title,create_time) VALUES ( ?, ?, ?)");
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT ignore INTO course_copy1 (uid,title,sort,image,content,create_time) VALUES ( ?, ?, ?, ?, ?, ?)");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
preparedStatement.setString(1,list.get(i).get("oid").toString());
|
||||
preparedStatement.setString(2,list.get(i).get("title").toString());
|
||||
preparedStatement.setString(3,list.get(i).get("createDate").toString());
|
||||
preparedStatement.setString(3,list.get(i).get("sort").toString());
|
||||
preparedStatement.setString(4,list.get(i).get("image").toString());
|
||||
preparedStatement.setString(5,list.get(i).get("content").toString());
|
||||
preparedStatement.setString(6,list.get(i).get("createDate").toString());
|
||||
// 添加到批处理中
|
||||
preparedStatement.addBatch();
|
||||
if (i+1 % 5000 == 0) {
|
||||
|
||||
Reference in New Issue
Block a user