feat: 新增issue-follow

This commit is contained in:
guoyuqi 2021-11-05 16:07:11 +08:00 committed by 刘瑞斌
parent 5c79c49b84
commit 9f474841c7
7 changed files with 534 additions and 6 deletions

View File

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

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class IssueFollowExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public IssueFollowExample() {
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 andIssueIdIsNull() {
addCriterion("issue_id is null");
return (Criteria) this;
}
public Criteria andIssueIdIsNotNull() {
addCriterion("issue_id is not null");
return (Criteria) this;
}
public Criteria andIssueIdEqualTo(String value) {
addCriterion("issue_id =", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdNotEqualTo(String value) {
addCriterion("issue_id <>", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdGreaterThan(String value) {
addCriterion("issue_id >", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdGreaterThanOrEqualTo(String value) {
addCriterion("issue_id >=", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdLessThan(String value) {
addCriterion("issue_id <", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdLessThanOrEqualTo(String value) {
addCriterion("issue_id <=", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdLike(String value) {
addCriterion("issue_id like", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdNotLike(String value) {
addCriterion("issue_id not like", value, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdIn(List<String> values) {
addCriterion("issue_id in", values, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdNotIn(List<String> values) {
addCriterion("issue_id not in", values, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdBetween(String value1, String value2) {
addCriterion("issue_id between", value1, value2, "issueId");
return (Criteria) this;
}
public Criteria andIssueIdNotBetween(String value1, String value2) {
addCriterion("issue_id not between", value1, value2, "issueId");
return (Criteria) this;
}
public Criteria andFollowIdIsNull() {
addCriterion("follow_id is null");
return (Criteria) this;
}
public Criteria andFollowIdIsNotNull() {
addCriterion("follow_id is not null");
return (Criteria) this;
}
public Criteria andFollowIdEqualTo(String value) {
addCriterion("follow_id =", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotEqualTo(String value) {
addCriterion("follow_id <>", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThan(String value) {
addCriterion("follow_id >", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdGreaterThanOrEqualTo(String value) {
addCriterion("follow_id >=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThan(String value) {
addCriterion("follow_id <", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLessThanOrEqualTo(String value) {
addCriterion("follow_id <=", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdLike(String value) {
addCriterion("follow_id like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotLike(String value) {
addCriterion("follow_id not like", value, "followId");
return (Criteria) this;
}
public Criteria andFollowIdIn(List<String> values) {
addCriterion("follow_id in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotIn(List<String> values) {
addCriterion("follow_id not in", values, "followId");
return (Criteria) this;
}
public Criteria andFollowIdBetween(String value1, String value2) {
addCriterion("follow_id between", value1, value2, "followId");
return (Criteria) this;
}
public Criteria andFollowIdNotBetween(String value1, String value2) {
addCriterion("follow_id not between", value1, value2, "followId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

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

View File

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

View File

@ -71,16 +71,16 @@
<!--<table tableName="test_plan"/>-->
<!--<table tableName="api_scenario_report"/>-->
<!--<table tableName="test_case_review"/>-->
<table tableName="test_case_follow"/>
<table tableName="issue_follow"/>
<!--<table tableName="test_case_review_api_case"/>
<table tableName="test_case_review_load"/>
<table tableName="test_case_review_scenario"/>
<table tableName="test_plan"/>
<table tableName="test_case_test"/>-->
<!-- <table tableName="api_test_environment"></table>-->
<table tableName="test_case">
<!-- <table tableName="test_case">
<ignoreColumn column="follow_people"/>
</table>
</table>-->
<!-- <table tableName="custom_field"></table>-->
<!-- <table tableName="test_case"></table>-->
<!-- <table tableName="test_case"></table>-->

View File

@ -7,7 +7,7 @@
<div class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px " @click="saveFollow" v-if="showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="showFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">{{$t('operating_log.change_history')}}</el-link>
<ms-table-button v-if="this.path!='/test/case/add'"

View File

@ -4,7 +4,9 @@
<el-form :model="form" :rules="rules" label-position="right" label-width="80px" ref="form">
<el-form-item :label="$t('commons.title')" prop="title">
<el-input v-model="form.title" autocomplete="off"></el-input>
<el-input v-model="form.title" autocomplete="off" class="top-input-class"></el-input>
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-top: 2px; margin-left: 15px;cursor: pointer" @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-top: 2px; margin-left: 15px; cursor: pointer" @click="saveFollow" v-if="showFollow"/>
</el-form-item>
<!-- 自定义字段 -->
@ -99,6 +101,7 @@ export default {
result: {},
relateFields: [],
isFormAlive: true,
showFollow:false,
formLabelWidth: "150px",
issueTemplate: {},
customFieldForm: {},
@ -278,12 +281,22 @@ export default {
});
}
},
saveFollow(){
if(this.showFollow){
this.showFollow = false;
}else {
this.showFollow = true;
}
}
}
};
</script>
<style scoped>
.top-input-class{
width: 95%;
}
.filed-list {
margin-top: 30px;