refactor(系统设置): 组织查看项目列表参数

This commit is contained in:
song-cc-rock 2023-08-10 19:07:15 +08:00 committed by fit2-zhao
parent 50ee81300b
commit 146ce20a59
4 changed files with 8 additions and 10 deletions

View File

@ -5,12 +5,14 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.dto.OptionDTO; import io.metersphere.sdk.dto.OptionDTO;
import io.metersphere.sdk.dto.ProjectDTO; import io.metersphere.sdk.dto.ProjectDTO;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.PageUtils; import io.metersphere.sdk.util.PageUtils;
import io.metersphere.sdk.util.Pager; import io.metersphere.sdk.util.Pager;
import io.metersphere.sdk.util.SessionUtils; import io.metersphere.sdk.util.SessionUtils;
import io.metersphere.system.dto.OrganizationDTO; import io.metersphere.system.dto.OrganizationDTO;
import io.metersphere.system.dto.UserExtend; import io.metersphere.system.dto.UserExtend;
import io.metersphere.system.request.OrganizationMemberRequest; import io.metersphere.system.request.OrganizationMemberRequest;
import io.metersphere.system.request.OrganizationProjectRequest;
import io.metersphere.system.request.OrganizationRequest; import io.metersphere.system.request.OrganizationRequest;
import io.metersphere.system.request.ProjectRequest; import io.metersphere.system.request.ProjectRequest;
import io.metersphere.system.service.OrganizationService; import io.metersphere.system.service.OrganizationService;
@ -94,9 +96,11 @@ public class SystemOrganizationController {
@PostMapping("/list-project") @PostMapping("/list-project")
@Operation(summary = "获取组织下的项目列表") @Operation(summary = "获取组织下的项目列表")
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ) @RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
public Pager<List<ProjectDTO>> listProject(@Validated @RequestBody ProjectRequest request) { public Pager<List<ProjectDTO>> listProject(@Validated @RequestBody OrganizationProjectRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
return PageUtils.setPageInfo(page, systemProjectService.getProjectList(request)); ProjectRequest projectRequest = new ProjectRequest();
BeanUtils.copyBean(projectRequest, request);
return PageUtils.setPageInfo(page, systemProjectService.getProjectList(projectRequest));
} }
} }

View File

@ -10,10 +10,8 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class OrganizationProjectRequest extends BasePageRequest { public class OrganizationProjectRequest extends BasePageRequest {
@Schema(description = "组织id", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{project.organization_id.not_blank}") @NotBlank(message = "{project.organization_id.not_blank}")
@Size(min = 1, max = 50, message = "{project.organization_id.length_range}") @Size(min = 1, max = 50, message = "{project.organization_id.length_range}")
private String organizationId; private String organizationId;
@Schema(description = "项目ID")
private String projectId;
} }

View File

@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class ProjectRequest extends BasePageRequest { public class ProjectRequest extends BasePageRequest {
@Schema(description = "组织id") @Schema(description = "组织ID")
private String organizationId; private String organizationId;
@Schema(description = "项目ID") @Schema(description = "项目ID")
private String projectId; private String projectId;

View File

@ -40,10 +40,6 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
ExtUserRoleMapper extUserRoleMapper; ExtUserRoleMapper extUserRoleMapper;
@Resource @Resource
UserRoleRelationMapper userRoleRelationMapper; UserRoleRelationMapper userRoleRelationMapper;
@Resource
UserRolePermissionMapper userRolePermissionMapper;
@Resource
ExtUserRoleRelationMapper extUserRoleRelationMapper;
public List<UserRole> list(String organizationId) { public List<UserRole> list(String organizationId) {
UserRoleExample example = new UserRoleExample(); UserRoleExample example = new UserRoleExample();