QuickMenuQ.java 999 B

1234567891011121314151617181920
  1. import java.sql.*;
  2. public class Q {
  3. static final String U = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/%s?useSSL=false&serverTimezone=GMT%%2B8&characterEncoding=utf8";
  4. public static void main(String[] a) throws Exception {
  5. query("tenant_sys_menu", "ylrz_saas");
  6. query("company_menu", "fs_tenant_cs1");
  7. }
  8. static void query(String t, String db) throws Exception {
  9. System.out.println("\n## " + db + "." + t);
  10. try (Connection c = DriverManager.getConnection(String.format(U, db), "root", "Ylrz_1q2w3e4r5t6y");
  11. ResultSet rs = c.createStatement().executeQuery(
  12. "SELECT menu_id, menu_name, path, component, visible, status FROM "+t+
  13. " WHERE menu_id=29900 OR parent_id=29900 ORDER BY parent_id, order_num, menu_id")) {
  14. while (rs.next()) {
  15. System.out.printf("%d\t%s\t%s\t%s\tvis=%s\tst=%s%n",
  16. rs.getLong(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6));
  17. }
  18. }
  19. }
  20. }