This commit is contained in:
zlwu committed 2025-08-13 15:02:40 +08:00
commit 8390bc34c1
6 files changed
+53 -24

No files matched your search

+6
View File
@@ -135,6 +135,12 @@
<version>${revision}</version>
</dependency>
<!-- 学生考核管理模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-xskh</artifactId>
<version>${revision}</version>
</dependency>
<!-- 奖惩补贴管理模块 -->
<dependency>
<groupId>org.dromara</groupId>
@@ -79,7 +79,7 @@ public class AuthController {
* @param body 登录信息
* @return 结果
*/
@ApiEncrypt(response = true)
// @ApiEncrypt(response = true) // 临时移除加密,待完善加密实现后恢复
@PostMapping("/login")
public R<LoginVo> login(@RequestBody String body) {
LoginBody loginBody = JsonUtils.parseObject(body, LoginBody.class);
@@ -190,7 +190,7 @@ mybatis-encryptor:
# api接口加密
api-decrypt:
# 是否开启全局接口加密
enabled: true
enabled: true # 恢复为true,保持其他接口的安全性
# AES 加密头标识
headerFlag: encrypt-key
# 响应加密公钥 非对称算法的公私钥 如:SM2,RSA 使用者请自行更换
@@ -1,18 +1,15 @@
package org.dromara.rs.controller;
import org.dromara.common.core.domain.R;
import org.dromara.rs.mapper.RsSystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
@@ -27,7 +24,7 @@ import java.util.Map;
public class SqlUpdateController {
@Autowired
private DataSource dataSource;
private RsSystemMapper rsSystemMapper;
/**
* 执行培训模块SQL更新脚本
@@ -57,7 +54,10 @@ public class SqlUpdateController {
// 如果是SQL语句结束
if (line.trim().endsWith(";")) {
String sql = sb.toString();
String sql = sb.toString().trim();
if (sql.endsWith(";")) {
sql = sql.substring(0, sql.length() - 1); // 移除分号,MyBatis会自动处理
}
executeSql(sql);
sb = new StringBuilder();
}
@@ -77,16 +77,12 @@ public class SqlUpdateController {
/**
* 执行单条SQL语句
*/
private void executeSql(String sql) throws SQLException {
try (Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement()) {
// 忽略SQL错误(如字段已存在)
private void executeSql(String sql) {
try {
stmt.execute(sql);
} catch (SQLException e) {
rsSystemMapper.executeSql(sql);
} catch (Exception e) {
// 记录错误但继续执行
System.out.println("SQL执行警告: " + e.getMessage());
}
}
}
}
@@ -1,13 +1,12 @@
package org.dromara.rs.util;
import org.dromara.rs.mapper.RsSystemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.init.ScriptUtils;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* SQL脚本执行工具
@@ -16,17 +15,41 @@ import java.sql.SQLException;
public class SqlScriptRunner {
@Autowired
private DataSource dataSource;
private RsSystemMapper rsSystemMapper;
/**
* 执行SQL脚本
*
* @param scriptPath 脚本路径(相对于classpath)
* @throws SQLException SQL执行异常
* @throws Exception 执行异常
*/
public void executeScript(String scriptPath) throws SQLException {
try (Connection connection = dataSource.getConnection()) {
ScriptUtils.executeSqlScript(connection, new ClassPathResource(scriptPath));
public void executeScript(String scriptPath) throws Exception {
ClassPathResource resource = new ClassPathResource(scriptPath);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream()))) {
StringBuilder sb = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
// 忽略注释行和空行
if (line.trim().startsWith("--") || line.trim().isEmpty()) {
continue;
}
sb.append(line);
// 如果是SQL语句结束
if (line.trim().endsWith(";")) {
String sql = sb.toString().trim();
if (sql.endsWith(";")) {
sql = sql.substring(0, sql.length() - 1); // 移除分号,MyBatis会自动处理
}
try {
rsSystemMapper.executeSql(sql);
} catch (Exception e) {
// 记录错误但继续执行
System.out.println("SQL执行警告: " + e.getMessage());
}
sb = new StringBuilder();
}
}
}
}
}
@@ -353,6 +353,9 @@
</template>
<script setup name="OverseasApproval">
<<<<<<< HEAD
import { listOverseasApproval, getOverseasApproval, delOverseasApproval, addOverseasApproval, updateOverseasApproval } from '@/api/rs/overseas';
=======
import {
listOverseasApproval,
// listCombinedOverseasApproval,
@@ -361,6 +364,7 @@ import {
addOverseasApproval,
updateOverseasApproval
} from '@/api/rs/overseas';
>>>>>>> 1bf7f78c979c08f8724f927d948bbc7b87d77176
import { ref, reactive, toRefs, onMounted, getCurrentInstance, nextTick } from 'vue';
import { parseTime } from '@/utils/ruoyi';