Commit 896f5578 authored by 黎博's avatar 黎博

新增非空判断

parent 923f9a08
...@@ -115,11 +115,13 @@ public class ClearDataController { ...@@ -115,11 +115,13 @@ public class ClearDataController {
log.info("开始删除{}环境{}用户xyqb_user中的数据!", namespace, phoneNo); log.info("开始删除{}环境{}用户xyqb_user中的数据!", namespace, phoneNo);
SwitchDataSource.dataSourceSwitch(namespace, "xyqb_user"); SwitchDataSource.dataSourceSwitch(namespace, "xyqb_user");
List<Map<String, Object>> productLoginList = jdbcTemplate.queryForList("SELECT * FROM `product_login` WHERE EXTENSION_ACCOUNT_ID = " + userId); List<Map<String, Object>> productLoginList = jdbcTemplate.queryForList("SELECT * FROM `product_login` WHERE EXTENSION_ACCOUNT_ID = " + userId);
for (Map<String, Object> productLogin: productLoginList) { if (productLoginList.size() > 0) {
String customerId = productLogin.get("CUSTOMER_ID").toString(); for (Map<String, Object> productLogin: productLoginList) {
jdbcTemplate.execute(String.format("DELETE FROM `product_login` WHERE CUSTOMER_ID = '%s'", customerId)); String customerId = productLogin.get("CUSTOMER_ID").toString();
jdbcTemplate.execute(String.format("DELETE FROM `customer_login` WHERE CUSTOMER_ID = '%s'", customerId)); jdbcTemplate.execute(String.format("DELETE FROM `product_login` WHERE CUSTOMER_ID = '%s'", customerId));
jdbcTemplate.execute(String.format("DELETE FROM `customer_info` WHERE CUSTOMER_ID = '%s'", customerId)); jdbcTemplate.execute(String.format("DELETE FROM `customer_login` WHERE CUSTOMER_ID = '%s'", customerId));
jdbcTemplate.execute(String.format("DELETE FROM `customer_info` WHERE CUSTOMER_ID = '%s'", customerId));
}
} }
jdbcTemplate.execute("DELETE FROM `user` WHERE id = " + userId); jdbcTemplate.execute("DELETE FROM `user` WHERE id = " + userId);
jdbcTemplate.execute("DELETE FROM `user_detail` WHERE user_id = " + userId); jdbcTemplate.execute("DELETE FROM `user_detail` WHERE user_id = " + userId);
......
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