mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-30 03:03:13 +08:00
Supports fuzzy query of table names, not case sensitive.
Automatically add pagination parameters when users query SQL without pagination parameters. Sort the database schema and prioritize the user-defined ones.
This commit is contained in:
@ -1,21 +1,42 @@
|
||||
package ai.chat2db.server.web.api.controller.system;
|
||||
|
||||
import ai.chat2db.server.tools.common.util.ConfigUtils;
|
||||
import ai.chat2db.server.web.api.controller.system.util.SystemUtils;
|
||||
import ai.chat2db.server.web.api.controller.system.vo.AppVersionVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutomaticUpgrade {
|
||||
|
||||
@Scheduled(fixedRate = 3600000) // 每小时运行一次
|
||||
public void checkVersionUpdates() {
|
||||
AppVersionVO appVersion = SystemUtils.getLatestVersion(ConfigUtils.getLocalVersion(), "auto", "");
|
||||
if (appVersion != null) {
|
||||
SystemUtils.upgrade(appVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
////package ai.chat2db.server.web.api.controller.system;
|
||||
////
|
||||
////import ai.chat2db.server.tools.common.util.ConfigUtils;
|
||||
////import ai.chat2db.server.web.api.controller.system.util.SystemUtils;
|
||||
////import ai.chat2db.server.web.api.controller.system.vo.AppVersionVO;
|
||||
////import lombok.extern.slf4j.Slf4j;
|
||||
////import org.springframework.scheduling.annotation.Scheduled;
|
||||
////import org.springframework.stereotype.Component;
|
||||
////
|
||||
////@Slf4j
|
||||
////@Component
|
||||
////public class AutomaticUpgrade {
|
||||
////
|
||||
//// @Scheduled(fixedRate = 3600000) // 每小时运行一次
|
||||
//// public void checkVersionUpdates() {
|
||||
//// AppVersionVO appVersion = SystemUtils.getLatestVersion(ConfigUtils.getLocalVersion(), "auto", "");
|
||||
//// if (appVersion != null) {
|
||||
//// SystemUtils.upgrade(appVersion);
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
//
|
||||
//const handleInsertText = (text, databaseCode: DatabaseTypeCode = DatabaseTypeCode.MYSQL) => {
|
||||
// if (
|
||||
// [DatabaseTypeCode.POSTGRESQL, DatabaseTypeCode.ORACLE, DatabaseTypeCode.DB2, DatabaseTypeCode.SQLITE].includes(
|
||||
// databaseCode,
|
||||
// )
|
||||
// ) {
|
||||
// return `\"${text}\"`;
|
||||
// } else if ([DatabaseTypeCode.SQLSERVER].includes(databaseCode)) {
|
||||
// return `[${text}]`;
|
||||
// } else if ([DatabaseTypeCode.MYSQL].includes(databaseCode)) {
|
||||
// return `\`${text}\``;
|
||||
// } else {
|
||||
// return `${text}`;
|
||||
// }
|
||||
// };
|
||||
//
|
||||
//"" oracele sqlite postgrsql h2 dm
|
||||
// ` MYSQL clickhouse MariaDB
|
||||
// [ sqlserver
|
||||
//
|
||||
|
Reference in New Issue
Block a user