|
|
@ -58,9 +58,6 @@ public class CommonClearController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
// 监督检查清单
|
|
|
|
// 监督检查清单
|
|
|
|
put("supervisionChecklist", new TableInfo("power_energy_supervision_checklist", "监督检查清单", "ems/info:supervisionChecklist:remove"));
|
|
|
|
put("supervisionChecklist", new TableInfo("power_energy_supervision_checklist", "监督检查清单", "ems/info:supervisionChecklist:remove"));
|
|
|
|
|
|
|
|
|
|
|
|
// 备件库记录(特殊处理:需要级联删除明细表)
|
|
|
|
|
|
|
|
put("sparePartsInventory", new TableInfo("spare_parts_inventory", "备件库记录", "ems/info:sparePartsInventory:remove", true));
|
|
|
|
|
|
|
|
}};
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -105,14 +102,7 @@ public class CommonClearController extends BaseController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 执行清空操作
|
|
|
|
// 5. 执行清空操作
|
|
|
|
int result;
|
|
|
|
int result = commonClearService.clearTableData(tableName);
|
|
|
|
if (tableInfo.isCascadeDelete()) {
|
|
|
|
|
|
|
|
// 对于需要级联删除的表(如备件库记录),使用特殊处理
|
|
|
|
|
|
|
|
result = commonClearService.clearTableDataWithCascade(tableName, moduleKey);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 普通表直接清空
|
|
|
|
|
|
|
|
result = commonClearService.clearTableData(tableName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 6. 记录操作日志
|
|
|
|
// 6. 记录操作日志
|
|
|
|
logger.info("用户 {} 成功清空了 {} 表,影响行数: {}", getUsername(), tableInfo.getDisplayName(), result);
|
|
|
|
logger.info("用户 {} 成功清空了 {} 表,影响行数: {}", getUsername(), tableInfo.getDisplayName(), result);
|
|
|
@ -178,23 +168,16 @@ public class CommonClearController extends BaseController
|
|
|
|
private final String tableName; // 数据库表名
|
|
|
|
private final String tableName; // 数据库表名
|
|
|
|
private final String displayName; // 显示名称
|
|
|
|
private final String displayName; // 显示名称
|
|
|
|
private final String permission; // 所需权限
|
|
|
|
private final String permission; // 所需权限
|
|
|
|
private final boolean cascadeDelete; // 是否需要级联删除
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TableInfo(String tableName, String displayName, String permission) {
|
|
|
|
public TableInfo(String tableName, String displayName, String permission) {
|
|
|
|
this(tableName, displayName, permission, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TableInfo(String tableName, String displayName, String permission, boolean cascadeDelete) {
|
|
|
|
|
|
|
|
this.tableName = tableName;
|
|
|
|
this.tableName = tableName;
|
|
|
|
this.displayName = displayName;
|
|
|
|
this.displayName = displayName;
|
|
|
|
this.permission = permission;
|
|
|
|
this.permission = permission;
|
|
|
|
this.cascadeDelete = cascadeDelete;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getTableName() { return tableName; }
|
|
|
|
public String getTableName() { return tableName; }
|
|
|
|
public String getDisplayName() { return displayName; }
|
|
|
|
public String getDisplayName() { return displayName; }
|
|
|
|
public String getPermission() { return permission; }
|
|
|
|
public String getPermission() { return permission; }
|
|
|
|
public boolean isCascadeDelete() { return cascadeDelete; }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|