refactor: 性能测试关注人多选

This commit is contained in:
CaptainB 2021-10-23 13:26:11 +08:00 committed by 刘瑞斌
parent b894bf7cb2
commit 2610b0c573
14 changed files with 584 additions and 107 deletions

View File

@ -31,8 +31,6 @@ public class LoadTest implements Serializable {
private String scenarioId;
private String followPeople;
private Long order;
private static final long serialVersionUID = 1L;

View File

@ -974,76 +974,6 @@ public class LoadTestExample {
return (Criteria) this;
}
public Criteria andFollowPeopleIsNull() {
addCriterion("follow_people is null");
return (Criteria) this;
}
public Criteria andFollowPeopleIsNotNull() {
addCriterion("follow_people is not null");
return (Criteria) this;
}
public Criteria andFollowPeopleEqualTo(String value) {
addCriterion("follow_people =", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotEqualTo(String value) {
addCriterion("follow_people <>", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThan(String value) {
addCriterion("follow_people >", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
addCriterion("follow_people >=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThan(String value) {
addCriterion("follow_people <", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
addCriterion("follow_people <=", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleLike(String value) {
addCriterion("follow_people like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotLike(String value) {
addCriterion("follow_people not like", value, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleIn(List<String> values) {
addCriterion("follow_people in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotIn(List<String> values) {
addCriterion("follow_people not in", values, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleBetween(String value1, String value2) {
addCriterion("follow_people between", value1, value2, "followPeople");
return (Criteria) this;
}
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
addCriterion("follow_people not between", value1, value2, "followPeople");
return (Criteria) this;
}
public Criteria andOrderIsNull() {
addCriterion("`order` is null");
return (Criteria) this;

View File

@ -0,0 +1,13 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class LoadTestFollow implements Serializable {
private String testId;
private String followId;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class LoadTestFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public LoadTestFollowExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.LoadTestFollow;
import io.metersphere.base.domain.LoadTestFollowExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface LoadTestFollowMapper {
long countByExample(LoadTestFollowExample example);
int deleteByExample(LoadTestFollowExample example);
int insert(LoadTestFollow record);
int insertSelective(LoadTestFollow record);
List<LoadTestFollow> selectByExample(LoadTestFollowExample example);
int updateByExampleSelective(@Param("record") LoadTestFollow record, @Param("example") LoadTestFollowExample example);
int updateByExample(@Param("record") LoadTestFollow record, @Param("example") LoadTestFollowExample example);
}

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.LoadTestFollowMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestFollow">
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="follow_id" jdbcType="VARCHAR" property="followId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
test_id, follow_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.LoadTestFollowExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from load_test_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestFollowExample">
delete from load_test_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestFollow">
insert into load_test_follow (test_id, follow_id)
values (#{testId,jdbcType=VARCHAR}, #{followId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestFollow">
insert into load_test_follow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="testId != null">
test_id,
</if>
<if test="followId != null">
follow_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="followId != null">
#{followId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestFollowExample" resultType="java.lang.Long">
select count(*) from load_test_follow
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update load_test_follow
<set>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.followId != null">
follow_id = #{record.followId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update load_test_follow
set test_id = #{record.testId,jdbcType=VARCHAR},
follow_id = #{record.followId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -15,7 +15,6 @@
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="scenario_version" jdbcType="INTEGER" property="scenarioVersion" />
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
<result column="order" jdbcType="BIGINT" property="order" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
@ -82,7 +81,7 @@
</sql>
<sql id="Base_Column_List">
id, project_id, `name`, description, create_time, update_time, `status`, test_resource_pool_id,
user_id, num, create_user, scenario_version, scenario_id, follow_people, `order`
user_id, num, create_user, scenario_version, scenario_id, `order`
</sql>
<sql id="Blob_Column_List">
load_configuration, advanced_configuration
@ -140,16 +139,14 @@
description, create_time, update_time,
`status`, test_resource_pool_id, user_id,
num, create_user, scenario_version,
scenario_id, follow_people, `order`,
load_configuration, advanced_configuration
)
scenario_id, `order`, load_configuration,
advanced_configuration)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{num,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{scenarioVersion,jdbcType=INTEGER},
#{scenarioId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR}
)
#{scenarioId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{loadConfiguration,jdbcType=LONGVARCHAR},
#{advancedConfiguration,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
insert into load_test
@ -193,9 +190,6 @@
<if test="scenarioId != null">
scenario_id,
</if>
<if test="followPeople != null">
follow_people,
</if>
<if test="order != null">
`order`,
</if>
@ -246,9 +240,6 @@
<if test="scenarioId != null">
#{scenarioId,jdbcType=VARCHAR},
</if>
<if test="followPeople != null">
#{followPeople,jdbcType=VARCHAR},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
@ -308,9 +299,6 @@
<if test="record.scenarioId != null">
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
</if>
<if test="record.followPeople != null">
follow_people = #{record.followPeople,jdbcType=VARCHAR},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
@ -340,7 +328,6 @@
create_user = #{record.createUser,jdbcType=VARCHAR},
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR}
@ -363,7 +350,6 @@
create_user = #{record.createUser,jdbcType=VARCHAR},
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -408,9 +394,6 @@
<if test="scenarioId != null">
scenario_id = #{scenarioId,jdbcType=VARCHAR},
</if>
<if test="followPeople != null">
follow_people = #{followPeople,jdbcType=VARCHAR},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
@ -437,7 +420,6 @@
create_user = #{createUser,jdbcType=VARCHAR},
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
scenario_id = #{scenarioId,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR}
@ -457,7 +439,6 @@
create_user = #{createUser,jdbcType=VARCHAR},
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
scenario_id = #{scenarioId,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>

View File

@ -5,6 +5,8 @@ import io.metersphere.base.domain.Schedule;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class LoadTestDTO extends LoadTest {
@ -12,4 +14,5 @@ public class LoadTestDTO extends LoadTest {
private String userName;
private Schedule schedule;
private Boolean isNeedUpdate;
private List<String> follows;
}

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.LoadTest;
import io.metersphere.base.domain.Schedule;
import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.PermissionConstants;
@ -242,4 +243,9 @@ public class PerformanceTestController {
public Long getReportCount(@PathVariable String testId) {
return performanceTestService.getReportCountByTestId(testId);
}
@GetMapping("test/follow/{testId}")
public List<String> getFollows(@PathVariable String testId) {
return performanceTestService.getFollows(testId);
}
}

View File

@ -4,6 +4,8 @@ import io.metersphere.base.domain.Schedule;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestPlanRequest {
@ -30,7 +32,7 @@ public class TestPlanRequest {
private String testResourcePoolId;
private String followPeople;
private List<String> follows;
private static final long serialVersionUID = 1L;

View File

@ -98,7 +98,7 @@ public class PerformanceTestService {
@Resource
private TestCaseService testCaseService;
@Resource
private TestResourcePoolMapper testResourcePoolMapper;
private LoadTestFollowMapper loadTestFollowMapper;
@Resource
private ApiAutomationService apiAutomationService;
@Resource
@ -250,11 +250,11 @@ public class PerformanceTestService {
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
loadTest.setStatus(PerformanceTestStatus.Saved.name());
loadTest.setNum(getNextNum(request.getProjectId()));
loadTest.setFollowPeople(request.getFollowPeople());
loadTest.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extLoadTestMapper::getLastOrder));
List<ApiLoadTest> apiList = request.getApiList();
apiPerformanceService.add(apiList, loadTest.getId());
loadTestMapper.insert(loadTest);
saveFollows(loadTest.getId(), request.getFollows());
return loadTest;
}
@ -300,12 +300,26 @@ public class PerformanceTestService {
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
loadTest.setStatus(PerformanceTestStatus.Saved.name());
loadTest.setFollowPeople(request.getFollowPeople());
saveFollows(loadTest.getId(), request.getFollows());
loadTestMapper.updateByPrimaryKeySelective(loadTest);
return loadTest;
}
private void saveFollows(String testId, List<String> follows) {
LoadTestFollowExample example = new LoadTestFollowExample();
example.createCriteria().andTestIdEqualTo(testId);
loadTestFollowMapper.deleteByExample(example);
if (!CollectionUtils.isEmpty(follows)) {
for (String follow : follows) {
LoadTestFollow loadTestFollow = new LoadTestFollow();
loadTestFollow.setTestId(testId);
loadTestFollow.setFollowId(follow);
loadTestFollowMapper.insert(loadTestFollow);
}
}
}
@Transactional(noRollbackFor = MSException.class)// 保存失败的信息
public String run(RunTestPlanRequest request) {
LogUtil.info("性能测试run测试");
@ -894,4 +908,15 @@ public class PerformanceTestService {
.andStatusIn(Arrays.asList(PerformanceTestStatus.Running.name(), PerformanceTestStatus.Starting.name()));
return loadTestReportMapper.selectByExampleWithBLOBs(example);
}
public List<String> getFollows(String testId) {
List<String> result = new ArrayList<>();
if (StringUtils.isBlank(testId)) {
return result;
}
LoadTestFollowExample example = new LoadTestFollowExample();
example.createCriteria().andTestIdEqualTo(testId);
List<LoadTestFollow> testPlanFollow = loadTestFollowMapper.selectByExample(example);
return testPlanFollow.stream().map(LoadTestFollow::getFollowId).distinct().collect(Collectors.toList());
}
}

View File

@ -339,4 +339,18 @@ ALTER TABLE workspace
DROP COLUMN organization_id;
ALTER TABLE api_test_case ADD COLUMN case_status VARCHAR(100) comment '用例状态等同场景的status';
UPDATE api_test_case set case_status ="Underway" where case_status is null;
UPDATE api_test_case set case_status ="Underway" where case_status is null;
-- 性能测试关注人
CREATE TABLE IF NOT EXISTS `load_test_follow` (
`test_id` VARCHAR(50) DEFAULT NULL,
`follow_id` VARCHAR(50) DEFAULT NULL,
UNIQUE KEY `load_test_follow_test_id_follow_id_pk` (`test_id`, `follow_id`),
KEY `load_test_follow_follow_id_index` (`follow_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
-- 性能测试关注人数据迁移
INSERT INTO load_test_follow
SELECT id, follow_people
FROM load_test
WHERE follow_people IS NOT NULL;
ALTER TABLE load_test DROP COLUMN follow_people;

View File

@ -78,9 +78,9 @@
<table tableName="test_plan"/>
<table tableName="test_case_test"/>-->
<!-- <table tableName="api_test_environment"></table>-->
<!-- <table tableName="workspace">-->
<!-- <ignoreColumn column="organization_id"/>-->
<!-- </table>-->
<table tableName="load_test">
<ignoreColumn column="follow_people"/>
</table>
<!-- <table tableName="custom_field"></table>-->
<!-- <table tableName="test_case"></table>-->
<!-- <table tableName="test_case"></table>-->

View File

@ -16,9 +16,9 @@
<el-col :span="6">
<el-form>
<el-form-item :label="$t('api_test.automation.follow_people')">
<el-select v-model="test.followPeople"
<el-select v-model="test.follows"
clearable
:placeholder="$t('api_test.automation.follow_people')" filterable size="small">
:placeholder="$t('api_test.automation.follow_people')" multiple filterable size="small">
<el-option
v-for="item in maintainerOptions"
:key="item.id"
@ -115,7 +115,7 @@ export default {
data() {
return {
result: {},
test: {schedule: {}},
test: {schedule: {}, follows: []},
savePath: "/performance/save",
editPath: "/performance/edit",
runPath: "/performance/run",
@ -255,6 +255,9 @@ export default {
if (!this.test.schedule) {
this.test.schedule = {};
}
this.$get('/performance/test/follow/' + testId, response => {
this.$set(this.test, 'follows', response.data);
});
}
});
}