refactor(功能用例): 注解修改
This commit is contained in:
parent
afd5d29a63
commit
f69d3eaec3
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.functional.dto;
|
package io.metersphere.functional.constants;
|
||||||
|
|
||||||
public enum CommentEnum {
|
public enum CommentEnum {
|
||||||
CASE, TEST_PLAN, CASE_REVIEW
|
CASE, TEST_PLAN, CASE_REVIEW
|
|
@ -15,6 +15,7 @@ import io.metersphere.project.dto.CustomFieldOptions;
|
||||||
import io.metersphere.project.service.ProjectTemplateService;
|
import io.metersphere.project.service.ProjectTemplateService;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
import io.metersphere.sdk.constants.TemplateScene;
|
import io.metersphere.sdk.constants.TemplateScene;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||||
import io.metersphere.system.dto.sdk.TemplateDTO;
|
import io.metersphere.system.dto.sdk.TemplateDTO;
|
||||||
import io.metersphere.system.log.annotation.Log;
|
import io.metersphere.system.log.annotation.Log;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
|
|
|
@ -2,8 +2,8 @@ package io.metersphere.functional.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,9 +11,8 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class AssociationDTO implements Serializable {
|
public class AssociationDTO implements Serializable {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "类型",allowableValues = {"EMPTY","NOT_EMPTY"})
|
@Schema(description = "类型",allowableValues = {"EMPTY","NOT_EMPTY"})
|
||||||
|
|
|
@ -3,7 +3,6 @@ package io.metersphere.functional.dto;
|
||||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,11 +11,8 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class BaseFunctionalCaseBatchDTO extends TableBatchProcessDTO implements Serializable {
|
public class BaseFunctionalCaseBatchDTO extends TableBatchProcessDTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(description = "模块id")
|
@Schema(description = "模块id")
|
||||||
private List<String> moduleIds;
|
private List<String> moduleIds;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ import java.util.Objects;
|
||||||
@Data
|
@Data
|
||||||
public class CaseCustomFieldDTO implements Serializable {
|
public class CaseCustomFieldDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "字段id")
|
@Schema(description = "字段id")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package io.metersphere.functional.dto;
|
package io.metersphere.functional.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -10,7 +9,6 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class CombineDTO implements Serializable {
|
public class CombineDTO implements Serializable {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package io.metersphere.functional.dto;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ import java.io.Serializable;
|
||||||
* @author guoyuqi
|
* @author guoyuqi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class DemandDTO implements Serializable {
|
public class DemandDTO implements Serializable {
|
||||||
|
|
||||||
@Schema(description = "需求ID")
|
@Schema(description = "需求ID")
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package io.metersphere.functional.dto;
|
package io.metersphere.functional.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FileUploadDTO implements Serializable {
|
public class FileUploadDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,17 @@ package io.metersphere.functional.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseAttachmentDTO implements Serializable {
|
public class FunctionalCaseAttachmentDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "ID")
|
@Schema(description = "ID")
|
||||||
|
|
|
@ -3,8 +3,8 @@ package io.metersphere.functional.dto;
|
||||||
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseDetailDTO implements Serializable {
|
public class FunctionalCaseDetailDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "ID")
|
@Schema(description = "ID")
|
||||||
|
|
|
@ -4,7 +4,6 @@ import io.metersphere.functional.domain.FunctionalCase;
|
||||||
import io.metersphere.functional.domain.FunctionalCaseCustomField;
|
import io.metersphere.functional.domain.FunctionalCaseCustomField;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,7 +11,6 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCasePageDTO extends FunctionalCase {
|
public class FunctionalCasePageDTO extends FunctionalCase {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,17 @@ package io.metersphere.functional.dto;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseVersionDTO implements Serializable {
|
public class FunctionalCaseVersionDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "用例id")
|
@Schema(description = "用例id")
|
||||||
|
|
|
@ -3,17 +3,17 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author guoyuqi
|
* @author guoyuqi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class CaseReviewFollowerRequest implements Serializable {
|
public class CaseReviewFollowerRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -5,14 +5,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class CaseReviewRequest implements Serializable {
|
public class CaseReviewRequest implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|
|
@ -3,8 +3,8 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -13,9 +13,9 @@ import java.util.Map;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseAddRequest implements Serializable {
|
public class FunctionalCaseAddRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
||||||
import io.metersphere.functional.dto.CaseCustomFieldDTO;
|
import io.metersphere.functional.dto.CaseCustomFieldDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,7 +11,6 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseBatchEditRequest extends BaseFunctionalCaseBatchDTO {
|
public class FunctionalCaseBatchEditRequest extends BaseFunctionalCaseBatchDTO {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,11 @@ package io.metersphere.functional.request;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseBatchMoveRequest extends FunctionalCaseBatchRequest {
|
public class FunctionalCaseBatchMoveRequest extends FunctionalCaseBatchRequest {
|
||||||
|
|
||||||
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -3,13 +3,11 @@ package io.metersphere.functional.request;
|
||||||
import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseBatchRequest extends BaseFunctionalCaseBatchDTO {
|
public class FunctionalCaseBatchRequest extends BaseFunctionalCaseBatchDTO {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@ import io.metersphere.validation.groups.Updated;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseCommentRequest {
|
public class FunctionalCaseCommentRequest {
|
||||||
|
|
||||||
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "评论ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -3,16 +3,16 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseDeleteRequest implements Serializable {
|
public class FunctionalCaseDeleteRequest implements Serializable {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import io.metersphere.validation.groups.Updated;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -13,7 +12,6 @@ import java.util.List;
|
||||||
* @author guoyuqi
|
* @author guoyuqi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseDemandRequest {
|
public class FunctionalCaseDemandRequest {
|
||||||
|
|
||||||
@Schema(description = "功能用例需求关系ID")
|
@Schema(description = "功能用例需求关系ID")
|
||||||
|
|
|
@ -3,7 +3,6 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ import java.util.List;
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseEditRequest extends FunctionalCaseAddRequest {
|
public class FunctionalCaseEditRequest extends FunctionalCaseAddRequest {
|
||||||
|
|
||||||
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -2,17 +2,17 @@ package io.metersphere.functional.request;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseFileRequest implements Serializable {
|
public class FunctionalCaseFileRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "项目id",requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目id",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -3,17 +3,17 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class FunctionalCaseFollowerRequest implements Serializable {
|
public class FunctionalCaseFollowerRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -5,17 +5,18 @@ import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
public class FunctionalCasePageRequest extends BasePageRequest implements Serializable {
|
||||||
public class FunctionalCasePageRequest extends BasePageRequest {
|
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -3,17 +3,17 @@ package io.metersphere.functional.request;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class TemplateFieldsRequest implements Serializable {
|
public class TemplateFieldsRequest implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "模板id")
|
@Schema(description = "模板id")
|
||||||
|
|
|
@ -4,7 +4,7 @@ package io.metersphere.functional.service;
|
||||||
import io.metersphere.functional.domain.FunctionalCase;
|
import io.metersphere.functional.domain.FunctionalCase;
|
||||||
import io.metersphere.functional.domain.FunctionalCaseComment;
|
import io.metersphere.functional.domain.FunctionalCaseComment;
|
||||||
import io.metersphere.functional.domain.FunctionalCaseCommentExample;
|
import io.metersphere.functional.domain.FunctionalCaseCommentExample;
|
||||||
import io.metersphere.functional.dto.CommentEnum;
|
import io.metersphere.functional.constants.CommentEnum;
|
||||||
import io.metersphere.functional.dto.FunctionalCaseCommentDTO;
|
import io.metersphere.functional.dto.FunctionalCaseCommentDTO;
|
||||||
import io.metersphere.functional.dto.FunctionalCaseDTO;
|
import io.metersphere.functional.dto.FunctionalCaseDTO;
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseCommentMapper;
|
import io.metersphere.functional.mapper.FunctionalCaseCommentMapper;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import io.metersphere.functional.mapper.FunctionalCaseFollowerMapper;
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||||
import io.metersphere.functional.request.*;
|
import io.metersphere.functional.request.*;
|
||||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||||
import io.metersphere.functional.util.ServiceUtils;
|
|
||||||
import io.metersphere.project.domain.FileAssociation;
|
import io.metersphere.project.domain.FileAssociation;
|
||||||
import io.metersphere.project.dto.ModuleCountDTO;
|
import io.metersphere.project.dto.ModuleCountDTO;
|
||||||
import io.metersphere.project.mapper.ExtBaseProjectVersionMapper;
|
import io.metersphere.project.mapper.ExtBaseProjectVersionMapper;
|
||||||
|
@ -24,8 +23,10 @@ import io.metersphere.sdk.util.CommonBeanFactory;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
import io.metersphere.system.dto.sdk.TemplateCustomFieldDTO;
|
||||||
import io.metersphere.system.dto.sdk.TemplateDTO;
|
import io.metersphere.system.dto.sdk.TemplateDTO;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.uid.NumGenerator;
|
import io.metersphere.system.uid.NumGenerator;
|
||||||
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
@ -633,7 +634,7 @@ public class FunctionalCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editPos(PosRequest request) {
|
public void editPos(PosRequest request) {
|
||||||
ServiceUtils.updateOrderField(request,
|
ServiceUtils.updatePosField(request,
|
||||||
FunctionalCase.class,
|
FunctionalCase.class,
|
||||||
functionalCaseMapper::selectByPrimaryKey,
|
functionalCaseMapper::selectByPrimaryKey,
|
||||||
extFunctionalCaseMapper::getPrePos,
|
extFunctionalCaseMapper::getPrePos,
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
package io.metersphere.functional.util;
|
|
||||||
|
|
||||||
import io.metersphere.functional.constants.MoveTypeEnum;
|
|
||||||
import io.metersphere.functional.request.PosRequest;
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class ServiceUtils {
|
|
||||||
|
|
||||||
public static final int POS_STEP = 5000;
|
|
||||||
|
|
||||||
public static <T> void updateOrderField(PosRequest request, Class<T> clazz,
|
|
||||||
Function<String, T> selectByPrimaryKeyFunc,
|
|
||||||
BiFunction<String, Long, Long> getPreOrderFunc,
|
|
||||||
BiFunction<String, Long, Long> getLastOrderFunc,
|
|
||||||
Consumer<T> updateByPrimaryKeySelectiveFuc) {
|
|
||||||
Long pos;
|
|
||||||
Long lastOrPrePos;
|
|
||||||
try {
|
|
||||||
Method getPos = clazz.getMethod("getPos");
|
|
||||||
Method setId = clazz.getMethod("setId", String.class);
|
|
||||||
Method setPos = clazz.getMethod("setPos", Long.class);
|
|
||||||
|
|
||||||
// 获取移动的参考对象
|
|
||||||
T target = selectByPrimaryKeyFunc.apply(request.getTargetId());
|
|
||||||
|
|
||||||
if (target == null) {
|
|
||||||
// 如果参考对象被删除,则不处理
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Long targetOrder = (Long) getPos.invoke(target);
|
|
||||||
|
|
||||||
if (request.getMoveMode().equals(MoveTypeEnum.AFTER.name())) {
|
|
||||||
// 追加到参考对象的之后
|
|
||||||
pos = targetOrder - ServiceUtils.POS_STEP;
|
|
||||||
// ,因为是降序排,则查找比目标 order 小的一个order
|
|
||||||
lastOrPrePos = getPreOrderFunc.apply(request.getProjectId(), targetOrder);
|
|
||||||
} else {
|
|
||||||
// 追加到前面
|
|
||||||
pos = targetOrder + ServiceUtils.POS_STEP;
|
|
||||||
// 因为是降序排,则查找比目标 order 更大的一个order
|
|
||||||
lastOrPrePos = getLastOrderFunc.apply(request.getProjectId(), targetOrder);
|
|
||||||
}
|
|
||||||
if (lastOrPrePos != null) {
|
|
||||||
// 如果不是第一个或最后一个则取中间值
|
|
||||||
pos = (targetOrder + lastOrPrePos) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新order值
|
|
||||||
T updateObj = (T) clazz.getDeclaredConstructor().newInstance();
|
|
||||||
setId.invoke(updateObj, request.getMoveId());
|
|
||||||
setPos.invoke(updateObj, pos);
|
|
||||||
updateByPrimaryKeySelectiveFuc.accept(updateObj);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new MSException("更新 order 字段失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.domain.CustomField;
|
import io.metersphere.system.domain.CustomField;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||||
import io.metersphere.system.notice.constants.NoticeConstants;
|
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.functional.constants;
|
package io.metersphere.system.dto.sdk.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wx
|
* @author wx
|
|
@ -1,4 +1,4 @@
|
||||||
package io.metersphere.functional.request;
|
package io.metersphere.system.dto.sdk.request;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
|
@ -1,11 +1,20 @@
|
||||||
package io.metersphere.system.utils;
|
package io.metersphere.system.utils;
|
||||||
|
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
|
import io.metersphere.system.dto.sdk.enums.MoveTypeEnum;
|
||||||
|
import io.metersphere.system.dto.sdk.request.PosRequest;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static io.metersphere.system.controller.handler.result.MsHttpResultCode.NOT_FOUND;
|
import static io.metersphere.system.controller.handler.result.MsHttpResultCode.NOT_FOUND;
|
||||||
|
|
||||||
public class ServiceUtils {
|
public class ServiceUtils {
|
||||||
|
|
||||||
|
public static final int POS_STEP = 5000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存资源名称,在处理 NOT_FOUND 异常时,拼接资源名称
|
* 保存资源名称,在处理 NOT_FOUND 异常时,拼接资源名称
|
||||||
*/
|
*/
|
||||||
|
@ -33,4 +42,52 @@ public class ServiceUtils {
|
||||||
public static void clearResourceName() {
|
public static void clearResourceName() {
|
||||||
resourceName.remove();
|
resourceName.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> void updatePosField(PosRequest request, Class<T> clazz,
|
||||||
|
Function<String, T> selectByPrimaryKeyFunc,
|
||||||
|
BiFunction<String, Long, Long> getPrePosFunc,
|
||||||
|
BiFunction<String, Long, Long> getLastPosFunc,
|
||||||
|
Consumer<T> updateByPrimaryKeySelectiveFuc) {
|
||||||
|
Long pos;
|
||||||
|
Long lastOrPrePos;
|
||||||
|
try {
|
||||||
|
Method getPos = clazz.getMethod("getPos");
|
||||||
|
Method setId = clazz.getMethod("setId", String.class);
|
||||||
|
Method setPos = clazz.getMethod("setPos", Long.class);
|
||||||
|
|
||||||
|
// 获取移动的参考对象
|
||||||
|
T target = selectByPrimaryKeyFunc.apply(request.getTargetId());
|
||||||
|
|
||||||
|
if (target == null) {
|
||||||
|
// 如果参考对象被删除,则不处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long targetPos = (Long) getPos.invoke(target);
|
||||||
|
|
||||||
|
if (request.getMoveMode().equals(MoveTypeEnum.AFTER.name())) {
|
||||||
|
// 追加到参考对象的之后
|
||||||
|
pos = targetPos - POS_STEP;
|
||||||
|
// ,因为是降序排,则查找比目标 order 小的一个order
|
||||||
|
lastOrPrePos = getPrePosFunc.apply(request.getProjectId(), targetPos);
|
||||||
|
} else {
|
||||||
|
// 追加到前面
|
||||||
|
pos = targetPos + POS_STEP;
|
||||||
|
// 因为是降序排,则查找比目标 order 更大的一个order
|
||||||
|
lastOrPrePos = getLastPosFunc.apply(request.getProjectId(), targetPos);
|
||||||
|
}
|
||||||
|
if (lastOrPrePos != null) {
|
||||||
|
// 如果不是第一个或最后一个则取中间值
|
||||||
|
pos = (targetPos + lastOrPrePos) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新order值
|
||||||
|
T updateObj = (T) clazz.getDeclaredConstructor().newInstance();
|
||||||
|
setId.invoke(updateObj, request.getMoveId());
|
||||||
|
setPos.invoke(updateObj, pos);
|
||||||
|
updateByPrimaryKeySelectiveFuc.accept(updateObj);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new MSException("更新 pos 字段失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue