ProbeSimulateLiquor.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import java.sql.*;
  2. public class ProbeSimulateLiquor {
  3. public static void main(String[] a) throws Exception {
  4. Class.forName("com.mysql.cj.jdbc.Driver");
  5. try (Connection master = DriverManager.getConnection(
  6. "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8",
  7. "root", "Ylrz_1q2w3e4r5t6y")) {
  8. try (Statement st = master.createStatement()) {
  9. ResultSet rs = st.executeQuery(
  10. "SELECT id, tenant_code, db_url FROM tenant_info WHERE status=1 AND id=33");
  11. if (rs.next()) {
  12. System.out.println("tenant=" + rs.getLong(1) + " code=" + rs.getString(2)
  13. + " db=" + rs.getString(3));
  14. }
  15. }
  16. }
  17. try (Connection tenant = DriverManager.getConnection(
  18. "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/fs_tenant_cs1?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8",
  19. "root", "Ylrz_1q2w3e4r5t6y")) {
  20. try (Statement st = tenant.createStatement()) {
  21. System.out.println("=== users ===");
  22. ResultSet rs = st.executeQuery(
  23. "SELECT user_id, user_name, nick_name, status FROM company_user WHERE del_flag='0' LIMIT 5");
  24. while (rs.next()) {
  25. System.out.println(rs.getLong(1) + " | " + rs.getString(2) + " | " + rs.getString(3));
  26. }
  27. System.out.println("=== templates liquor ===");
  28. rs = st.executeQuery(
  29. "SELECT id, template_name, industry_type, status FROM company_workflow_lobster "
  30. + "WHERE status=1 AND (industry_type='liquor' OR template_name LIKE '%酒%' OR template_name LIKE '%白酒%') "
  31. + "ORDER BY id DESC LIMIT 10");
  32. while (rs.next()) {
  33. System.out.println(rs.getLong(1) + " | " + rs.getString(2) + " | industry=" + rs.getString(3));
  34. }
  35. System.out.println("=== all active templates ===");
  36. rs = st.executeQuery(
  37. "SELECT id, template_name, industry_type FROM company_workflow_lobster WHERE status=1 ORDER BY id DESC LIMIT 8");
  38. while (rs.next()) {
  39. System.out.println(rs.getLong(1) + " | " + rs.getString(2) + " | " + rs.getString(3));
  40. }
  41. }
  42. }
  43. }
  44. }