20260920173439
This commit is contained in:
1 parent
f4bfc1ddfc
commit
6f03d92425
174 files changed
+23490
-157
No files matched your search
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
import java.sql.*;
|
||||
|
||||
/** 只读核对:s_menu 全量父子关系、路由、path,确认哪些节点挂错了父级。 */
|
||||
public class CheckMenuTree {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String url = "jdbc:sqlserver://118.89.70.199:1433;databaseName=FMS;encrypt=true;trustServerCertificate=true";
|
||||
try (Connection conn = DriverManager.getConnection(url, "sa", System.getenv("FMS_SA_PWD"))) {
|
||||
|
||||
System.out.println("=== s_menu 全量(按现有 b_parent_id 展开)===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_id, b_name, b_parent_id, b_depth, b_path, b_route, b_menu_type, b_canuse, b_xh "
|
||||
+ "from s_menu order by b_depth, b_xh, b_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
System.out.printf(" id=%-12s name=%-10s parent=%-10s depth=%-2d canuse=%d%n",
|
||||
rs.getString("b_id"), rs.getString("b_name"),
|
||||
String.valueOf(rs.getString("b_parent_id")),
|
||||
rs.getInt("b_depth"), rs.getInt("b_canuse"));
|
||||
System.out.printf(" path=%-28s route=%-26s type=%s%n",
|
||||
rs.getString("b_path"), String.valueOf(rs.getString("b_route")),
|
||||
rs.getString("b_menu_type"));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("\n=== 路由前缀 vs 父级 一致性检查 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select m.b_id, m.b_name, m.b_parent_id, m.b_route, m.b_path, "
|
||||
+ "p.b_name as parent_name, p.b_path as parent_path "
|
||||
+ "from s_menu m left join s_menu p on p.b_id = m.b_parent_id "
|
||||
+ "where m.b_route is not null order by m.b_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
String route = String.valueOf(rs.getString("b_route"));
|
||||
String parentPath = String.valueOf(rs.getString("parent_path"));
|
||||
// 路由首段(/base/othercompany -> base)与父级 path 段比对
|
||||
String routeSeg = route.split("/").length > 1 ? route.split("/")[1] : "";
|
||||
String parentSeg = parentPath.split("/").length > 1 ? parentPath.split("/")[1] : "";
|
||||
boolean mismatch = !routeSeg.isEmpty() && !parentSeg.isEmpty()
|
||||
&& !routeSeg.equals(parentSeg);
|
||||
System.out.printf(" %-12s route=%-24s 父=%-10s(父path=%-16s) %s%n",
|
||||
rs.getString("b_id"), route,
|
||||
String.valueOf(rs.getString("parent_name")),
|
||||
parentPath,
|
||||
mismatch ? " <== 不一致" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user