20260920220520
This commit is contained in:
1 parent
6f03d92425
commit
b3364fe6dc
44 files changed
+2313
-2737
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.
@@ -0,0 +1,93 @@
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
/** 只读核对:s_power / s_user_power / s_menu_module 现状,定位「菜单权限勾了不生效」的根因。 */
|
||||
public class PowerProbe {
|
||||
|
||||
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("=== 1. s_power 实际列名 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select column_name, data_type from information_schema.columns "
|
||||
+ "where table_name = 's_power' order by ordinal_position");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
System.out.printf(" %-20s %s%n", rs.getString(1), rs.getString(2));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("\n=== 2. s_power 按 b_object_type 统计 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_object_type, count(*) c from s_power group by b_object_type");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
System.out.printf(" %-10s %d%n", String.valueOf(rs.getString(1)), rs.getInt(2));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("\n=== 3. s_power 中 menu 类型明细 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_id, b_object_id, b_action, b_canuse from s_power "
|
||||
+ "where b_object_type = 'menu' order by b_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
int count = 0;
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
System.out.printf(" %-22s obj=%-14s action=%-8s canuse=%d%n",
|
||||
rs.getString("b_id"), rs.getString("b_object_id"),
|
||||
String.valueOf(rs.getString("b_action")), rs.getInt("b_canuse"));
|
||||
}
|
||||
System.out.println(" 共 " + count + " 行");
|
||||
}
|
||||
|
||||
System.out.println("\n=== 4. s_power 中 module 类型的 b_object_id(覆盖了哪些模块)===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select distinct b_object_id from s_power where b_object_type = 'module' order by b_object_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (rs.next()) {
|
||||
sb.append(rs.getString(1)).append(' ');
|
||||
}
|
||||
System.out.println(" " + sb);
|
||||
}
|
||||
|
||||
System.out.println("\n=== 5. 启用 page/external 菜单(应有对应 menu.* 权限点)===");
|
||||
int pageMenus = 0;
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_id, b_name, b_menu_type from s_menu "
|
||||
+ "where b_canuse = 1 and b_menu_type in ('page','external') order by b_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
pageMenus++;
|
||||
System.out.printf(" %-14s %-9s %s%n", rs.getString("b_id"),
|
||||
rs.getString("b_menu_type"), rs.getString("b_name"));
|
||||
}
|
||||
System.out.println(" 共 " + pageMenus + " 个");
|
||||
}
|
||||
|
||||
System.out.println("\n=== 6. s_user_power 明细 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_user_id, b_power_id, b_canuse from s_user_power order by b_user_id, b_power_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
int count = 0;
|
||||
while (rs.next()) {
|
||||
count++;
|
||||
System.out.printf(" %-8s %-34s canuse=%d%n", rs.getString("b_user_id"),
|
||||
rs.getString("b_power_id"), rs.getInt("b_canuse"));
|
||||
}
|
||||
System.out.println(" 共 " + count + " 行");
|
||||
}
|
||||
|
||||
System.out.println("\n=== 7. s_menu_module 按菜单统计 ===");
|
||||
try (PreparedStatement ps = conn.prepareStatement(
|
||||
"select b_menu_id, count(*) c from s_menu_module group by b_menu_id order by b_menu_id");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
System.out.printf(" %-14s %d 个模块%n", rs.getString(1), rs.getInt(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user