Prechádzať zdrojové kódy

批量插入诊断依据

kongwz 5 rokov pred
rodič
commit
be4e46b441

+ 12 - 7
graphdb/src/main/java/org/diagbot/service/impl/KnowledgeServiceImpl.java

@@ -28,10 +28,7 @@ import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
 
 import java.math.RoundingMode;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
+import java.sql.*;
 import java.text.NumberFormat;
 import java.util.*;
 
@@ -2124,7 +2121,7 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
             if(disList != null && disList.size()>0){
                 for (Long disId:disList) {
                    respDTO = this.updateNeo(respDTO, disId, connect, ciKu);
-
+                   this.updateDate(connect,disId);
                 }
             }
             connect.close();
@@ -2134,8 +2131,16 @@ public class    KnowledgeServiceImpl implements KnowledgeService {
 
         return respDTO;
     }
-    public void updateDate(Connection connection,Long disId){
-        String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id="+disId+";";
+    public void updateDate(Connection connection,Long disId) {
+        String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id=?";
+        try {
+            PreparedStatement preparedStatement = connection.prepareStatement(sql);
+            preparedStatement.setLong(1,disId);
+            int i = preparedStatement.executeUpdate();
+            preparedStatement.close();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
     }
     public List<Long> getDisList(Connection connection){
         List<Long> disIds = new ArrayList<>();