| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import java.sql.*;
- public class QueryAdminMenus5 {
- public static void main(String[] args) throws Exception {
- String url = "jdbc:mysql://cq-cdb-8fjmemkb.sql.tencentcdb.com:27220/ylrz_saas?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
- try (Connection c = DriverManager.getConnection(url, "root", "Ylrz_1q2w3e4r5t6y");
- Statement st = c.createStatement()) {
- System.out.println("=== menu_name contains shengji (upgrade) ===");
- try (ResultSet rs = st.executeQuery(
- "SELECT menu_id, menu_name, parent_id, path, component, icon, visible, menu_type "
- + "FROM sys_menu WHERE menu_name LIKE '%"
- + "\u5347\u7ea7" + "%' ORDER BY menu_id")) {
- while (rs.next()) {
- System.out.printf("%s | %s | parent=%s | path=%s | comp=%s | icon=%s | type=%s%n",
- rs.getString(1), rs.getString(2), rs.getString(3),
- rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(8));
- }
- }
- System.out.println("\n=== verify components exist ===");
- String[][] rows = {
- {"32850", "saas/tenant/upgrade/index"},
- {"2816", "system/dict/index"},
- };
- try (PreparedStatement ps = c.prepareStatement("SELECT menu_id, menu_name, component FROM sys_menu WHERE menu_id=?")) {
- for (String[] r : rows) {
- ps.setString(1, r[0]);
- try (ResultSet rs = ps.executeQuery()) {
- if (rs.next()) {
- String comp = rs.getString(3);
- java.nio.file.Path p = java.nio.file.Paths.get(
- "d:/ylrz_saas_new/adminui/src/views/" + comp + ".vue");
- System.out.println(rs.getString(1) + " " + rs.getString(2) + " -> " + comp
- + " file=" + (java.nio.file.Files.exists(p) ? "OK" : "MISSING"));
- }
- }
- }
- }
- System.out.println("\n=== all visible C menus with component not matching existing vue file (sample) ===");
- try (ResultSet rs = st.executeQuery(
- "SELECT menu_id, menu_name, component FROM sys_menu "
- + "WHERE menu_type='C' AND visible='0' AND status='0' "
- + "AND component IS NOT NULL AND component <> '' "
- + "AND component LIKE '%/index' "
- + "ORDER BY menu_id")) {
- int missing = 0;
- while (rs.next() && missing < 30) {
- String comp = rs.getString(3);
- java.nio.file.Path p = java.nio.file.Paths.get(
- "d:/ylrz_saas_new/adminui/src/views/" + comp + ".vue");
- if (!java.nio.file.Files.exists(p)) {
- // try without /index
- p = java.nio.file.Paths.get(
- "d:/ylrz_saas_new/adminui/src/views/" + comp.replace("/index", "") + "/index.vue");
- }
- if (!java.nio.file.Files.exists(p)) {
- System.out.printf("404? %s | %s | %s%n",
- rs.getString(1), rs.getString(2), comp);
- missing++;
- }
- }
- }
- }
- }
- }
|