|
|
|
@ -0,0 +1,69 @@
|
|
|
|
|
package UnitTest;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect;
|
|
|
|
|
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
import static com.dsideal.QingLong.Const.DbConst.MASTER;
|
|
|
|
|
|
|
|
|
|
public class ZhuangJaiLingYu {
|
|
|
|
|
public static HikariCpPlugin createDruidPlugin(String url, String username, String password, String driverClass) {
|
|
|
|
|
HikariCpPlugin hp = new HikariCpPlugin(url, username, password, driverClass);
|
|
|
|
|
return hp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String replaceMultipleSpaces(String input) {
|
|
|
|
|
Pattern pattern = Pattern.compile("\\s+");
|
|
|
|
|
Matcher matcher = pattern.matcher(input);
|
|
|
|
|
return matcher.replaceAll(" ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
String masterUrl = "jdbc:postgresql://10.10.14.71:5432/szjz_db";
|
|
|
|
|
String passWord = "DsideaL147258369";
|
|
|
|
|
|
|
|
|
|
String driverClass = "org.postgresql.Driver";
|
|
|
|
|
String userName = "postgres";
|
|
|
|
|
|
|
|
|
|
HikariCpPlugin druidMaster = createDruidPlugin(masterUrl, userName, passWord, driverClass);
|
|
|
|
|
druidMaster.start();
|
|
|
|
|
|
|
|
|
|
ActiveRecordPlugin arpMaster = new ActiveRecordPlugin(MASTER, druidMaster);
|
|
|
|
|
arpMaster.setDevMode(false);
|
|
|
|
|
arpMaster.setDialect(new PostgreSqlDialect());
|
|
|
|
|
arpMaster.start();
|
|
|
|
|
|
|
|
|
|
String sql = "select * from t_zhuangjia_base";
|
|
|
|
|
List<Record> list = Db.find(sql);
|
|
|
|
|
|
|
|
|
|
Set<String> set=new HashSet<>();
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
if (record.getStr("ly")!=null && !record.getStr("ly").isEmpty()) {
|
|
|
|
|
String ly = replaceMultipleSpaces(record.getStr("ly"));
|
|
|
|
|
ly=ly.replace(",",",");
|
|
|
|
|
ly = ly.replace(" ", ",");
|
|
|
|
|
ly=ly.replace(",,",",");
|
|
|
|
|
|
|
|
|
|
for (String s : ly.split(",")) {
|
|
|
|
|
set.add(s);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
System.out.println(record.getInt("person_id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (String s : set) {
|
|
|
|
|
System.out.println(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|