|
|
@@ -1,9 +1,9 @@
|
|
|
package cn.reghao.devops.web.mgr.app.db.query.impl;
|
|
|
|
|
|
import cn.reghao.devops.web.mgr.app.db.query.AppBuildQuery;
|
|
|
+import cn.reghao.devops.web.mgr.app.db.query.AppDeployQuery;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.AppBuildingRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.config.AppConfigRepository;
|
|
|
-import cn.reghao.devops.web.mgr.app.db.repository.config.AppDeployConfigRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.db.repository.log.BuildLogRepository;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.AppBuilding;
|
|
|
import cn.reghao.devops.web.mgr.app.model.po.config.AppConfig;
|
|
|
@@ -34,16 +34,16 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class AppBuildQueryImpl implements AppBuildQuery {
|
|
|
private final AppConfigRepository appConfigRepository;
|
|
|
- private final AppDeployConfigRepository deployConfigRepository;
|
|
|
private final AppBuildingRepository buildingRepository;
|
|
|
private final BuildLogRepository buildLogRepository;
|
|
|
+ private final AppDeployQuery appDeployQuery;
|
|
|
|
|
|
- public AppBuildQueryImpl(AppConfigRepository appConfigRepository, AppDeployConfigRepository deployConfigRepository,
|
|
|
- AppBuildingRepository buildingRepository, BuildLogRepository buildLogRepository) {
|
|
|
+ public AppBuildQueryImpl(AppConfigRepository appConfigRepository, AppBuildingRepository buildingRepository,
|
|
|
+ BuildLogRepository buildLogRepository, AppDeployQuery appDeployQuery) {
|
|
|
this.appConfigRepository = appConfigRepository;
|
|
|
- this.deployConfigRepository = deployConfigRepository;
|
|
|
this.buildingRepository = buildingRepository;
|
|
|
this.buildLogRepository = buildLogRepository;
|
|
|
+ this.appDeployQuery = appDeployQuery;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -73,7 +73,7 @@ public class AppBuildQueryImpl implements AppBuildQuery {
|
|
|
|
|
|
//@Cacheable({"appId"})
|
|
|
@Override
|
|
|
- public AppConfig findByAppId(String appId) {
|
|
|
+ public AppConfig getAppConfig(String appId) {
|
|
|
return appConfigRepository.findByDeletedFalseAndAppId(appId);
|
|
|
}
|
|
|
|
|
|
@@ -82,7 +82,7 @@ public class AppBuildQueryImpl implements AppBuildQuery {
|
|
|
Page<AppConfig> page = appConfigRepository.findByEnvAndAppType(env, type, pageable);
|
|
|
List<AppConfigVO> list = page.stream()
|
|
|
.map(appConfig -> {
|
|
|
- int total = deployConfigRepository.countByAppConfig(appConfig);
|
|
|
+ int total = appDeployQuery.countByApp(appConfig);
|
|
|
return new AppConfigVO(appConfig, total);
|
|
|
})
|
|
|
.collect(Collectors.toList());
|
|
|
@@ -124,12 +124,6 @@ public class AppBuildQueryImpl implements AppBuildQuery {
|
|
|
return new PageImpl<>(list, pageRequest, page.getTotalElements());
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public AppConfig getAppConfig(String appId) {
|
|
|
- AppBuilding appBuilding1 = buildingRepository.findAllByAppConfig_AppId(appId);
|
|
|
- return appBuilding1.getAppConfig();
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public boolean isBuilding(String appId) {
|
|
|
AppBuilding appBuilding1 = buildingRepository.findAllByAppConfig_AppId(appId);
|
|
|
@@ -153,7 +147,7 @@ public class AppBuildQueryImpl implements AppBuildQuery {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BuildLog findByBuildLogId(String buildLogId) {
|
|
|
+ public BuildLog getBuildLog(String buildLogId) {
|
|
|
return buildLogRepository.findByBuildLogId(buildLogId);
|
|
|
}
|
|
|
|