import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
|
import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler;
|
import java.lang.reflect.Proxy;
|
import java.sql.*;
|
import java.io.*;
|
import java.util.*;
|
|
class VerifyFollowUpFields {
|
public static void main(String[] args) throws Exception {
|
var longHandler = new LongListTypeHandler();
|
var stringHandler = new StringListTypeHandler();
|
for (String value : List.of("[]", "", "1,2")) {
|
ResultSet mock = (ResultSet) Proxy.newProxyInstance(VerifyFollowUpFields.class.getClassLoader(),
|
new Class[]{ResultSet.class}, (proxy, method, parameters) -> value);
|
try {
|
System.out.println("LongList input='" + value + "' result=" + longHandler.getResult(mock, "ids"));
|
} catch (Exception error) {
|
System.out.println("LongList input='" + value + "' exception=" + error.getClass().getSimpleName() + ": " + error.getMessage());
|
}
|
}
|
String password = new BufferedReader(new InputStreamReader(System.in)).readLine();
|
try (Connection connection = DriverManager.getConnection("jdbc:mysql://36.213.150.237:10000/mom-hm?useUnicode=true&characterEncoding=UTF-8&connectTimeout=15000&socketTimeout=60000&allowPublicKeyRetrieval=true&useSSL=false", "root", password);
|
Statement statement = connection.createStatement();
|
ResultSet rows = statement.executeQuery("SELECT id, business_ids, contact_ids, pic_urls, creator FROM crm_follow_up_record WHERE deleted=0 AND biz_type=2 AND biz_id=1 ORDER BY id DESC LIMIT 20")) {
|
int count=0;
|
while (rows.next()) {
|
longHandler.getResult(rows, "business_ids");
|
longHandler.getResult(rows, "contact_ids");
|
stringHandler.getResult(rows, "pic_urls");
|
String creator = rows.getString("creator");
|
if (creator != null && !creator.isEmpty()) Long.valueOf(creator);
|
count++;
|
}
|
System.out.println("Customer 1 page field conversion passed; rows=" + count);
|
}
|
}
|
}
|