feat: 功能用例添加前后置对象

This commit is contained in:
chenjianxing 2021-10-13 10:47:06 +08:00 committed by jianxing
parent 41f8546dae
commit ecc7f4bb02
33 changed files with 1549 additions and 107 deletions

View File

@ -0,0 +1,23 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class RelationshipEdge implements Serializable {
private String sourceId;
private String targetId;
private String relationshipType;
private String resourceType;
private String graphId;
private String creator;
private Long createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,680 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class RelationshipEdgeExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RelationshipEdgeExample() {
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 andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andTargetIdIsNull() {
addCriterion("target_id is null");
return (Criteria) this;
}
public Criteria andTargetIdIsNotNull() {
addCriterion("target_id is not null");
return (Criteria) this;
}
public Criteria andTargetIdEqualTo(String value) {
addCriterion("target_id =", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotEqualTo(String value) {
addCriterion("target_id <>", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdGreaterThan(String value) {
addCriterion("target_id >", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdGreaterThanOrEqualTo(String value) {
addCriterion("target_id >=", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLessThan(String value) {
addCriterion("target_id <", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLessThanOrEqualTo(String value) {
addCriterion("target_id <=", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdLike(String value) {
addCriterion("target_id like", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotLike(String value) {
addCriterion("target_id not like", value, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdIn(List<String> values) {
addCriterion("target_id in", values, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotIn(List<String> values) {
addCriterion("target_id not in", values, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdBetween(String value1, String value2) {
addCriterion("target_id between", value1, value2, "targetId");
return (Criteria) this;
}
public Criteria andTargetIdNotBetween(String value1, String value2) {
addCriterion("target_id not between", value1, value2, "targetId");
return (Criteria) this;
}
public Criteria andRelationshipTypeIsNull() {
addCriterion("relationship_type is null");
return (Criteria) this;
}
public Criteria andRelationshipTypeIsNotNull() {
addCriterion("relationship_type is not null");
return (Criteria) this;
}
public Criteria andRelationshipTypeEqualTo(String value) {
addCriterion("relationship_type =", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeNotEqualTo(String value) {
addCriterion("relationship_type <>", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeGreaterThan(String value) {
addCriterion("relationship_type >", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeGreaterThanOrEqualTo(String value) {
addCriterion("relationship_type >=", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeLessThan(String value) {
addCriterion("relationship_type <", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeLessThanOrEqualTo(String value) {
addCriterion("relationship_type <=", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeLike(String value) {
addCriterion("relationship_type like", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeNotLike(String value) {
addCriterion("relationship_type not like", value, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeIn(List<String> values) {
addCriterion("relationship_type in", values, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeNotIn(List<String> values) {
addCriterion("relationship_type not in", values, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeBetween(String value1, String value2) {
addCriterion("relationship_type between", value1, value2, "relationshipType");
return (Criteria) this;
}
public Criteria andRelationshipTypeNotBetween(String value1, String value2) {
addCriterion("relationship_type not between", value1, value2, "relationshipType");
return (Criteria) this;
}
public Criteria andResourceTypeIsNull() {
addCriterion("resource_type is null");
return (Criteria) this;
}
public Criteria andResourceTypeIsNotNull() {
addCriterion("resource_type is not null");
return (Criteria) this;
}
public Criteria andResourceTypeEqualTo(String value) {
addCriterion("resource_type =", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeNotEqualTo(String value) {
addCriterion("resource_type <>", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeGreaterThan(String value) {
addCriterion("resource_type >", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeGreaterThanOrEqualTo(String value) {
addCriterion("resource_type >=", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeLessThan(String value) {
addCriterion("resource_type <", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeLessThanOrEqualTo(String value) {
addCriterion("resource_type <=", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeLike(String value) {
addCriterion("resource_type like", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeNotLike(String value) {
addCriterion("resource_type not like", value, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeIn(List<String> values) {
addCriterion("resource_type in", values, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeNotIn(List<String> values) {
addCriterion("resource_type not in", values, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeBetween(String value1, String value2) {
addCriterion("resource_type between", value1, value2, "resourceType");
return (Criteria) this;
}
public Criteria andResourceTypeNotBetween(String value1, String value2) {
addCriterion("resource_type not between", value1, value2, "resourceType");
return (Criteria) this;
}
public Criteria andGraphIdIsNull() {
addCriterion("graph_id is null");
return (Criteria) this;
}
public Criteria andGraphIdIsNotNull() {
addCriterion("graph_id is not null");
return (Criteria) this;
}
public Criteria andGraphIdEqualTo(String value) {
addCriterion("graph_id =", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotEqualTo(String value) {
addCriterion("graph_id <>", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdGreaterThan(String value) {
addCriterion("graph_id >", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdGreaterThanOrEqualTo(String value) {
addCriterion("graph_id >=", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLessThan(String value) {
addCriterion("graph_id <", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLessThanOrEqualTo(String value) {
addCriterion("graph_id <=", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdLike(String value) {
addCriterion("graph_id like", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotLike(String value) {
addCriterion("graph_id not like", value, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdIn(List<String> values) {
addCriterion("graph_id in", values, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotIn(List<String> values) {
addCriterion("graph_id not in", values, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdBetween(String value1, String value2) {
addCriterion("graph_id between", value1, value2, "graphId");
return (Criteria) this;
}
public Criteria andGraphIdNotBetween(String value1, String value2) {
addCriterion("graph_id not between", value1, value2, "graphId");
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;
}
public Criteria andCreatorIsNotNull() {
addCriterion("creator is not null");
return (Criteria) this;
}
public Criteria andCreatorEqualTo(String value) {
addCriterion("creator =", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotEqualTo(String value) {
addCriterion("creator <>", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThan(String value) {
addCriterion("creator >", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorGreaterThanOrEqualTo(String value) {
addCriterion("creator >=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThan(String value) {
addCriterion("creator <", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLessThanOrEqualTo(String value) {
addCriterion("creator <=", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorLike(String value) {
addCriterion("creator like", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotLike(String value) {
addCriterion("creator not like", value, "creator");
return (Criteria) this;
}
public Criteria andCreatorIn(List<String> values) {
addCriterion("creator in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotIn(List<String> values) {
addCriterion("creator not in", values, "creator");
return (Criteria) this;
}
public Criteria andCreatorBetween(String value1, String value2) {
addCriterion("creator between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreatorNotBetween(String value1, String value2) {
addCriterion("creator not between", value1, value2, "creator");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
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.RelationshipEdge;
import io.metersphere.base.domain.RelationshipEdgeExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface RelationshipEdgeMapper {
long countByExample(RelationshipEdgeExample example);
int deleteByExample(RelationshipEdgeExample example);
int insert(RelationshipEdge record);
int insertSelective(RelationshipEdge record);
List<RelationshipEdge> selectByExample(RelationshipEdgeExample example);
int updateByExampleSelective(@Param("record") RelationshipEdge record, @Param("example") RelationshipEdgeExample example);
int updateByExample(@Param("record") RelationshipEdge record, @Param("example") RelationshipEdgeExample example);
}

View File

@ -0,0 +1,199 @@
<?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.RelationshipEdgeMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.RelationshipEdge">
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="target_id" jdbcType="VARCHAR" property="targetId" />
<result column="relationship_type" jdbcType="VARCHAR" property="relationshipType" />
<result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
<result column="graph_id" jdbcType="VARCHAR" property="graphId" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</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">
source_id, target_id, relationship_type, resource_type, graph_id, creator, create_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.RelationshipEdgeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from relationship_edge
<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.RelationshipEdgeExample">
delete from relationship_edge
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.RelationshipEdge">
insert into relationship_edge (source_id, target_id, relationship_type,
resource_type, graph_id, creator,
create_time)
values (#{sourceId,jdbcType=VARCHAR}, #{targetId,jdbcType=VARCHAR}, #{relationshipType,jdbcType=VARCHAR},
#{resourceType,jdbcType=VARCHAR}, #{graphId,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.RelationshipEdge">
insert into relationship_edge
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sourceId != null">
source_id,
</if>
<if test="targetId != null">
target_id,
</if>
<if test="relationshipType != null">
relationship_type,
</if>
<if test="resourceType != null">
resource_type,
</if>
<if test="graphId != null">
graph_id,
</if>
<if test="creator != null">
creator,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="targetId != null">
#{targetId,jdbcType=VARCHAR},
</if>
<if test="relationshipType != null">
#{relationshipType,jdbcType=VARCHAR},
</if>
<if test="resourceType != null">
#{resourceType,jdbcType=VARCHAR},
</if>
<if test="graphId != null">
#{graphId,jdbcType=VARCHAR},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.RelationshipEdgeExample" resultType="java.lang.Long">
select count(*) from relationship_edge
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update relationship_edge
<set>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.targetId != null">
target_id = #{record.targetId,jdbcType=VARCHAR},
</if>
<if test="record.relationshipType != null">
relationship_type = #{record.relationshipType,jdbcType=VARCHAR},
</if>
<if test="record.resourceType != null">
resource_type = #{record.resourceType,jdbcType=VARCHAR},
</if>
<if test="record.graphId != null">
graph_id = #{record.graphId,jdbcType=VARCHAR},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update relationship_edge
set source_id = #{record.sourceId,jdbcType=VARCHAR},
target_id = #{record.targetId,jdbcType=VARCHAR},
relationship_type = #{record.relationshipType,jdbcType=VARCHAR},
resource_type = #{record.resourceType,jdbcType=VARCHAR},
graph_id = #{record.graphId,jdbcType=VARCHAR},
creator = #{record.creator,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -118,4 +118,6 @@ public interface ExtTestCaseMapper {
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
List<TestCase> getTestCase(@Param("request") QueryTestCaseRequest request);
}

View File

@ -551,6 +551,13 @@
</if>
order by `order` desc limit 1;
</select>
<select id="getTestCase" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status,
test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time, test_case.update_time
from test_case as test_case
<include refid="notInQueryWhereCondition"></include>
ORDER BY test_case.order DESC
</select>
<update id="deleteToGc">
update test_case set original_status=status,

View File

@ -0,0 +1,27 @@
package io.metersphere.controller;
import io.metersphere.controller.request.RelationshipEdgeRequest;
import io.metersphere.service.RelationshipEdgeService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RequestMapping("relationship/edge")
@RestController
public class RelationshipEdgeController {
@Resource
private RelationshipEdgeService relationshipEdgeService;
@PostMapping("/save/batch")
public void add(@RequestBody RelationshipEdgeRequest request) {
relationshipEdgeService.saveBatch(request);
}
@GetMapping("/delete")
public void delete(@PathVariable("sourceId") String sourceId, @PathVariable("targetId") String targetId) {
relationshipEdgeService.delete(sourceId, targetId);
}
}

View File

@ -0,0 +1,13 @@
package io.metersphere.controller.request;
import io.metersphere.base.domain.RelationshipEdge;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class RelationshipEdgeRequest extends RelationshipEdge {
private List<String> targetIds;
}

View File

@ -0,0 +1,13 @@
package io.metersphere.dto;
import io.metersphere.base.domain.RelationshipEdge;
import lombok.Data;
@Data
public class RelationshipEdgeDTO extends RelationshipEdge {
private String targetName;
private Integer targetNum;
private String targetCustomNum;
private String status;
private String creator;
}

View File

@ -0,0 +1,103 @@
package io.metersphere.service;
import io.metersphere.base.domain.RelationshipEdge;
import io.metersphere.base.domain.RelationshipEdgeExample;
import io.metersphere.base.mapper.RelationshipEdgeMapper;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.RelationshipEdgeRequest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author jianxingChen
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class RelationshipEdgeService {
@Resource
private RelationshipEdgeMapper relationshipEdgeMapper;
@Resource
private SqlSessionFactory sqlSessionFactory;
public void delete(String sourceId, String targetId) {
RelationshipEdgeExample example = new RelationshipEdgeExample();
example.createCriteria()
.andSourceIdEqualTo(sourceId)
.andTargetIdEqualTo(targetId);
relationshipEdgeMapper.deleteByExample(example);
}
public List<RelationshipEdge> getBySourceId(String sourceId) {
RelationshipEdgeExample example = new RelationshipEdgeExample();
example.createCriteria()
.andSourceIdEqualTo(sourceId);
return relationshipEdgeMapper.selectByExample(example);
}
public List<RelationshipEdge> getBySourceIdAndRelationType(String sourceId, String relationType) {
RelationshipEdgeExample example = new RelationshipEdgeExample();
example.createCriteria()
.andSourceIdEqualTo(sourceId)
.andRelationshipTypeEqualTo(relationType);
return relationshipEdgeMapper.selectByExample(example);
}
public void saveBatch(RelationshipEdgeRequest request) {
if (CollectionUtils.isEmpty(request.getTargetIds())) {
return;
}
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
RelationshipEdgeMapper batchMapper = sqlSession.getMapper(RelationshipEdgeMapper.class);
String graphId = UUID.randomUUID().toString();
// 判断这些顶点是否已经和其他顶点连通
// 连通的话加到同一个图中否则新建一个图 graphId
List<String> graphNodes = new ArrayList<>();
graphNodes.add(request.getSourceId());
graphNodes.addAll(request.getTargetIds());
RelationshipEdgeExample example = new RelationshipEdgeExample();
example.createCriteria()
.andSourceIdIn(graphNodes)
.andRelationshipTypeEqualTo(request.getRelationshipType());
example.or(
example.createCriteria()
.andTargetIdIn(graphNodes)
.andRelationshipTypeEqualTo(request.getRelationshipType())
);
List<RelationshipEdge> relationshipEdges = relationshipEdgeMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(relationshipEdges)) {
graphId = relationshipEdges.get(0).getGraphId();
}
// todo 检验是否有环
for (String targetId : request.getTargetIds()) {
RelationshipEdge edge = new RelationshipEdge();
edge.setSourceId(request.getSourceId());
edge.setTargetId(targetId);
edge.setGraphId(graphId);
edge.setRelationshipType(request.getRelationshipType());
edge.setResourceType(request.getResourceType());
edge.setCreator(SessionUtils.getUserId());
edge.setCreateTime(System.currentTimeMillis());
batchMapper.insert(edge);
}
sqlSession.flushStatements();
}
}

View File

@ -19,6 +19,7 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.RelationshipEdgeDTO;
import io.metersphere.dto.TestCaseTestDao;
import io.metersphere.excel.domain.ExcelResponse;
import io.metersphere.log.annotation.MsAuditLog;
@ -99,6 +100,10 @@ public class TestCaseController {
return testCaseService.listTestCaseIds(request);
}
@GetMapping("/relationship/case/{id}/{relationshipType}")
public List<RelationshipEdgeDTO> getRelationshipCase(@PathVariable("id") String id, @PathVariable("relationshipType") String relationshipType) {
return testCaseService.getRelationshipCase(id, relationshipType);
}
@GetMapping("recent/{count}")
public List<TestCase> recentTestPlans(@PathVariable int count) {
@ -115,6 +120,12 @@ public class TestCaseController {
return PageUtils.setPageInfo(page, testCaseService.getTestCaseRelateList(request));
}
@PostMapping("/relationship/relate/{goPage}/{pageSize}")
public Pager<List<TestCase>> getRelationshipRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.getRelationshipRelateList(request));
}
@PostMapping("/relate/issue/{goPage}/{pageSize}")
public Pager<List<TestCaseDTO>> getTestCaseIssueRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);

View File

@ -10,8 +10,12 @@ import java.util.List;
@Setter
public class QueryTestCaseRequest extends BaseQueryRequest {
private String id;
private String name;
private String relationshipType;
private List<String> testCaseIds;
private String planId;

View File

@ -127,7 +127,7 @@ public class TestCaseService {
@Resource
private IssuesMapper issuesMapper;
@Resource
private CustomFieldService customFieldService;
private RelationshipEdgeService relationshipEdgeService;
@Resource
@Lazy
private ApiTestCaseService apiTestCaseService;
@ -1945,4 +1945,40 @@ public class TestCaseService {
extTestCaseMapper::getLastOrder,
testCaseMapper::updateByPrimaryKeySelective);
}
public List<TestCase> getRelationshipRelateList(QueryTestCaseRequest request) {
setDefaultOrder(request);
List<RelationshipEdge> relationshipEdges = relationshipEdgeService.getBySourceId(request.getId());
List<String> ids = relationshipEdges.stream().map(RelationshipEdge::getTargetId).collect(Collectors.toList());
ids.add(request.getId());
request.setTestCaseContainIds(ids);
return extTestCaseMapper.getTestCase(request);
// return extTestCaseMapper.getTestCaseByNotInPlan(request);
}
public List<RelationshipEdgeDTO> getRelationshipCase(String id, String relationshipType) {
List<RelationshipEdge> relationshipEdges = relationshipEdgeService.getBySourceIdAndRelationType(id, relationshipType);
List<String> targetIds = relationshipEdges.stream()
.map(RelationshipEdge::getTargetId)
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(targetIds)) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(targetIds);
List<TestCase> testCaseList = testCaseMapper.selectByExample(example);
Map<String, TestCase> caseMap = testCaseList.stream().collect(Collectors.toMap(TestCase::getId, i -> i));
List<RelationshipEdgeDTO> results = new ArrayList<>();
for (RelationshipEdge relationshipEdge : relationshipEdges) {
RelationshipEdgeDTO relationshipEdgeDTO = new RelationshipEdgeDTO();
BeanUtils.copyBean(relationshipEdgeDTO, relationshipEdge);
TestCase testCase = caseMap.get(relationshipEdge.getTargetId());
relationshipEdgeDTO.setTargetName(testCase.getName());
relationshipEdgeDTO.setCreator(testCase.getCreateUser());
relationshipEdgeDTO.setTargetNum(testCase.getNum());
relationshipEdgeDTO.setTargetCustomNum(testCase.getCustomNum());
results.add(relationshipEdgeDTO);
}
return results;
}
return new ArrayList<>();
}
}

View File

@ -35,4 +35,19 @@ END
DELIMITER ;
CALL test_cursor();
DROP PROCEDURE IF EXISTS test_cursor;
DROP PROCEDURE IF EXISTS test_cursor;
create table if not exists relationship_edge (
source_id varchar(50) not null comment '源节点的ID',
target_id varchar(50) not null comment '目标节点的ID',
relationship_type varchar(20) not null comment '关系的类型,前置后置或者依赖',
resource_type varchar(20) not null comment '是表示什么资源',
graph_id varchar(50) not null comment '所属关系图的ID',
creator varchar(50) not null comment '创建人',
create_time bigint(13) not null,
PRIMARY KEY (source_id, target_id)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE utf8mb4_general_ci;

View File

@ -78,7 +78,7 @@
<table tableName="test_plan"/>
<table tableName="test_case_test"/>-->
<!-- <table tableName="api_test_environment"></table>-->
<table tableName="report_statistics"/>
<table tableName="relationship_edge"/>
<!-- <table tableName="custom_field"></table>-->
<!-- <table tableName="test_case"></table>-->
<!-- <table tableName="test_case"></table>-->

View File

@ -33,7 +33,6 @@
@refreshAll="refreshAll"
@setCondition="setCondition"
@decrease="decrease"
:custom-num="custom_num"
ref="testCaseTrashList">
</test-case-list>
</el-tab-pane>
@ -60,7 +59,6 @@
@refreshAll="refreshAll"
@setCondition="setCondition"
@decrease="decrease"
:custom-num="custom_num"
ref="testCaseList">
</test-case-list>
<test-case-minder
@ -88,7 +86,6 @@
:select-node="selectNode"
:select-condition="condition"
:type="type"
:custom-num="custom_num"
@addTab="addTab"
ref="testCaseEdit">
</test-case-edit>
@ -165,7 +162,6 @@ export default {
type: '',
activeDom: 'left',
tmpActiveDom: null,
custom_num: false
};
},
mounted() {
@ -463,7 +459,7 @@ export default {
this.$get("/project/get/" + this.projectId, result => {
let data = result.data;
if (data) {
this.custom_num = data.customNum;
this.$store.commit('setCurrentProjectIsCustomNum', data.customNum);
}
});
},

View File

@ -0,0 +1,93 @@
<template>
<functional-relevance
:page="page"
:multiple-project="false"
:get-table-data="getTestCases"
:get-node-tree="getTreeNodes"
:save="saveCaseRelevance"
ref="functionalRelevance">
</functional-relevance>
</template>
<script>
import {buildPagePath, getPageDate, getPageInfo} from "@/common/js/tableUtils";
import {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "@/business/components/common/components/search/search-components";
import FunctionalRelevance from "@/business/components/track/plan/view/comonents/functional/FunctionalRelevance";
import {getTestCaseNodes} from "@/network/testCase";
export default {
name: "RelationshipFunctionalRelevance",
components: {
FunctionalRelevance,
},
data() {
return {
openType: 'relevance',
result: {},
page: getPageInfo({
components: TEST_PLAN_RELEVANCE_FUNC_CONFIGS
}),
};
},
props: {
caseId: {
type: String
},
relationshipType: String,
},
watch: {
caseId() {
this.page.condition.caseId = this.caseId;
},
},
methods: {
open() {
if (this.$refs.functionalRelevance) {
this.$refs.functionalRelevance.open();
}
},
saveCaseRelevance(param, vueObj) {
param.sourceId = this.caseId;
param.relationshipType = this.relationshipType;
param.resourceType = 'TEST_CASE';
param.targetIds = param.ids;
vueObj.result = this.$post('/relationship/edge/save/batch', param, () => {
vueObj.isSaving = false;
this.$success(this.$t('commons.save_success'));
vueObj.$refs.baseRelevance.close();
this.$emit('refresh');
},(error) => {
vueObj.isSaving = false;
});
},
search() {
this.getTestCases();
},
getTestCases() {
let condition = this.page.condition;
if (this.caseId) {
condition.id = this.caseId;
}
this.page.result = this.$post(buildPagePath('/test/case/relationship/relate', this.page), condition, response => {
getPageDate(response, this.page);
let data = this.page.data;
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
});
},
getTreeNodes(vueObj) {
vueObj.$refs.nodeTree.result = getTestCaseNodes(vueObj.projectId, data => {
vueObj.treeNodes = data;
vueObj.selectNodeIds = [];
});
}
}
}
</script>
<style scoped>
</style>

View File

@ -78,7 +78,7 @@
</el-row>
</el-form>
<el-row v-if="customNum">
<el-row v-if="isCustomNum">
<el-col :span="7">
<el-form-item label="ID" :label-width="formLabelWidth" prop="customNum">
<el-input :disabled="readOnly" v-model.trim="form.customNum" size="small" class="ms-case-input"></el-input>
@ -136,10 +136,9 @@
</template>
<script>
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import {TokenKey} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {
enableModules,
getCurrentProjectID,
getCurrentUser,
getNodePath,
@ -154,7 +153,7 @@
import {STEP} from "@/business/components/api/automation/scenario/Setting";
import TestCaseComment from "@/business/components/track/case/components/TestCaseComment";
import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem";
import {API_STATUS, REVIEW_STATUS, TEST, TEST_CASE} from "@/business/components/api/definition/model/JsonData";
import {API_STATUS, REVIEW_STATUS} from "@/business/components/api/definition/model/JsonData";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsSelectTree from "../../../common/select-tree/SelectTree";
import MsTestCaseStepRichText from "./MsRichText";
@ -286,10 +285,6 @@
type: Object
},
type: String,
customNum: {
type: Boolean,
default: false
}
},
computed: {
projectIds() {
@ -301,6 +296,9 @@
systemNameMap() {
return SYSTEM_FIELD_NAME_MAP;
},
isCustomNum() {
return this.$store.state.currentProjectIsCustomNum;
},
readOnly() {
const {rowClickHasPermission} = this.currentTestCaseInfo;
if (rowClickHasPermission !== undefined) {

View File

@ -39,6 +39,11 @@
:case-id="caseId" ref="issue"/>
</el-tab-pane>
<el-tab-pane :label="$t('依赖关系')" name="relationship">
<test-case-relationship-list :title="'前置对象'" relationship-type="PRE" :case-id="caseId" ref="preRelationshipList"/>
<test-case-relationship-list :title="'后置对象'" relationship-type="POST" :case-id="caseId" ref="postRelationshipList"/>
</el-tab-pane>
<el-tab-pane :label="$t('test_track.case.attachment')" name="attachment">
<el-row>
<el-col :span="20" :offset="1">
@ -78,10 +83,12 @@ import TestCaseAttachment from "@/business/components/track/case/components/Test
import TestCaseIssueRelate from "@/business/components/track/case/components/TestCaseIssueRelate";
import FormRichTextItem from "@/business/components/track/case/components/FormRichTextItem";
import TestCaseTestRelate from "@/business/components/track/case/components/TestCaseTestRelate";
import TestCaseRelationshipList from "@/business/components/track/case/components/TestCaseRelationshipList";
export default {
name: "TestCaseEditOtherInfo",
components: {
TestCaseRelationshipList,
TestCaseTestRelate,
FormRichTextItem, TestCaseIssueRelate, TestCaseAttachment, MsRichText, TestCaseRichText},
props: ['form', 'labelWidth', 'caseId', 'readOnly', 'projectId', 'isTestPlan', 'planId'],
@ -112,6 +119,9 @@ export default {
this.getDemandOptions();
} else if (this.tabActiveName === 'bug') {
this.$refs.issue.getIssues();
} else if (this.tabActiveName === 'relationship') {
this.$refs.preRelationshipList.getTableData();
this.$refs.postRelationshipList.getTableData();
} else if (this.tabActiveName === 'attachment') {
this.getFileMetaData();
}

View File

@ -368,10 +368,6 @@ export default {
type: Boolean,
default: false,
},
customNum: {
type: Boolean,
default: false
}
},
computed: {
projectId() {
@ -383,6 +379,9 @@ export default {
moduleOptions() {
return this.$store.state.testCaseModuleOptions;
},
customNum() {
return this.$store.state.currentProjectIsCustomNum;
},
systemFiledMap() {
return SYSTEM_FIELD_NAME_MAP;
},

View File

@ -0,0 +1,121 @@
<template>
<el-main>
<span>{{ title }}</span>
<el-button class="add-btn"
:disabled="readOnly" type="primary" size="mini" @click="openRelevance">{{ $t('添加') }}</el-button>
<ms-table
v-loading="result.loading"
:show-select-all="false"
:data="data"
:operators="operators"
:enable-selection="false"
ref="table"
:screen-height="null"
@refresh="getTableData">
<ms-table-column
prop="targetCustomNum"
v-if="isCustomNum"
:label="$t('commons.id')"
min-width="80"/>
<ms-table-column
prop="targetNum"
v-else
:label="$t('commons.id')"
min-width="80"/>
<ms-table-column
prop="targetName"
:label="$t('commons.name')"
min-width="120"/>
<ms-table-column
prop="creator"
:label="$t('commons.create_user')"
min-width="120">
</ms-table-column>
</ms-table>
<relationship-functional-relevance
:case-id="caseId"
@refresh="getTableData"
:relationship-type="relationshipType"
ref="testCaseRelevance"/>
</el-main>
</template>
<script>
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTableSearchBar from "@/business/components/common/components/MsTableSearchBar";
import RelationshipFunctionalRelevance
from "@/business/components/track/case/components/RelationshipFunctionalRelevance";
import {getRelationshipCase} from "@/network/testCase";
import {deleteRelationshipEdge} from "@/network/relationship-edge";
export default {
name: "TestCaseRelationshipList",
components: {RelationshipFunctionalRelevance, MsTableSearchBar, MsTableColumn, MsTable},
data() {
return {
result: {},
data: [],
operators: [
{
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete,
// permissions: ['PROJECT_TRACK_CASE:READ+DELETE']
}
],
condition: {},
options: [],
value: ''
}
},
props: {
tip: {
type: String,
default() {
return this.$t('commons.search_by_name_or_id');
}
},
caseId: String,
readOnly: Boolean,
relationshipType: String,
title: String,
},
computed: {
isCustomNum() {
return this.$store.state.currentProjectIsCustomNum;
},
},
methods: {
getTableData() {
getRelationshipCase(this.caseId, this.relationshipType, (data) => {
this.data = data;
});
},
openRelevance() {
this.$refs.testCaseRelevance.open();
},
handleDelete(item) {
deleteRelationshipEdge(item.sourceId, item.targetId, () => {
this.getTableData();
this.$success(this.$t('commons.delete_success'));
});
}
}
}
</script>
<style scoped>
.add-btn {
margin-left: 20px;
}
.el-main:nth-child(2) {
margin-top: 20px;
}
</style>

View File

@ -50,6 +50,7 @@ import {buildTree} from "../../api/definition/model/NodeTree";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
import {getCurrentProjectID} from "@/common/js/utils";
import ModuleTrashButton from "@/business/components/api/definition/components/module/ModuleTrashButton";
import {getTestCaseNodes} from "@/network/testCase";
export default {
name: "TestCaseNodeTree",
@ -137,8 +138,8 @@ export default {
},
list() {
if (this.projectId) {
this.result = this.$get("/case/node/list/" + this.projectId, response => {
this.treeNodes = response.data;
this.result = getTestCaseNodes(this.projectId, data => {
this.treeNodes = data;
this.treeNodes.forEach(node => {
buildTree(node, {path: ''});
});

View File

@ -35,7 +35,6 @@
import NodeTree from "../../common/NodeTree";
import TestPlanTestCaseList from "./comonents/functional/FunctionalTestCaseList";
import TestCaseRelevance from "./comonents/functional/TestCaseFunctionalRelevance";
import SelectMenu from "../../common/SelectMenu";
import MsContainer from "../../../common/components/MsContainer";
import MsAsideContainer from "../../../common/components/MsAsideContainer";
@ -55,7 +54,7 @@ export default {
TestPlanFunctional,
MsTestPlanHeaderBar,
MsMainContainer,
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, TestCaseRelevance, SelectMenu, TestPlanLoad
MsAsideContainer, MsContainer, NodeTree, TestPlanTestCaseList, SelectMenu, TestPlanLoad
},
data() {
return {

View File

@ -84,7 +84,6 @@
<script>
import NodeTree from "../../../../common/NodeTree";
import TestCaseRelevance from "../functional/TestCaseFunctionalRelevance";
import MsTestPlanCommonComponent from "../base/TestPlanCommonComponent";
import TestPlanApiCaseList from "./TestPlanApiCaseList";
import TestCaseApiRelevance from "./TestCaseApiRelevance";
@ -105,7 +104,6 @@
TestCaseApiRelevance,
TestPlanApiCaseList,
MsTestPlanCommonComponent,
TestCaseRelevance,
NodeTree,
},
data() {

View File

@ -4,6 +4,7 @@
<template v-slot:aside>
<select-menu
:data="projects"
v-if="multipleProject"
width="160px"
:current-data="currentProject"
:title="$t('test_track.switch_project')"
@ -73,6 +74,10 @@
default() {
return false;
}
},
multipleProject: {
type: Boolean,
default: true
}
},
watch: {

View File

@ -3,8 +3,8 @@
<test-case-relevance-base
@setProject="setProject"
@save="saveCaseRelevance"
:plan-id="planId"
:flag="true"
:flag="isTestPlan"
:multiple-project="multipleProject"
:is-saving="isSaving"
ref="baseRelevance">
@ -17,7 +17,7 @@
ref="nodeTree"/>
</template>
<ms-table-header :condition.sync="page.condition" @search="search" title="" :show-create="false"/>
<ms-table-header :condition.sync="page.condition" @search="getTestCases" title="" :show-create="false"/>
<ms-table
v-loading="page.result.loading"
@ -26,8 +26,8 @@
:total="page.total"
:page-size.sync="page.pageSize"
:screen-height="null"
@handlePageChange="search"
@refresh="search"
@handlePageChange="getTestCases"
@refresh="getTestCases"
ref="table">
<ms-table-column
@ -83,7 +83,7 @@
</ms-table>
<ms-table-pagination :change="search" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize" :total="page.total"/>
<ms-table-pagination :change="getTestCases" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize" :total="page.total"/>
</test-case-relevance-base>
</template>
@ -97,16 +97,13 @@ import MsTableSearchBar from "../../../../../common/components/MsTableSearchBar"
import MsTableAdvSearchBar from "../../../../../common/components/search/MsTableAdvSearchBar";
import MsTableHeader from "../../../../../common/components/MsTableHeader";
import TestCaseRelevanceBase from "../base/TestCaseRelevanceBase";
import {buildPagePath, getPageDate, getPageInfo} from "@/common/js/tableUtils";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag";
import {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
name: "TestCaseFunctionalRelevance",
name: "FunctionalRelevance",
components: {
MsTag,
MsTablePagination,
@ -131,9 +128,6 @@ export default {
projectId: '',
projectName: '',
projects: [],
page: getPageInfo({
components: TEST_PLAN_RELEVANCE_FUNC_CONFIGS
}),
customNum: false,
priorityFilters: [
{text: 'P0', value: 'P0'},
@ -144,21 +138,34 @@ export default {
};
},
props: {
planId: {
type: String
page: {
type: Object
},
isTestPlan: {
type: Boolean
},
getTableData: {
type: Function
},
getNodeTree: {
type: Function
},
save: {
type: Function
},
multipleProject: {
type: Boolean,
default: true
}
},
watch: {
planId() {
this.page.condition.planId = this.planId;
},
selectNodeIds() {
this.search();
this.getTestCases();
},
projectId() {
this.page.condition.projectId = this.projectId;
this.getProjectNode();
this.search();
this.getTestCases();
this.getProject();
}
},
@ -184,68 +191,30 @@ export default {
}
})
},
saveCaseRelevance(item) {
this.isSaving = true;
let param = {};
param.planId = this.planId;
param.ids = this.$refs.table.selectIds;
param.request = this.page.condition;
param.checked = item
this.result = this.$post('/test/plan/relevance', param, () => {
this.isSaving = false;
this.$success(this.$t('commons.save_success'));
this.$refs.baseRelevance.close();
this.$emit('refresh');
},(error) => {
this.isSaving = false;
});
},
search() {
this.getTestCases();
},
getTestCases() {
let condition = this.page.condition;
if (this.planId) {
condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
condition.nodeIds = this.selectNodeIds;
} else {
condition.nodeIds = [];
}
condition.projectId = this.projectId;
if (this.projectId) {
condition.projectId = this.projectId;
this.page.result = this.$post(buildPagePath('/test/case/relate', this.page), condition, response => {
getPageDate(response, this.page);
let data = this.page.data;
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
if (this.$refs.table) {
this.$refs.table.clear();
}
});
this.getTableData();
}
},
saveCaseRelevance(item) {
this.isSaving = true;
let param = {};
param.ids = this.$refs.table.selectIds;
param.request = this.page.condition;
param.checked = item;
this.save(param, this);
},
nodeChange(node, nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.planId) {
let param = {
testPlanId: this.planId,
projectId: this.projectId
};
this.result = this.$post("/case/node/list/all/plan", param, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.selectNodeIds = [];
this.selectNodeNames = [];
@ -259,11 +228,7 @@ export default {
if (projectId) {
this.projectId = projectId;
}
this.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
{testPlanId: this.planId, projectId: this.projectId}, response => {
this.treeNodes = response.data;
});
this.selectNodeIds = [];
this.getNodeTree(this);
}
}
}

View File

@ -36,7 +36,7 @@
</ms-tab-button>
</template>
<test-case-functional-relevance
<test-plan-functional-relevance
@refresh="refresh"
:plan-id="planId"
ref="testCaseRelevance"/>
@ -46,23 +46,22 @@
<script>
import NodeTree from "../../../../common/NodeTree";
import TestCaseRelevance from "./TestCaseFunctionalRelevance";
import TestCaseFunctionalRelevance from "./TestCaseFunctionalRelevance";
import MsTestPlanCommonComponent from "../base/TestPlanCommonComponent";
import FunctionalTestCaseList from "./FunctionalTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder";
import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanFunctionalRelevance
from "@/business/components/track/plan/view/comonents/functional/TestPlanFunctionalRelevance";
export default {
name: "TestPlanFunctional",
components: {
TestPlanFunctionalRelevance,
TestPlanMinder,
MsTabButton,
FunctionalTestCaseList,
TestCaseFunctionalRelevance,
MsTestPlanCommonComponent,
TestCaseRelevance,
NodeTree,
},
data() {

View File

@ -0,0 +1,88 @@
<template>
<functional-relevance
:page="page"
:get-table-data="getTestCases"
:get-node-tree="getTreeNodes"
:is-test-plan="true"
:save="saveCaseRelevance"
ref="functionalRelevance">
</functional-relevance>
</template>
<script>
import {buildPagePath, getPageDate, getPageInfo} from "@/common/js/tableUtils";
import {TEST_PLAN_RELEVANCE_FUNC_CONFIGS} from "@/business/components/common/components/search/search-components";
import FunctionalRelevance from "@/business/components/track/plan/view/comonents/functional/FunctionalRelevance";
export default {
name: "TestPlanFunctionalRelevance",
components: {
FunctionalRelevance,
},
data() {
return {
openType: 'relevance',
result: {},
page: getPageInfo({
components: TEST_PLAN_RELEVANCE_FUNC_CONFIGS
}),
};
},
props: {
planId: {
type: String
}
},
watch: {
planId() {
this.page.condition.planId = this.planId;
},
},
methods: {
open() {
if (this.$refs.functionalRelevance) {
this.$refs.functionalRelevance.open();
}
},
saveCaseRelevance(param, vueObj) {
param.planId = this.planId;
vueObj.result = this.$post('/test/plan/relevance', param, () => {
vueObj.isSaving = false;
this.$success(this.$t('commons.save_success'));
vueObj.$refs.baseRelevance.close();
this.$emit('refresh');
},(error) => {
vueObj.isSaving = false;
});
},
search() {
this.getTestCases();
},
getTestCases() {
let condition = this.page.condition;
if (this.planId) {
condition.planId = this.planId;
}
this.page.result = this.$post(buildPagePath('/test/case/relate', this.page), condition, response => {
getPageDate(response, this.page);
let data = this.page.data;
data.forEach(item => {
item.checked = false;
item.tags = JSON.parse(item.tags);
});
});
},
getTreeNodes(vueObj) {
vueObj.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
{testPlanId: this.planId, projectId: vueObj.projectId}, response => {
vueObj.treeNodes = response.data;
});
vueObj.selectNodeIds = [];
}
}
}
</script>
<style scoped>
</style>

View File

@ -83,7 +83,6 @@ import MsTestPlanApiScenarioList from "@/business/components/track/plan/view/com
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import ApiCaseSimpleList from "@/business/components/api/definition/components/list/ApiCaseSimpleList";
import TestPlanApiCaseList from "@/business/components/track/plan/view/comonents/api/TestPlanApiCaseList";
import TestCaseRelevance from "@/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance";
import NodeTree from "@/business/components/track/common/NodeTree";
import MsApiModule from "../../../../api/definition/components/module/ApiModule"
import TestReviewRelevanceApi from "@/business/components/track/review/view/components/TestReviewRelevanceApi";
@ -100,7 +99,6 @@ export default {
ApiCaseSimpleList,
TestPlanApiCaseList,
MsTestPlanCommonComponent,
TestCaseRelevance,
NodeTree,
MsApiModule,
},

View File

@ -0,0 +1,6 @@
import {baseGet} from "@/network/base-network";
export function deleteRelationshipEdge(sourceId, targetId, callback) {
return baseGet('/relationship/edge/delete/' + sourceId + '/' + targetId, callback);
}

View File

@ -63,3 +63,11 @@ export function editTestReviewTestCaseOrder(request, callback) {
return basePost('/test/review/case/edit/order', request, callback);
}
export function getTestCaseNodes(projectId, callback) {
return baseGet('/case/node/list/' + projectId, callback);
}
export function getRelationshipCase(id, relationshipType, callback) {
return baseGet('/test/case/relationship/case/' + id + '/' + relationshipType, callback);
}

View File

@ -26,7 +26,9 @@ const state = {
selectStep: {},
currentApiCase: {},
pluginFiles: [],
isTestCaseMinderChanged: false
isTestCaseMinderChanged: false,
// 当前项目是否勾选自定义ID
currentProjectIsCustomNum: false
}
const store = new Vuex.Store({

View File

@ -16,6 +16,7 @@ const mutations = {
setTestReviewModuleOptions: (state, value) => state.testReviewModuleOptions = value,
setTestPlanViewSelectNode: (state, value) => state.testPlanViewSelectNode = value,
setIsTestCaseMinderChanged: (state, value) => state.isTestCaseMinderChanged = value,
setCurrentProjectIsCustomNum: (state, value) => state.currentProjectIsCustomNum = value,
}
export default mutations;