mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-08-01 08:52:11 +08:00
Fix some team project bugs
This commit is contained in:
@ -0,0 +1,23 @@
|
|||||||
|
package ai.chat2db.server.domain.api.param.dashboard;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* selectro
|
||||||
|
*
|
||||||
|
* @author Jiaju Zhuang
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DashboardSelector {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图表ID列表
|
||||||
|
*/
|
||||||
|
private Boolean chartIds;
|
||||||
|
}
|
@ -45,6 +45,7 @@ public interface DashboardService {
|
|||||||
* 查询一条数据
|
* 查询一条数据
|
||||||
*
|
*
|
||||||
* @param param
|
* @param param
|
||||||
|
* @param selector
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DataResult<Dashboard> queryExistent(@NotNull DashboardQueryParam param);
|
DataResult<Dashboard> queryExistent(@NotNull DashboardQueryParam param);
|
||||||
|
@ -102,7 +102,14 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
if (CollectionUtils.isEmpty(page.getRecords())) {
|
if (CollectionUtils.isEmpty(page.getRecords())) {
|
||||||
throw new DataNotFoundException();
|
throw new DataNotFoundException();
|
||||||
}
|
}
|
||||||
return DataResult.of(dashboardConverter.do2model(page.getRecords().get(0)));
|
Dashboard data = dashboardConverter.do2model(page.getRecords().get(0));
|
||||||
|
LambdaQueryWrapper<DashboardChartRelationDO> dashboardChartRelationQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
dashboardChartRelationQueryWrapper.eq(DashboardChartRelationDO::getDashboardId, param.getId());
|
||||||
|
List<DashboardChartRelationDO> relationDO = dashboardChartRelationMapper.selectList(
|
||||||
|
dashboardChartRelationQueryWrapper);
|
||||||
|
List<Long> chartIds = relationDO.stream().map(DashboardChartRelationDO::getChartId).toList();
|
||||||
|
data.setChartIds(chartIds);
|
||||||
|
return DataResult.of(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,6 +37,13 @@ public class Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String currentVersion = ConfigUtils.getLocalVersion();
|
String currentVersion = ConfigUtils.getLocalVersion();
|
||||||
ConfigJson configJson = ConfigUtils.getConfig();
|
ConfigJson configJson = ConfigUtils.getConfig();
|
||||||
|
|
||||||
|
// The unique ID of the entire system will not change after multiple starts
|
||||||
|
if (StringUtils.isBlank(configJson.getSystemUuid())) {
|
||||||
|
configJson.setSystemUuid(UUID.fastUUID().toString(true));
|
||||||
|
ConfigUtils.setConfig(configJson);
|
||||||
|
}
|
||||||
|
|
||||||
// Represents that the current version has been successfully launched
|
// Represents that the current version has been successfully launched
|
||||||
if (StringUtils.isNotBlank(currentVersion) && StringUtils.equals(currentVersion,
|
if (StringUtils.isNotBlank(currentVersion) && StringUtils.equals(currentVersion,
|
||||||
configJson.getLatestStartupSuccessVersion())) {
|
configJson.getLatestStartupSuccessVersion())) {
|
||||||
|
@ -25,4 +25,9 @@ public class ConfigJson {
|
|||||||
* jwt
|
* jwt
|
||||||
*/
|
*/
|
||||||
private String jwtSecretKey;
|
private String jwtSecretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique ID of the system
|
||||||
|
*/
|
||||||
|
private String systemUuid;
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,19 @@
|
|||||||
* Alipay.com Inc.
|
* Alipay.com Inc.
|
||||||
* Copyright (c) 2004-2022 All Rights Reserved.
|
* Copyright (c) 2004-2022 All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
package ai.chat2db.server.web.api.controller;
|
package ai.chat2db.server.web.api.controller.system;
|
||||||
|
|
||||||
import ai.chat2db.server.domain.core.cache.CacheManage;
|
import ai.chat2db.server.domain.core.cache.CacheManage;
|
||||||
import ai.chat2db.server.tools.base.wrapper.result.DataResult;
|
import ai.chat2db.server.tools.base.wrapper.result.DataResult;
|
||||||
import ai.chat2db.server.tools.common.config.Chat2dbProperties;
|
import ai.chat2db.server.tools.common.config.Chat2dbProperties;
|
||||||
import ai.chat2db.server.tools.common.util.I18nUtils;
|
import ai.chat2db.server.tools.common.model.ConfigJson;
|
||||||
|
import ai.chat2db.server.tools.common.util.ConfigUtils;
|
||||||
|
import ai.chat2db.server.web.api.controller.system.vo.SystemVO;
|
||||||
import ai.chat2db.spi.ssh.SSHManager;
|
import ai.chat2db.spi.ssh.SSHManager;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -39,8 +40,11 @@ public class SystemController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public DataResult<String> get() {
|
public DataResult<SystemVO> get() {
|
||||||
return DataResult.of("success");
|
ConfigJson configJson = ConfigUtils.getConfig();
|
||||||
|
return DataResult.of(SystemVO.builder()
|
||||||
|
.systemUuid(configJson.getSystemUuid())
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -0,0 +1,22 @@
|
|||||||
|
package ai.chat2db.server.web.api.controller.system.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* system
|
||||||
|
*
|
||||||
|
* @author Jiaju Zhuang
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SystemVO {
|
||||||
|
/**
|
||||||
|
* The unique ID of the system
|
||||||
|
*/
|
||||||
|
private String systemUuid;
|
||||||
|
}
|
Reference in New Issue
Block a user