refactor(用例管理): num字段类型优化
This commit is contained in:
parent
e46b2d1eaf
commit
ec4902f78b
|
@ -4,6 +4,7 @@ import io.metersphere.validation.groups.Created;
|
||||||
import io.metersphere.validation.groups.Updated;
|
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 jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -18,9 +19,8 @@ public class FunctionalCase implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(description = "业务ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "业务ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{functional_case.num.not_blank}", groups = {Created.class})
|
@NotNull(message = "{functional_case.num.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 10, message = "{functional_case.num.length_range}", groups = {Created.class, Updated.class})
|
private Long num;
|
||||||
private Integer num;
|
|
||||||
|
|
||||||
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{functional_case.module_id.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{functional_case.module_id.not_blank}", groups = {Created.class})
|
||||||
|
@ -112,7 +112,7 @@ public class FunctionalCase implements Serializable {
|
||||||
|
|
||||||
public enum Column {
|
public enum Column {
|
||||||
id("id", "id", "VARCHAR", false),
|
id("id", "id", "VARCHAR", false),
|
||||||
num("num", "num", "INTEGER", false),
|
num("num", "num", "BIGINT", false),
|
||||||
moduleId("module_id", "moduleId", "VARCHAR", false),
|
moduleId("module_id", "moduleId", "VARCHAR", false),
|
||||||
projectId("project_id", "projectId", "VARCHAR", false),
|
projectId("project_id", "projectId", "VARCHAR", false),
|
||||||
templateId("template_id", "templateId", "VARCHAR", false),
|
templateId("template_id", "templateId", "VARCHAR", false),
|
||||||
|
|
|
@ -184,52 +184,52 @@ public class FunctionalCaseExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumEqualTo(Integer value) {
|
public Criteria andNumEqualTo(Long value) {
|
||||||
addCriterion("num =", value, "num");
|
addCriterion("num =", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumNotEqualTo(Integer value) {
|
public Criteria andNumNotEqualTo(Long value) {
|
||||||
addCriterion("num <>", value, "num");
|
addCriterion("num <>", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumGreaterThan(Integer value) {
|
public Criteria andNumGreaterThan(Long value) {
|
||||||
addCriterion("num >", value, "num");
|
addCriterion("num >", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumGreaterThanOrEqualTo(Integer value) {
|
public Criteria andNumGreaterThanOrEqualTo(Long value) {
|
||||||
addCriterion("num >=", value, "num");
|
addCriterion("num >=", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumLessThan(Integer value) {
|
public Criteria andNumLessThan(Long value) {
|
||||||
addCriterion("num <", value, "num");
|
addCriterion("num <", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumLessThanOrEqualTo(Integer value) {
|
public Criteria andNumLessThanOrEqualTo(Long value) {
|
||||||
addCriterion("num <=", value, "num");
|
addCriterion("num <=", value, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumIn(List<Integer> values) {
|
public Criteria andNumIn(List<Long> values) {
|
||||||
addCriterion("num in", values, "num");
|
addCriterion("num in", values, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumNotIn(List<Integer> values) {
|
public Criteria andNumNotIn(List<Long> values) {
|
||||||
addCriterion("num not in", values, "num");
|
addCriterion("num not in", values, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumBetween(Integer value1, Integer value2) {
|
public Criteria andNumBetween(Long value1, Long value2) {
|
||||||
addCriterion("num between", value1, value2, "num");
|
addCriterion("num between", value1, value2, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNumNotBetween(Integer value1, Integer value2) {
|
public Criteria andNumNotBetween(Long value1, Long value2) {
|
||||||
addCriterion("num not between", value1, value2, "num");
|
addCriterion("num not between", value1, value2, "num");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<mapper namespace="io.metersphere.functional.mapper.FunctionalCaseMapper">
|
<mapper namespace="io.metersphere.functional.mapper.FunctionalCaseMapper">
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.functional.domain.FunctionalCase">
|
<resultMap id="BaseResultMap" type="io.metersphere.functional.domain.FunctionalCase">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="num" jdbcType="INTEGER" property="num" />
|
<result column="num" jdbcType="BIGINT" property="num" />
|
||||||
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
|
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
|
||||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||||
<result column="template_id" jdbcType="VARCHAR" property="templateId" />
|
<result column="template_id" jdbcType="VARCHAR" property="templateId" />
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
latest, create_user, update_user,
|
latest, create_user, update_user,
|
||||||
delete_user, create_time, update_time,
|
delete_user, create_time, update_time,
|
||||||
delete_time)
|
delete_time)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, #{moduleId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{moduleId,jdbcType=VARCHAR},
|
||||||
#{projectId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
#{projectId,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{caseEditType,jdbcType=VARCHAR},
|
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{caseEditType,jdbcType=VARCHAR},
|
||||||
#{pos,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
|
#{pos,jdbcType=BIGINT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
#{id,jdbcType=VARCHAR},
|
#{id,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
#{num,jdbcType=INTEGER},
|
#{num,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="moduleId != null">
|
<if test="moduleId != null">
|
||||||
#{moduleId,jdbcType=VARCHAR},
|
#{moduleId,jdbcType=VARCHAR},
|
||||||
|
@ -288,7 +288,7 @@
|
||||||
id = #{record.id,jdbcType=VARCHAR},
|
id = #{record.id,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.num != null">
|
<if test="record.num != null">
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.moduleId != null">
|
<if test="record.moduleId != null">
|
||||||
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
||||||
|
@ -358,7 +358,7 @@
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update functional_case
|
update functional_case
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
num = #{record.num,jdbcType=INTEGER},
|
num = #{record.num,jdbcType=BIGINT},
|
||||||
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
||||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||||
template_id = #{record.templateId,jdbcType=VARCHAR},
|
template_id = #{record.templateId,jdbcType=VARCHAR},
|
||||||
|
@ -387,7 +387,7 @@
|
||||||
update functional_case
|
update functional_case
|
||||||
<set>
|
<set>
|
||||||
<if test="num != null">
|
<if test="num != null">
|
||||||
num = #{num,jdbcType=INTEGER},
|
num = #{num,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="moduleId != null">
|
<if test="moduleId != null">
|
||||||
module_id = #{moduleId,jdbcType=VARCHAR},
|
module_id = #{moduleId,jdbcType=VARCHAR},
|
||||||
|
@ -454,7 +454,7 @@
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.functional.domain.FunctionalCase">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.functional.domain.FunctionalCase">
|
||||||
update functional_case
|
update functional_case
|
||||||
set num = #{num,jdbcType=INTEGER},
|
set num = #{num,jdbcType=BIGINT},
|
||||||
module_id = #{moduleId,jdbcType=VARCHAR},
|
module_id = #{moduleId,jdbcType=VARCHAR},
|
||||||
project_id = #{projectId,jdbcType=VARCHAR},
|
project_id = #{projectId,jdbcType=VARCHAR},
|
||||||
template_id = #{templateId,jdbcType=VARCHAR},
|
template_id = #{templateId,jdbcType=VARCHAR},
|
||||||
|
@ -484,7 +484,7 @@
|
||||||
update_user, delete_user, create_time, update_time, delete_time)
|
update_user, delete_user, create_time, update_time, delete_time)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=INTEGER}, #{item.moduleId,jdbcType=VARCHAR},
|
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.moduleId,jdbcType=VARCHAR},
|
||||||
#{item.projectId,jdbcType=VARCHAR}, #{item.templateId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
|
#{item.projectId,jdbcType=VARCHAR}, #{item.templateId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
|
||||||
#{item.reviewStatus,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR}, #{item.caseEditType,jdbcType=VARCHAR},
|
#{item.reviewStatus,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR}, #{item.caseEditType,jdbcType=VARCHAR},
|
||||||
#{item.pos,jdbcType=BIGINT}, #{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR},
|
#{item.pos,jdbcType=BIGINT}, #{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR},
|
||||||
|
@ -508,7 +508,7 @@
|
||||||
#{item.id,jdbcType=VARCHAR}
|
#{item.id,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="'num'.toString() == column.value">
|
<if test="'num'.toString() == column.value">
|
||||||
#{item.num,jdbcType=INTEGER}
|
#{item.num,jdbcType=BIGINT}
|
||||||
</if>
|
</if>
|
||||||
<if test="'module_id'.toString() == column.value">
|
<if test="'module_id'.toString() == column.value">
|
||||||
#{item.moduleId,jdbcType=VARCHAR}
|
#{item.moduleId,jdbcType=VARCHAR}
|
||||||
|
|
|
@ -3,7 +3,7 @@ SET SESSION innodb_lock_wait_timeout = 7200;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS functional_case(
|
CREATE TABLE IF NOT EXISTS functional_case(
|
||||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
|
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
|
||||||
`num` INT NOT NULL COMMENT '业务ID' ,
|
`num` BIGINT NOT NULL COMMENT '业务ID' ,
|
||||||
`module_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '模块ID' ,
|
`module_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '模块ID' ,
|
||||||
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID' ,
|
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID' ,
|
||||||
`template_id` VARCHAR(50) NOT NULL COMMENT '模板ID' ,
|
`template_id` VARCHAR(50) NOT NULL COMMENT '模板ID' ,
|
||||||
|
@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS functional_case(
|
||||||
DEFAULT CHARSET = utf8mb4
|
DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE = utf8mb4_general_ci COMMENT = '功能用例';
|
COLLATE = utf8mb4_general_ci COMMENT = '功能用例';
|
||||||
|
|
||||||
|
CREATE INDEX idx_num ON functional_case(num);
|
||||||
CREATE INDEX idx_module_id ON functional_case(module_id);
|
CREATE INDEX idx_module_id ON functional_case(module_id);
|
||||||
CREATE INDEX idx_project_id_pos ON functional_case(project_id,pos);
|
CREATE INDEX idx_project_id_pos ON functional_case(project_id,pos);
|
||||||
CREATE INDEX idx_public_case_pos ON functional_case(public_case,pos);
|
CREATE INDEX idx_public_case_pos ON functional_case(public_case,pos);
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -130,10 +129,8 @@ public class FunctionalCaseService {
|
||||||
return (pos == null ? 0 : pos) + ORDER_STEP;
|
return (pos == null ? 0 : pos) + ORDER_STEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNextNum(String projectId) {
|
public long getNextNum(String projectId) {
|
||||||
long nextNum = NumGenerator.nextNum(projectId, ApplicationNumScope.CASE_MANAGEMENT);
|
return NumGenerator.nextNum(projectId, ApplicationNumScope.CASE_MANAGEMENT);
|
||||||
BigDecimal bigDecimal = new BigDecimal(nextNum);
|
|
||||||
return bigDecimal.intValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -723,7 +723,7 @@ public class FunctionalCaseModuleControllerTests extends BaseTest {
|
||||||
private FunctionalCase createCase(BaseTreeNode a1a1Node, Boolean deleted, String name) {
|
private FunctionalCase createCase(BaseTreeNode a1a1Node, Boolean deleted, String name) {
|
||||||
FunctionalCase functionalCase = new FunctionalCase();
|
FunctionalCase functionalCase = new FunctionalCase();
|
||||||
functionalCase.setName(name);
|
functionalCase.setName(name);
|
||||||
functionalCase.setNum(100001);
|
functionalCase.setNum(100001l);
|
||||||
functionalCase.setModuleId(a1a1Node.getId());
|
functionalCase.setModuleId(a1a1Node.getId());
|
||||||
functionalCase.setProjectId(project.getId());
|
functionalCase.setProjectId(project.getId());
|
||||||
functionalCase.setDeleted(deleted);
|
functionalCase.setDeleted(deleted);
|
||||||
|
|
Loading…
Reference in New Issue