QueryAdminMenus13.java 1.6 KB

1234567891011121314151617181920212223242526272829
  1. import java.sql.*;
  2. public class QueryAdminMenus13 {
  3. public static void main(String[] args) throws Exception {
  4. String url = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
  5. try (Connection c = DriverManager.getConnection(url, "root", "Ylrz_1q2w3e4r5t6y");
  6. Statement st = c.createStatement()) {
  7. try (ResultSet rs = st.executeQuery(
  8. "SELECT menu_id, menu_name, parent_id, path, component FROM sys_menu "
  9. + "WHERE parent_id=2800 AND visible='0' AND status='0' AND menu_type='M' ORDER BY order_num")) {
  10. System.out.println("=== direct children of admin 2800 ===");
  11. while (rs.next()) {
  12. System.out.printf("%s | %s | path=%s | comp=%s%n",
  13. rs.getString(1), rs.getString(2), rs.getString(4), rs.getString(5));
  14. }
  15. }
  16. try (ResultSet rs = st.executeQuery(
  17. "SELECT menu_id, menu_name, parent_id, path, component FROM sys_menu "
  18. + "WHERE path='shezhi' OR menu_name LIKE '%\\u7cfb\\u7edf\\u914d\\u7f6e%'")) {
  19. System.out.println("=== shezhi path or name ===");
  20. while (rs.next()) {
  21. System.out.printf("%s | %s | parent=%s | path=%s | comp=%s%n",
  22. rs.getString(1), rs.getString(2), rs.getString(3),
  23. rs.getString(4), rs.getString(5));
  24. }
  25. }
  26. }
  27. }
  28. }