refactor: 接口定义关注人多选

This commit is contained in:
CaptainB 2021-10-23 15:12:55 +08:00 committed by 刘瑞斌
parent 219ccc7c4b
commit 4e5807687a
11 changed files with 272 additions and 307 deletions

View File

@ -324,4 +324,9 @@ public class ApiDefinitionController {
public Pager< List<ApiDefinitionResult>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) { public Pager< List<ApiDefinitionResult>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiDefinitionRequest request) {
return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize); return apiDefinitionService.getRelationshipRelateList(request, goPage, pageSize);
} }
@GetMapping("/follow/{definitionId}")
public List<String> getFollows(@PathVariable String definitionId) {
return apiDefinitionService.getFollows(definitionId);
}
} }

View File

@ -42,7 +42,7 @@ public class SaveApiDefinitionRequest {
private String userId; private String userId;
private String followPeople; private List<String> follows;
private String remark; private String remark;

View File

@ -123,6 +123,8 @@ public class ApiDefinitionService {
private ExtApiTestCaseMapper extApiTestCaseMapper; private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource @Resource
private RelationshipEdgeService relationshipEdgeService; private RelationshipEdgeService relationshipEdgeService;
@Resource
private ApiDefinitionFollowMapper apiDefinitionFollowMapper;
private static Cache cache = Cache.newHardMemoryCache(0, 3600); private static Cache cache = Cache.newHardMemoryCache(0, 3600);
@ -476,7 +478,6 @@ public class ApiDefinitionService {
test.setEnvironmentId(request.getEnvironmentId()); test.setEnvironmentId(request.getEnvironmentId());
test.setUserId(request.getUserId()); test.setUserId(request.getUserId());
test.setRemark(request.getRemark()); test.setRemark(request.getRemark());
test.setFollowPeople(request.getFollowPeople());
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) { if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
test.setTags(request.getTags()); test.setTags(request.getTags());
} else { } else {
@ -488,10 +489,24 @@ public class ApiDefinitionService {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
ids.add(request.getId()); ids.add(request.getId());
apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol()); apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol());
saveFollows(test.getId(), request.getFollows());
return test; return test;
} }
private void saveFollows(String definitionId, List<String> follows) {
ApiDefinitionFollowExample example = new ApiDefinitionFollowExample();
example.createCriteria().andDefinitionIdEqualTo(definitionId);
apiDefinitionFollowMapper.deleteByExample(example);
if (!org.springframework.util.CollectionUtils.isEmpty(follows)) {
for (String follow : follows) {
ApiDefinitionFollow item = new ApiDefinitionFollow();
item.setDefinitionId(definitionId);
item.setFollowId(follow);
apiDefinitionFollowMapper.insert(item);
}
}
}
private ApiDefinitionWithBLOBs createTest(SaveApiDefinitionRequest request) { private ApiDefinitionWithBLOBs createTest(SaveApiDefinitionRequest request) {
checkNameExist(request); checkNameExist(request);
if (StringUtils.equals(request.getMethod(), "ESB")) { if (StringUtils.equals(request.getMethod(), "ESB")) {
@ -513,7 +528,6 @@ public class ApiDefinitionService {
test.setStatus(APITestStatus.Underway.name()); test.setStatus(APITestStatus.Underway.name());
test.setModulePath(request.getModulePath()); test.setModulePath(request.getModulePath());
test.setModuleId(request.getModuleId()); test.setModuleId(request.getModuleId());
test.setFollowPeople(request.getFollowPeople());
test.setRemark(request.getRemark()); test.setRemark(request.getRemark());
test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiDefinitionMapper::getLastOrder)); test.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extApiDefinitionMapper::getLastOrder));
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) { if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
@ -540,6 +554,7 @@ public class ApiDefinitionService {
test.setTags(""); test.setTags("");
} }
apiDefinitionMapper.insert(test); apiDefinitionMapper.insert(test);
saveFollows(test.getId(), request.getFollows());
return test; return test;
} }
@ -870,8 +885,8 @@ public class ApiDefinitionService {
public void addResult(TestResult res) { public void addResult(TestResult res) {
if (res != null && CollectionUtils.isNotEmpty(res.getScenarios()) && res.getScenarios().get(0) != null && CollectionUtils.isNotEmpty(res.getScenarios().get(0).getRequestResults())) { if (res != null && CollectionUtils.isNotEmpty(res.getScenarios()) && res.getScenarios().get(0) != null && CollectionUtils.isNotEmpty(res.getScenarios().get(0).getRequestResults())) {
RequestResult result = null; RequestResult result = null;
for(RequestResult itemResult : res.getScenarios().get(0).getRequestResults()){ for (RequestResult itemResult : res.getScenarios().get(0).getRequestResults()) {
if(!StringUtils.equalsIgnoreCase(itemResult.getMethod(),"Request") && !StringUtils.startsWithAny(itemResult.getName(),"PRE_PROCESSOR_ENV_","POST_PROCESSOR_ENV_")){ if (!StringUtils.equalsIgnoreCase(itemResult.getMethod(), "Request") && !StringUtils.startsWithAny(itemResult.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
result = itemResult; result = itemResult;
break; break;
} }
@ -1675,4 +1690,15 @@ public class ApiDefinitionService {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, extApiDefinitionMapper.list(request)); return PageUtils.setPageInfo(page, extApiDefinitionMapper.list(request));
} }
public List<String> getFollows(String definitionId) {
List<String> result = new ArrayList<>();
if (StringUtils.isBlank(definitionId)) {
return result;
}
ApiDefinitionFollowExample example = new ApiDefinitionFollowExample();
example.createCriteria().andDefinitionIdEqualTo(definitionId);
List<ApiDefinitionFollow> follows = apiDefinitionFollowMapper.selectByExample(example);
return follows.stream().map(ApiDefinitionFollow::getFollowId).distinct().collect(Collectors.toList());
}
} }

View File

@ -13,10 +13,6 @@ public class ApiDefinition implements Serializable {
private String method; private String method;
private String protocol;
private String path;
private String modulePath; private String modulePath;
private String environmentId; private String environmentId;
@ -33,6 +29,10 @@ public class ApiDefinition implements Serializable {
private Long updateTime; private Long updateTime;
private String protocol;
private String path;
private Integer num; private Integer num;
private String tags; private String tags;
@ -51,8 +51,6 @@ public class ApiDefinition implements Serializable {
private String deleteUserId; private String deleteUserId;
private String followPeople;
private Long order; private Long order;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -384,146 +384,6 @@ public class ApiDefinitionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProtocolIsNull() {
addCriterion("protocol is null");
return (Criteria) this;
}
public Criteria andProtocolIsNotNull() {
addCriterion("protocol is not null");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotEqualTo(String value) {
addCriterion("protocol <>", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThan(String value) {
addCriterion("protocol >", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThanOrEqualTo(String value) {
addCriterion("protocol >=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThan(String value) {
addCriterion("protocol <", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThanOrEqualTo(String value) {
addCriterion("protocol <=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLike(String value) {
addCriterion("protocol like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotLike(String value) {
addCriterion("protocol not like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolIn(List<String> values) {
addCriterion("protocol in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotIn(List<String> values) {
addCriterion("protocol not in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolBetween(String value1, String value2) {
addCriterion("protocol between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotBetween(String value1, String value2) {
addCriterion("protocol not between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andModulePathIsNull() { public Criteria andModulePathIsNull() {
addCriterion("module_path is null"); addCriterion("module_path is null");
return (Criteria) this; return (Criteria) this;
@ -1064,6 +924,146 @@ public class ApiDefinitionExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andProtocolIsNull() {
addCriterion("protocol is null");
return (Criteria) this;
}
public Criteria andProtocolIsNotNull() {
addCriterion("protocol is not null");
return (Criteria) this;
}
public Criteria andProtocolEqualTo(String value) {
addCriterion("protocol =", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotEqualTo(String value) {
addCriterion("protocol <>", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThan(String value) {
addCriterion("protocol >", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolGreaterThanOrEqualTo(String value) {
addCriterion("protocol >=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThan(String value) {
addCriterion("protocol <", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLessThanOrEqualTo(String value) {
addCriterion("protocol <=", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolLike(String value) {
addCriterion("protocol like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotLike(String value) {
addCriterion("protocol not like", value, "protocol");
return (Criteria) this;
}
public Criteria andProtocolIn(List<String> values) {
addCriterion("protocol in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotIn(List<String> values) {
addCriterion("protocol not in", values, "protocol");
return (Criteria) this;
}
public Criteria andProtocolBetween(String value1, String value2) {
addCriterion("protocol between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andProtocolNotBetween(String value1, String value2) {
addCriterion("protocol not between", value1, value2, "protocol");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andNumIsNull() { public Criteria andNumIsNull() {
addCriterion("num is null"); addCriterion("num is null");
return (Criteria) this; return (Criteria) this;
@ -1674,76 +1674,6 @@ public class ApiDefinitionExample {
return (Criteria) this; 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() { public Criteria andOrderIsNull() {
addCriterion("`order` is null"); addCriterion("`order` is null");
return (Criteria) this; return (Criteria) this;

View File

@ -6,8 +6,6 @@
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="method" jdbcType="VARCHAR" property="method" /> <result column="method" jdbcType="VARCHAR" property="method" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="module_path" jdbcType="VARCHAR" property="modulePath" /> <result column="module_path" jdbcType="VARCHAR" property="modulePath" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" /> <result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="schedule" jdbcType="VARCHAR" property="schedule" /> <result column="schedule" jdbcType="VARCHAR" property="schedule" />
@ -16,6 +14,8 @@
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="num" jdbcType="INTEGER" property="num" /> <result column="num" jdbcType="INTEGER" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" /> <result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="original_state" jdbcType="VARCHAR" property="originalState" /> <result column="original_state" jdbcType="VARCHAR" property="originalState" />
@ -25,7 +25,6 @@
<result column="case_passing_rate" jdbcType="VARCHAR" property="casePassingRate" /> <result column="case_passing_rate" jdbcType="VARCHAR" property="casePassingRate" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" /> <result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" /> <result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
<result column="order" jdbcType="BIGINT" property="order" /> <result column="order" jdbcType="BIGINT" property="order" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
@ -93,10 +92,10 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, project_id, `name`, `method`, protocol, `path`, module_path, environment_id, id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
schedule, `status`, module_id, user_id, create_time, update_time, num, tags, original_state, module_id, user_id, create_time, update_time, protocol, `path`, num, tags, original_state,
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id, create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
follow_people, `order` `order`
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
description, request, response, remark description, request, response, remark
@ -151,25 +150,25 @@
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition (id, project_id, `name`, insert into api_definition (id, project_id, `name`,
`method`, protocol, `path`, `method`, module_path, environment_id,
module_path, environment_id, schedule, schedule, `status`, module_id,
`status`, module_id, user_id, user_id, create_time, update_time,
create_time, update_time, num, protocol, `path`, num,
tags, original_state, create_user, tags, original_state, create_user,
case_total, case_status, case_passing_rate, case_total, case_status, case_passing_rate,
delete_time, delete_user_id, follow_people, delete_time, delete_user_id, `order`,
`order`, description, request, description, request, response,
response, remark) remark)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
#{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{num,jdbcType=INTEGER}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
#{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR}, #{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{order,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR},
#{response,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}) #{remark,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
insert into api_definition insert into api_definition
@ -186,12 +185,6 @@
<if test="method != null"> <if test="method != null">
`method`, `method`,
</if> </if>
<if test="protocol != null">
protocol,
</if>
<if test="path != null">
`path`,
</if>
<if test="modulePath != null"> <if test="modulePath != null">
module_path, module_path,
</if> </if>
@ -216,6 +209,12 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="protocol != null">
protocol,
</if>
<if test="path != null">
`path`,
</if>
<if test="num != null"> <if test="num != null">
num, num,
</if> </if>
@ -243,9 +242,6 @@
<if test="deleteUserId != null"> <if test="deleteUserId != null">
delete_user_id, delete_user_id,
</if> </if>
<if test="followPeople != null">
follow_people,
</if>
<if test="order != null"> <if test="order != null">
`order`, `order`,
</if> </if>
@ -275,12 +271,6 @@
<if test="method != null"> <if test="method != null">
#{method,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
</if> </if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="modulePath != null"> <if test="modulePath != null">
#{modulePath,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
</if> </if>
@ -305,6 +295,12 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="protocol != null">
#{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="num != null"> <if test="num != null">
#{num,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
</if> </if>
@ -332,9 +328,6 @@
<if test="deleteUserId != null"> <if test="deleteUserId != null">
#{deleteUserId,jdbcType=VARCHAR}, #{deleteUserId,jdbcType=VARCHAR},
</if> </if>
<if test="followPeople != null">
#{followPeople,jdbcType=VARCHAR},
</if>
<if test="order != null"> <if test="order != null">
#{order,jdbcType=BIGINT}, #{order,jdbcType=BIGINT},
</if> </if>
@ -373,12 +366,6 @@
<if test="record.method != null"> <if test="record.method != null">
`method` = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
</if> </if>
<if test="record.protocol != null">
protocol = #{record.protocol,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
<if test="record.modulePath != null"> <if test="record.modulePath != null">
module_path = #{record.modulePath,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR},
</if> </if>
@ -403,6 +390,12 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.protocol != null">
protocol = #{record.protocol,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
<if test="record.num != null"> <if test="record.num != null">
num = #{record.num,jdbcType=INTEGER}, num = #{record.num,jdbcType=INTEGER},
</if> </if>
@ -430,9 +423,6 @@
<if test="record.deleteUserId != null"> <if test="record.deleteUserId != null">
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
</if> </if>
<if test="record.followPeople != null">
follow_people = #{record.followPeople,jdbcType=VARCHAR},
</if>
<if test="record.order != null"> <if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
</if> </if>
@ -459,8 +449,6 @@
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR}, environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR}, schedule = #{record.schedule,jdbcType=VARCHAR},
@ -469,6 +457,8 @@
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
num = #{record.num,jdbcType=INTEGER}, num = #{record.num,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR},
original_state = #{record.originalState,jdbcType=VARCHAR}, original_state = #{record.originalState,jdbcType=VARCHAR},
@ -478,7 +468,6 @@
case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR}, case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT}, delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
description = #{record.description,jdbcType=LONGVARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR},
request = #{record.request,jdbcType=LONGVARCHAR}, request = #{record.request,jdbcType=LONGVARCHAR},
@ -494,8 +483,6 @@
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR}, environment_id = #{record.environmentId,jdbcType=VARCHAR},
schedule = #{record.schedule,jdbcType=VARCHAR}, schedule = #{record.schedule,jdbcType=VARCHAR},
@ -504,6 +491,8 @@
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
protocol = #{record.protocol,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR},
num = #{record.num,jdbcType=INTEGER}, num = #{record.num,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=VARCHAR}, tags = #{record.tags,jdbcType=VARCHAR},
original_state = #{record.originalState,jdbcType=VARCHAR}, original_state = #{record.originalState,jdbcType=VARCHAR},
@ -513,7 +502,6 @@
case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR}, case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT}, delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT} `order` = #{record.order,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -531,12 +519,6 @@
<if test="method != null"> <if test="method != null">
`method` = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
</if> </if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="modulePath != null"> <if test="modulePath != null">
module_path = #{modulePath,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR},
</if> </if>
@ -561,6 +543,12 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="protocol != null">
protocol = #{protocol,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="num != null"> <if test="num != null">
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
</if> </if>
@ -588,9 +576,6 @@
<if test="deleteUserId != null"> <if test="deleteUserId != null">
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
</if> </if>
<if test="followPeople != null">
follow_people = #{followPeople,jdbcType=VARCHAR},
</if>
<if test="order != null"> <if test="order != null">
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
</if> </if>
@ -614,8 +599,6 @@
set project_id = #{projectId,jdbcType=VARCHAR}, set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR}, environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR}, schedule = #{schedule,jdbcType=VARCHAR},
@ -624,6 +607,8 @@
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR},
original_state = #{originalState,jdbcType=VARCHAR}, original_state = #{originalState,jdbcType=VARCHAR},
@ -633,7 +618,6 @@
case_passing_rate = #{casePassingRate,jdbcType=VARCHAR}, case_passing_rate = #{casePassingRate,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT}, delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
description = #{description,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=LONGVARCHAR},
request = #{request,jdbcType=LONGVARCHAR}, request = #{request,jdbcType=LONGVARCHAR},
@ -646,8 +630,6 @@
set project_id = #{projectId,jdbcType=VARCHAR}, set project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR}, environment_id = #{environmentId,jdbcType=VARCHAR},
schedule = #{schedule,jdbcType=VARCHAR}, schedule = #{schedule,jdbcType=VARCHAR},
@ -656,6 +638,8 @@
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
protocol = #{protocol,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
tags = #{tags,jdbcType=VARCHAR}, tags = #{tags,jdbcType=VARCHAR},
original_state = #{originalState,jdbcType=VARCHAR}, original_state = #{originalState,jdbcType=VARCHAR},
@ -665,7 +649,6 @@
case_passing_rate = #{casePassingRate,jdbcType=VARCHAR}, case_passing_rate = #{casePassingRate,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT}, delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT} `order` = #{order,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>

View File

@ -368,3 +368,17 @@ SELECT id, follow_people
FROM api_scenario FROM api_scenario
WHERE follow_people IS NOT NULL; WHERE follow_people IS NOT NULL;
ALTER TABLE api_scenario DROP COLUMN follow_people; ALTER TABLE api_scenario DROP COLUMN follow_people;
-- 接口定义关注人
CREATE TABLE IF NOT EXISTS `api_definition_follow` (
`definition_id` VARCHAR(50) DEFAULT NULL,
`follow_id` VARCHAR(50) DEFAULT NULL,
UNIQUE KEY `api_definition_follow_scenario_id_follow_id_pk` (`definition_id`, `follow_id`),
KEY `api_definition_follow_id_index` (`follow_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
-- 接口定义数据迁移
INSERT INTO api_definition_follow
SELECT id, follow_people
FROM api_definition
WHERE follow_people IS NOT NULL;
ALTER TABLE api_definition DROP COLUMN follow_people;

View File

@ -47,8 +47,8 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople"> <el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="basicForm.followPeople" <el-select v-model="basicForm.follows"
clearable clearable multiple
:placeholder="$t('api_test.automation.follow_people')" filterable size="small" :placeholder="$t('api_test.automation.follow_people')" filterable size="small"
class="ms-http-textarea"> class="ms-http-textarea">
<el-option <el-option
@ -95,6 +95,9 @@
created() { created() {
this.getMaintainerOptions(); this.getMaintainerOptions();
this.basicForm = this.basisData; this.basicForm = this.basisData;
this.$get('/api/definition/follow/' + this.basisData.id, response => {
this.basicForm.follows = response.data;
});
}, },
data() { data() {
return { return {

View File

@ -71,8 +71,8 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople"> <el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="httpForm.followPeople" <el-select v-model="httpForm.follows"
clearable clearable multiple
:placeholder="$t('api_test.automation.follow_people')" filterable size="small" :placeholder="$t('api_test.automation.follow_people')" filterable size="small"
class="ms-http-textarea"> class="ms-http-textarea">
<el-option <el-option
@ -359,7 +359,9 @@
this.basisData.environmentId = ""; this.basisData.environmentId = "";
} }
this.httpForm = JSON.parse(JSON.stringify(this.basisData)); this.httpForm = JSON.parse(JSON.stringify(this.basisData));
this.$get('/api/definition/follow/' + this.basisData.id, response => {
this.httpForm.follows = response.data;
});
this.initMockEnvironment(); this.initMockEnvironment();
} }
} }

View File

@ -54,8 +54,9 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople"> <el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="basicForm.followPeople" <el-select v-model="basicForm.follows"
clearable clearable
multiple
:placeholder="$t('api_test.automation.follow_people')" filterable size="small" :placeholder="$t('api_test.automation.follow_people')" filterable size="small"
class="ms-http-textarea"> class="ms-http-textarea">
<el-option <el-option
@ -106,6 +107,9 @@
if (this.basicForm.protocol == null) { if (this.basicForm.protocol == null) {
this.basicForm.protocol = "TCP"; this.basicForm.protocol = "TCP";
} }
this.$get('/api/definition/follow/' + this.basisData.id, response => {
this.basicForm.follows = response.data;
});
}, },
data() { data() {
return { return {