修正接口
This commit is contained in:
parent
7896c7c5c2
commit
6f4ea431f8
|
|
@ -5,4 +5,4 @@ VUE_APP_TITLE = 网站管理系统
|
|||
ENV = 'production'
|
||||
|
||||
# 管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
VUE_APP_BASE_API = 'http://1.15.149.240:8081'
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export function logout() {
|
|||
// 获取验证码
|
||||
export function getCodeImg() {
|
||||
return request({
|
||||
url: 'http://localhost:8081/captchaImage',
|
||||
url: 'http://1.15.149.240:8081/captchaImage',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
|
|||
|
||||
const name = process.env.VUE_APP_TITLE || '心理健康测评系统' // 网页标题
|
||||
|
||||
const baseUrl = 'http://localhost:8081' // 后端接口
|
||||
const baseUrl = 'http://1.15.149.240:8081' // 后端接口
|
||||
|
||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ry-news</artifactId>
|
||||
<artifactId>ry-xinli</artifactId>
|
||||
<groupId>com.ddnai</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ry-news-admin</artifactId>
|
||||
<artifactId>ry-xinli-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ referer:
|
|||
# 防盗链开关
|
||||
enabled: false
|
||||
# 允许的域名列表
|
||||
allowed-domains: localhost,127.0.0.1,ddnai.com,www.ddnai.com
|
||||
allowed-domains: localhost,127.0.0.1,1.15.149.240
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
|
|
|
|||
|
|
@ -1,220 +0,0 @@
|
|||
package com.ddnai.admin.tool;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单去重工具
|
||||
* 用于检测和清理数据库中重复的菜单
|
||||
* 可以直接运行此类来执行菜单去重
|
||||
*/
|
||||
public class MenuCleanupTool {
|
||||
|
||||
// 数据库连接信息
|
||||
private static final String URL = "jdbc:mysql://localhost:3306/ry_news?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true";
|
||||
private static final String USERNAME = "root";
|
||||
private static final String PASSWORD = "password"; // 请根据实际情况修改密码
|
||||
|
||||
public static void main(String[] args) {
|
||||
Connection conn = null;
|
||||
|
||||
try {
|
||||
// 加载数据库驱动
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
|
||||
// 建立数据库连接
|
||||
System.out.println("正在连接数据库...");
|
||||
conn = DriverManager.getConnection(URL, USERNAME, PASSWORD);
|
||||
System.out.println("数据库连接成功!");
|
||||
|
||||
// 1. 先检查重复菜单
|
||||
System.out.println("\n===============================================");
|
||||
System.out.println("开始检查重复菜单...");
|
||||
List<DuplicateMenuInfo> duplicates = checkDuplicateMenus(conn);
|
||||
|
||||
if (duplicates.isEmpty()) {
|
||||
System.out.println("未发现重复菜单!");
|
||||
} else {
|
||||
System.out.println("发现 " + duplicates.size() + " 组重复菜单:");
|
||||
for (DuplicateMenuInfo info : duplicates) {
|
||||
System.out.println("- 菜单名称: " + info.getMenuName() + ", 重复数量: " + info.getCount() + ", 菜单ID: " + info.getMenuIds());
|
||||
}
|
||||
|
||||
// 2. 执行去重操作
|
||||
System.out.println("\n===============================================");
|
||||
System.out.println("开始执行菜单去重...");
|
||||
int totalDeleted = cleanupDuplicateMenus(conn);
|
||||
System.out.println("\n菜单去重完成!共删除 " + totalDeleted + " 个重复菜单。");
|
||||
|
||||
// 3. 验证去重结果
|
||||
System.out.println("\n===============================================");
|
||||
System.out.println("验证去重结果...");
|
||||
List<DuplicateMenuInfo> afterCleanup = checkDuplicateMenus(conn);
|
||||
if (afterCleanup.isEmpty()) {
|
||||
System.out.println("验证成功!所有重复菜单已被清理。");
|
||||
} else {
|
||||
System.out.println("仍有 " + afterCleanup.size() + " 组重复菜单未被清理,请检查。");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("执行菜单去重时出错:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关闭数据库连接
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
System.out.println("\n数据库连接已关闭。");
|
||||
} catch (SQLException e) {
|
||||
System.err.println("关闭数据库连接时出错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查重复菜单
|
||||
*/
|
||||
private static List<DuplicateMenuInfo> checkDuplicateMenus(Connection conn) throws SQLException {
|
||||
List<DuplicateMenuInfo> duplicates = new ArrayList<>();
|
||||
|
||||
String sql = "SELECT " +
|
||||
" menu_name, " +
|
||||
" COUNT(*) AS count, " +
|
||||
" GROUP_CONCAT(menu_id ORDER BY menu_id SEPARATOR ', ') AS menu_ids " +
|
||||
"FROM sys_menu " +
|
||||
"WHERE menu_name LIKE '%心理%' " +
|
||||
" OR menu_name LIKE '%量表%' " +
|
||||
" OR menu_name LIKE '%题目%' " +
|
||||
" OR menu_name LIKE '%因子%' " +
|
||||
" OR menu_name LIKE '%测评%' " +
|
||||
" OR menu_name LIKE '%报告%' " +
|
||||
" OR menu_name LIKE '%解释%' " +
|
||||
" OR menu_name LIKE '%档案%' " +
|
||||
" OR menu_name LIKE '%问卷%' " +
|
||||
" OR menu_name LIKE '%网站%' " +
|
||||
" OR menu_name LIKE '%栏目%' " +
|
||||
" OR menu_name LIKE '%评论%' " +
|
||||
" OR menu_name LIKE '%预警%' " +
|
||||
"GROUP BY menu_name, path, component, parent_id " +
|
||||
"HAVING COUNT(*) > 1 " +
|
||||
"ORDER BY COUNT(*) DESC, menu_name";
|
||||
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
ResultSet rs = stmt.executeQuery()) {
|
||||
|
||||
while (rs.next()) {
|
||||
DuplicateMenuInfo info = new DuplicateMenuInfo();
|
||||
info.setMenuName(rs.getString("menu_name"));
|
||||
info.setCount(rs.getInt("count"));
|
||||
info.setMenuIds(rs.getString("menu_ids"));
|
||||
duplicates.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
return duplicates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行菜单去重
|
||||
*/
|
||||
private static int cleanupDuplicateMenus(Connection conn) throws SQLException {
|
||||
int totalDeleted = 0;
|
||||
|
||||
// 1. 删除"心理测评管理"目录的重复项(保留第一个)
|
||||
String sql1 = "DELETE t1 FROM sys_menu t1 " +
|
||||
"INNER JOIN sys_menu t2 " +
|
||||
"WHERE t1.menu_name = '心理测评管理' " +
|
||||
" AND t1.parent_id = 0 " +
|
||||
" AND t2.menu_name = '心理测评管理' " +
|
||||
" AND t2.parent_id = 0 " +
|
||||
" AND t1.menu_id > t2.menu_id";
|
||||
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql1)) {
|
||||
int deleted1 = stmt.executeUpdate();
|
||||
totalDeleted += deleted1;
|
||||
System.out.println("删除重复的'心理测评管理'目录: " + deleted1 + " 个");
|
||||
}
|
||||
|
||||
// 2. 删除"心理网站管理"目录的重复项
|
||||
String sql2 = "DELETE t1 FROM sys_menu t1 " +
|
||||
"INNER JOIN sys_menu t2 " +
|
||||
"WHERE t1.menu_name = '心理网站管理' " +
|
||||
" AND t1.parent_id = 0 " +
|
||||
" AND t2.menu_name = '心理网站管理' " +
|
||||
" AND t2.parent_id = 0 " +
|
||||
" AND t1.menu_id > t2.menu_id";
|
||||
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql2)) {
|
||||
int deleted2 = stmt.executeUpdate();
|
||||
totalDeleted += deleted2;
|
||||
System.out.println("删除重复的'心理网站管理'目录: " + deleted2 + " 个");
|
||||
}
|
||||
|
||||
// 3. 删除其他重复菜单(基于path和component)
|
||||
String sql3 = "DELETE t1 FROM sys_menu t1 " +
|
||||
"INNER JOIN sys_menu t2 " +
|
||||
"WHERE t1.path = t2.path " +
|
||||
" AND t1.component = t2.component " +
|
||||
" AND t1.menu_name = t2.menu_name " +
|
||||
" AND t1.menu_id > t2.menu_id " +
|
||||
" AND (t1.menu_name LIKE '%心理%' " +
|
||||
" OR t1.menu_name LIKE '%量表%' " +
|
||||
" OR t1.menu_name LIKE '%题目%' " +
|
||||
" OR t1.menu_name LIKE '%因子%' " +
|
||||
" OR t1.menu_name LIKE '%测评%' " +
|
||||
" OR t1.menu_name LIKE '%网站%' " +
|
||||
" OR t1.menu_name LIKE '%栏目%' " +
|
||||
" OR t1.menu_name LIKE '%评论%' " +
|
||||
" OR t1.menu_name LIKE '%预警%' " +
|
||||
" OR t1.menu_name LIKE '%问卷%' " +
|
||||
" OR t1.menu_name LIKE '%档案%')";
|
||||
|
||||
try (PreparedStatement stmt = conn.prepareStatement(sql3)) {
|
||||
int deleted3 = stmt.executeUpdate();
|
||||
totalDeleted += deleted3;
|
||||
System.out.println("删除其他重复菜单: " + deleted3 + " 个");
|
||||
}
|
||||
|
||||
return totalDeleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重复菜单信息类
|
||||
*/
|
||||
static class DuplicateMenuInfo {
|
||||
private String menuName;
|
||||
private int count;
|
||||
private String menuIds;
|
||||
|
||||
public String getMenuName() {
|
||||
return menuName;
|
||||
}
|
||||
|
||||
public void setMenuName(String menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getMenuIds() {
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
public void setMenuIds(String menuIds) {
|
||||
this.menuIds = menuIds;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user