增加团队管理增删改差

This commit is contained in:
dengqichen 2025-10-29 09:39:28 +08:00
parent a1399d6d69
commit 2980e12980
4 changed files with 11 additions and 27 deletions

View File

@ -23,9 +23,6 @@ public class ApplicationDTO extends BaseDTO {
@NotNull(message = "开发语言")
private DevelopmentLanguageTypeEnum language;
@Schema(description = "代码仓库组ID")
private Long repoGroupId;
@Schema(description = "代码仓库项目ID")
private Long repoProjectId;
@ -38,10 +35,11 @@ public class ApplicationDTO extends BaseDTO {
@NotNull(message = "排序号不能为空")
private Integer sort;
private RepositoryGroupDTO repositoryGroup;
private RepositoryProjectDTO repositoryProject;
private ApplicationCategoryDTO applicationCategory;
@Schema(description = "关联的团队数量")
private Long teamCount;
}

View File

@ -42,12 +42,6 @@ public class Application extends Entity<Long> {
@Column(name = "language")
private DevelopmentLanguageTypeEnum language;
/**
* 代码仓库组ID
*/
@Column(name = "repo_group_id")
private Long repoGroupId;
/**
* 代码仓库项目ID
*/

View File

@ -1,20 +1,18 @@
package com.qqchen.deploy.backend.deploy.service.impl;
import com.qqchen.deploy.backend.deploy.converter.ApplicationCategoryConverter;
import com.qqchen.deploy.backend.deploy.converter.RepositoryGroupConverter;
import com.qqchen.deploy.backend.deploy.converter.RepositoryProjectConverter;
import com.qqchen.deploy.backend.deploy.dto.ApplicationDTO;
import com.qqchen.deploy.backend.deploy.dto.DevelopmentLanguageTypeDTO;
import com.qqchen.deploy.backend.deploy.entity.Application;
import com.qqchen.deploy.backend.deploy.entity.ApplicationCategory;
import com.qqchen.deploy.backend.deploy.entity.RepositoryGroup;
import com.qqchen.deploy.backend.deploy.entity.RepositoryProject;
import com.qqchen.deploy.backend.deploy.enums.DevelopmentLanguageTypeEnum;
import com.qqchen.deploy.backend.deploy.query.ApplicationQuery;
import com.qqchen.deploy.backend.deploy.repository.IApplicationCategoryRepository;
import com.qqchen.deploy.backend.deploy.repository.IApplicationRepository;
import com.qqchen.deploy.backend.deploy.repository.IRepositoryGroupRepository;
import com.qqchen.deploy.backend.deploy.repository.IRepositoryProjectRepository;
import com.qqchen.deploy.backend.deploy.repository.ITeamApplicationRepository;
import com.qqchen.deploy.backend.deploy.service.IApplicationService;
import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl;
import jakarta.annotation.Resource;
@ -38,21 +36,18 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
@Resource
private ApplicationCategoryConverter applicationCategoryConverter;
@Resource
private IRepositoryGroupRepository repositoryGroupRepository;
@Resource
private IRepositoryProjectRepository repositoryProjectRepository;
@Resource
private RepositoryGroupConverter repositoryGroupConverter;
@Resource
private RepositoryProjectConverter repositoryProjectConverter;
@Resource
private IApplicationRepository applicationRepository;
@Resource
private ITeamApplicationRepository teamApplicationRepository;
public Page<ApplicationDTO> page(ApplicationQuery query) {
Page<ApplicationDTO> page = super.page(query);
List<ApplicationDTO> result = page.getContent().stream().peek(application -> {
@ -62,17 +57,15 @@ public class ApplicationServiceImpl extends BaseServiceImpl<Application, Applica
categoryOptional.ifPresent(category -> application.setApplicationCategory(applicationCategoryConverter.toDto(category)));
}
// 查询并设置代码仓库组信息
if (application.getRepoGroupId() != null) {
Optional<RepositoryGroup> repositoryGroupOptional = repositoryGroupRepository.findByRepoGroupId(application.getRepoGroupId());
repositoryGroupOptional.ifPresent(repositoryGroup -> application.setRepositoryGroup(repositoryGroupConverter.toDto(repositoryGroup)));
}
// 查询并设置代码仓库项目信息
if (application.getRepoProjectId() != null) {
Optional<RepositoryProject> repositoryProjectOptional = repositoryProjectRepository.findByRepoProjectId(application.getRepoProjectId());
repositoryProjectOptional.ifPresent(repositoryProject -> application.setRepositoryProject(repositoryProjectConverter.toDto(repositoryProject)));
}
// 统计该应用被多少个团队关联
Long teamCount = teamApplicationRepository.countByApplicationIdAndDeletedFalse(application.getId());
application.setTeamCount(teamCount);
}).collect(toList());
return new PageImpl<>(result, page.getPageable(), page.getTotalElements());
}

View File

@ -709,7 +709,6 @@ CREATE TABLE deploy_application
app_name VARCHAR(100) NOT NULL COMMENT '应用名称',
app_desc VARCHAR(255) NULL COMMENT '应用描述',
language VARCHAR(50) NULL COMMENT '开发语言JAVA、PYTHON、NODEJS',
repo_group_id BIGINT NULL COMMENT '代码仓库组ID',
repo_project_id BIGINT NULL COMMENT '代码仓库项目ID',
application_category_id BIGINT NULL COMMENT '所属应用分类ID',
enabled BIT NOT NULL DEFAULT 1 COMMENT '是否启用0禁用1启用',