Commit 08d9d4e6 authored by 郝彦辉's avatar 郝彦辉

原因code码表修改,结果表数据修改

parent e60adb61
...@@ -43,6 +43,8 @@ public class BlackGreyListResult implements Serializable { ...@@ -43,6 +43,8 @@ public class BlackGreyListResult implements Serializable {
@JsonIgnore @JsonIgnore
private Timestamp updatedAt; private Timestamp updatedAt;
private Long Id;
public static Set<String> typesToSet(String oldTypesStr, String newType){ public static Set<String> typesToSet(String oldTypesStr, String newType){
......
package cn.quantgroup.qgblservice.utils.jdbc; package cn.quantgroup.qgblservice.utils.jdbc;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails; import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListDetails;
import cn.quantgroup.qgblservice.repository.mybatis.entity.blacklist.BlackGreyListResult;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0; import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.BlackListQueryTidbVo0;
import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList; import cn.quantgroup.qgblservice.repository.mybatis.entity.tidb.TmpBlackGreyList;
import cn.quantgroup.qgblservice.utils.MD5Util; import cn.quantgroup.qgblservice.utils.MD5Util;
...@@ -256,8 +257,18 @@ public class JdbcExecuters { ...@@ -256,8 +257,18 @@ public class JdbcExecuters {
return atomicInteger.get(); return atomicInteger.get();
} }
//批量修改灰名单详情表 /**
public static int updateBatchExecute(List<BlackGreyListDetails> detailsList, JdbcTemplate jdbcTemplate, String type) { * -----------------------------------------------------------------------------<br>
* 描 述: 批量修改灰名单详情表 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.28 10:37 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.28 10:37 <br>
* 入参说明: <br>
* 出参说明: <br>
* -----------------------------------------------------------------------------
*/
public static int updateBatchDetailExecute(List<BlackGreyListDetails> detailsList, JdbcTemplate jdbcTemplate, String type) {
Connection conn = null; Connection conn = null;
PreparedStatement ps = null; PreparedStatement ps = null;
AtomicInteger atomicInteger = new AtomicInteger(); AtomicInteger atomicInteger = new AtomicInteger();
...@@ -307,6 +318,66 @@ public class JdbcExecuters { ...@@ -307,6 +318,66 @@ public class JdbcExecuters {
return atomicInteger.get(); return atomicInteger.get();
} }
/**
* -----------------------------------------------------------------------------<br>
* 描 述: 批量修改灰名单-结果表 <br>
* 创建人: yanhui.Hao <br>
* 创建时间: 2020.04.28 10:37 <br>
* 最后修改人: <br>
* 最后修改时间: 2020.04.28 10:37 <br>
* 入参说明: <br>
* 出参说明: <br>
* -----------------------------------------------------------------------------
*/
public static int updateBatchResultExecute(List<BlackGreyListResult> resultList, JdbcTemplate jdbcTemplate, String type) {
Connection conn = null;
PreparedStatement ps = null;
AtomicInteger atomicInteger = new AtomicInteger();
String sql_updat_result_reasons= "update black_grey_list_result r set r.reasons=? where r.id=? ";
String sql_run = "";
if("updat_result_reasons".equals(type)){
sql_run = sql_updat_result_reasons;
}else{
new SQLException("参数错误,必须传!");
}
try {
conn = jdbcTemplate.getDataSource().getConnection();
ps = conn.prepareStatement(sql_run);
conn.setAutoCommit(false);
for (int i = 0; i < resultList.size(); i++) {
if("updat_result_reasons".equals(type)){
BlackGreyListResult bean = resultList.get(i);
ps.setString(1, bean.getReasons());
ps.setLong(2, bean.getId());
}else{
new SQLException("参数错误,必须传!");
}
ps.addBatch();
atomicInteger.getAndIncrement();
if (i > 0 && i % 500 == 0) {
ps.executeBatch();
conn.commit();
ps.clearBatch();
}
}
ps.executeBatch();
conn.commit();
} catch (Exception e) {
log.error("方法updateBatchExecute批量修改数据异常, type: {} ", type, e);
return 0;
} finally {
close(conn, ps, null);
}
return atomicInteger.get();
}
/** /**
* 关闭资源 * 关闭资源
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment