| 12345678910111213141516171819202122232425262728293031 |
- import java.sql.*;
- public class QueryArtificialWords {
- public static void main(String[] a) throws Exception {
- Class.forName("com.mysql.cj.jdbc.Driver");
- String jdbc = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/fs_tenant_cs1"
- + "?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
- String msg = "\u4f60\u597d\uff0c\u82b9\u83dc\u53ef\u4ee5\u6cbb\u7597\u7cd6\u5c3f\u75c5\u5417\uff1f";
- try (Connection c = DriverManager.getConnection(jdbc, "root", "Ylrz_1q2w3e4r5t6y");
- Statement st = c.createStatement()) {
- System.out.println("message=" + msg);
- ResultSet rs = st.executeQuery(
- "SELECT id, type, content, status FROM fastgpt_chat_artificial_words WHERE status=0 ORDER BY sort");
- while (rs.next()) {
- String content = rs.getString("content");
- if (content != null && msg.contains(content)) {
- System.out.println("MATCH id=" + rs.getLong("id") + " type=" + rs.getLong("type") + " content=" + content);
- }
- }
- System.out.println("\n--- handoff_trigger keywords ---");
- rs = st.executeQuery(
- "SELECT keyword FROM lobster_tenant_keywords WHERE category='handoff_trigger' AND enabled=1");
- while (rs.next()) {
- String kw = rs.getString(1);
- if (kw != null && msg.contains(kw)) {
- System.out.println("handoff MATCH: " + kw);
- }
- }
- }
- }
- }
|