Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-08-12 10:58:49 +08:00
commit 9dca87376e
17 changed files with 1196 additions and 43 deletions

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Project implements Serializable {
@ -18,5 +17,9 @@ public class Project implements Serializable {
private Long updateTime;
private String tapdId;
private String jiraKey;
private static final long serialVersionUID = 1L;
}

View File

@ -245,72 +245,72 @@ public class ProjectExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
@ -503,6 +503,146 @@ public class ProjectExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andTapdIdIsNull() {
addCriterion("tapd_id is null");
return (Criteria) this;
}
public Criteria andTapdIdIsNotNull() {
addCriterion("tapd_id is not null");
return (Criteria) this;
}
public Criteria andTapdIdEqualTo(String value) {
addCriterion("tapd_id =", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdNotEqualTo(String value) {
addCriterion("tapd_id <>", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdGreaterThan(String value) {
addCriterion("tapd_id >", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdGreaterThanOrEqualTo(String value) {
addCriterion("tapd_id >=", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdLessThan(String value) {
addCriterion("tapd_id <", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdLessThanOrEqualTo(String value) {
addCriterion("tapd_id <=", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdLike(String value) {
addCriterion("tapd_id like", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdNotLike(String value) {
addCriterion("tapd_id not like", value, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdIn(List<String> values) {
addCriterion("tapd_id in", values, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdNotIn(List<String> values) {
addCriterion("tapd_id not in", values, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdBetween(String value1, String value2) {
addCriterion("tapd_id between", value1, value2, "tapdId");
return (Criteria) this;
}
public Criteria andTapdIdNotBetween(String value1, String value2) {
addCriterion("tapd_id not between", value1, value2, "tapdId");
return (Criteria) this;
}
public Criteria andJiraKeyIsNull() {
addCriterion("jira_key is null");
return (Criteria) this;
}
public Criteria andJiraKeyIsNotNull() {
addCriterion("jira_key is not null");
return (Criteria) this;
}
public Criteria andJiraKeyEqualTo(String value) {
addCriterion("jira_key =", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyNotEqualTo(String value) {
addCriterion("jira_key <>", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyGreaterThan(String value) {
addCriterion("jira_key >", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyGreaterThanOrEqualTo(String value) {
addCriterion("jira_key >=", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyLessThan(String value) {
addCriterion("jira_key <", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyLessThanOrEqualTo(String value) {
addCriterion("jira_key <=", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyLike(String value) {
addCriterion("jira_key like", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyNotLike(String value) {
addCriterion("jira_key not like", value, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyIn(List<String> values) {
addCriterion("jira_key in", values, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyNotIn(List<String> values) {
addCriterion("jira_key not in", values, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyBetween(String value1, String value2) {
addCriterion("jira_key between", value1, value2, "jiraKey");
return (Criteria) this;
}
public Criteria andJiraKeyNotBetween(String value1, String value2) {
addCriterion("jira_key not between", value1, value2, "jiraKey");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ServiceIntegration implements Serializable {
private String id;
private String organizationId;
private String platform;
private String configuration;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,410 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ServiceIntegrationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ServiceIntegrationExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andPlatformIsNull() {
addCriterion("platform is null");
return (Criteria) this;
}
public Criteria andPlatformIsNotNull() {
addCriterion("platform is not null");
return (Criteria) this;
}
public Criteria andPlatformEqualTo(String value) {
addCriterion("platform =", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotEqualTo(String value) {
addCriterion("platform <>", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformGreaterThan(String value) {
addCriterion("platform >", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformGreaterThanOrEqualTo(String value) {
addCriterion("platform >=", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLessThan(String value) {
addCriterion("platform <", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLessThanOrEqualTo(String value) {
addCriterion("platform <=", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLike(String value) {
addCriterion("platform like", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotLike(String value) {
addCriterion("platform not like", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformIn(List<String> values) {
addCriterion("platform in", values, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotIn(List<String> values) {
addCriterion("platform not in", values, "platform");
return (Criteria) this;
}
public Criteria andPlatformBetween(String value1, String value2) {
addCriterion("platform between", value1, value2, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotBetween(String value1, String value2) {
addCriterion("platform not between", value1, value2, "platform");
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

@ -8,6 +8,8 @@
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="tapd_id" jdbcType="VARCHAR" property="tapdId" />
<result column="jira_key" jdbcType="VARCHAR" property="jiraKey" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -68,7 +70,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, workspace_id, name, description, create_time, update_time
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap">
select
@ -101,12 +103,12 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Project">
insert into project (id, workspace_id, name,
description, create_time, update_time
)
insert into project (id, workspace_id, `name`,
description, create_time, update_time,
tapd_id, jira_key)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
)
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project
@ -118,7 +120,7 @@
workspace_id,
</if>
<if test="name != null">
name,
`name`,
</if>
<if test="description != null">
description,
@ -129,6 +131,12 @@
<if test="updateTime != null">
update_time,
</if>
<if test="tapdId != null">
tapd_id,
</if>
<if test="jiraKey != null">
jira_key,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -149,6 +157,12 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="tapdId != null">
#{tapdId,jdbcType=VARCHAR},
</if>
<if test="jiraKey != null">
#{jiraKey,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultType="java.lang.Long">
@ -167,7 +181,7 @@
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
@ -178,6 +192,12 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.tapdId != null">
tapd_id = #{record.tapdId,jdbcType=VARCHAR},
</if>
<if test="record.jiraKey != null">
jira_key = #{record.jiraKey,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -187,10 +207,12 @@
update project
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update_time = #{record.updateTime,jdbcType=BIGINT},
tapd_id = #{record.tapdId,jdbcType=VARCHAR},
jira_key = #{record.jiraKey,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -202,7 +224,7 @@
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
@ -213,16 +235,24 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="tapdId != null">
tapd_id = #{tapdId,jdbcType=VARCHAR},
</if>
<if test="jiraKey != null">
jira_key = #{jiraKey,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Project">
update project
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
update_time = #{updateTime,jdbcType=BIGINT},
tapd_id = #{tapdId,jdbcType=VARCHAR},
jira_key = #{jiraKey,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,36 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ServiceIntegration;
import io.metersphere.base.domain.ServiceIntegrationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ServiceIntegrationMapper {
long countByExample(ServiceIntegrationExample example);
int deleteByExample(ServiceIntegrationExample example);
int deleteByPrimaryKey(String id);
int insert(ServiceIntegration record);
int insertSelective(ServiceIntegration record);
List<ServiceIntegration> selectByExampleWithBLOBs(ServiceIntegrationExample example);
List<ServiceIntegration> selectByExample(ServiceIntegrationExample example);
ServiceIntegration selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ServiceIntegration record, @Param("example") ServiceIntegrationExample example);
int updateByExampleWithBLOBs(@Param("record") ServiceIntegration record, @Param("example") ServiceIntegrationExample example);
int updateByExample(@Param("record") ServiceIntegration record, @Param("example") ServiceIntegrationExample example);
int updateByPrimaryKeySelective(ServiceIntegration record);
int updateByPrimaryKeyWithBLOBs(ServiceIntegration record);
int updateByPrimaryKey(ServiceIntegration record);
}

View File

@ -0,0 +1,234 @@
<?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.ServiceIntegrationMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ServiceIntegration">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ServiceIntegration">
<result column="configuration" jdbcType="LONGVARCHAR" property="configuration" />
</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">
id, organization_id, platform
</sql>
<sql id="Blob_Column_List">
configuration
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ServiceIntegrationExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from service_integration
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ServiceIntegrationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from service_integration
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from service_integration
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from service_integration
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ServiceIntegrationExample">
delete from service_integration
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ServiceIntegration">
insert into service_integration (id, organization_id, platform,
configuration)
values (#{id,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
#{configuration,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ServiceIntegration">
insert into service_integration
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="platform != null">
platform,
</if>
<if test="configuration != null">
configuration,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="platform != null">
#{platform,jdbcType=VARCHAR},
</if>
<if test="configuration != null">
#{configuration,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ServiceIntegrationExample" resultType="java.lang.Long">
select count(*) from service_integration
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update service_integration
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR},
</if>
<if test="record.configuration != null">
configuration = #{record.configuration,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update service_integration
set id = #{record.id,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
configuration = #{record.configuration,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update service_integration
set id = #{record.id,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
<set>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="platform != null">
platform = #{platform,jdbcType=VARCHAR},
</if>
<if test="configuration != null">
configuration = #{configuration,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
set organization_id = #{organizationId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR},
configuration = #{configuration,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ServiceIntegration">
update service_integration
set organization_id = #{organizationId,jdbcType=VARCHAR},
platform = #{platform,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -4,7 +4,7 @@
<select id="getProjectWithWorkspace" resultType="io.metersphere.dto.ProjectDTO">
select p.id, p.workspace_id, p.name, p.description, p.update_time,
p.create_time, w.id as workspaceId, w.name as workspaceName
p.create_time, w.id as workspaceId, w.name as workspaceName, p.tapd_id, p.jira_key
from project p
join workspace w on p.workspace_id = w.id
<where>

View File

@ -0,0 +1,5 @@
package io.metersphere.commons.constants;
public enum DedectManagePlatform {
Tapd, Jira
}

View File

@ -0,0 +1,38 @@
package io.metersphere.controller;
import io.metersphere.base.domain.ServiceIntegration;
import io.metersphere.controller.request.IntegrationRequest;
import io.metersphere.service.IntegrationService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RequestMapping("service/integration")
@RestController
public class ServiceIntegrationController {
@Resource
private IntegrationService integrationService;
@PostMapping("/save")
public ServiceIntegration save(@RequestBody ServiceIntegration service) {
return integrationService.save(service);
}
@PostMapping("/type")
public ServiceIntegration getByPlatform(@RequestBody IntegrationRequest request) {
return integrationService.get(request);
}
@PostMapping("/delete")
public void delete(@RequestBody IntegrationRequest request) {
integrationService.delete(request);
}
@GetMapping("/all/{orgId}")
public List<ServiceIntegration> getAll(@PathVariable String orgId) {
return integrationService.getAll(orgId);
}
}

View File

@ -0,0 +1,11 @@
package io.metersphere.controller.request;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class IntegrationRequest {
private String platform;
private String orgId;
}

View File

@ -14,5 +14,7 @@ public class ProjectDTO {
private String description;
private Long createTime;
private Long updateTime;
private String tapdId;
private String jiraKey;
}

View File

@ -0,0 +1,74 @@
package io.metersphere.service;
import io.metersphere.base.domain.ServiceIntegration;
import io.metersphere.base.domain.ServiceIntegrationExample;
import io.metersphere.base.mapper.ServiceIntegrationMapper;
import io.metersphere.controller.request.IntegrationRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Service
@Transactional(rollbackFor = Exception.class)
public class IntegrationService {
@Resource
private ServiceIntegrationMapper serviceIntegrationMapper;
public ServiceIntegration save(ServiceIntegration service) {
ServiceIntegrationExample example = new ServiceIntegrationExample();
example.createCriteria()
.andOrganizationIdEqualTo(service.getOrganizationId())
.andPlatformEqualTo(service.getPlatform());
List<ServiceIntegration> list = serviceIntegrationMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(list)) {
serviceIntegrationMapper.updateByExampleSelective(service, example);
return list.get(0);
} else {
service.setId(UUID.randomUUID().toString());
serviceIntegrationMapper.insertSelective(service);
return service;
}
}
public ServiceIntegration get(IntegrationRequest request) {
String platform = request.getPlatform();
String orgId = request.getOrgId();
ServiceIntegrationExample example = new ServiceIntegrationExample();
ServiceIntegrationExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(platform)) {
criteria.andPlatformEqualTo(platform);
}
if (StringUtils.isNotBlank(orgId)) {
criteria.andOrganizationIdEqualTo(orgId);
}
List<ServiceIntegration> list = serviceIntegrationMapper.selectByExampleWithBLOBs(example);
return CollectionUtils.isEmpty(list) ? new ServiceIntegration() : list.get(0);
}
public void delete(IntegrationRequest request) {
String platform = request.getPlatform();
String orgId = request.getOrgId();
ServiceIntegrationExample example = new ServiceIntegrationExample();
example.createCriteria()
.andOrganizationIdEqualTo(orgId)
.andPlatformEqualTo(platform);
serviceIntegrationMapper.deleteByExample(example);
}
public List<ServiceIntegration> getAll(String orgId) {
ServiceIntegrationExample example = new ServiceIntegrationExample();
example.createCriteria().andOrganizationIdEqualTo(orgId);
List<ServiceIntegration> list = serviceIntegrationMapper.selectByExample(example);
return CollectionUtils.isEmpty(list) ? new ArrayList<>() : list;
}
}

View File

@ -0,0 +1,11 @@
create table service_integration
(
id varchar(50) not null,
organization_id varchar(50) not null,
platform varchar(50) not null,
configuration text not null,
constraint service_integration_pk
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -0,0 +1,2 @@
alter table project add tapd_id varchar(50) null;
alter table project add jira_key varchar(50) null;

View File

@ -56,6 +56,12 @@
<el-form-item :label="$t('commons.description')" prop="description">
<el-input :autosize="{ minRows: 2, maxRows: 4}" type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item label="TAPD项目ID" v-if="tapd">
<el-input v-model="form.tapdId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="JIRA项目key" v-if="jira">
<el-input v-model="form.jiraKey" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<template v-slot:footer>
<div class="dialog-footer">
@ -86,10 +92,12 @@
import MsDeleteConfirm from "../common/components/MsDeleteConfirm";
import MsTableOperatorButton from "../common/components/MsTableOperatorButton";
import ApiEnvironmentConfig from "../api/test/components/ApiEnvironmentConfig";
import TemplateComponent from "../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
export default {
name: "MsProject",
components: {
TemplateComponent,
ApiEnvironmentConfig,
MsTableOperatorButton,
MsDeleteConfirm,
@ -103,6 +111,8 @@
title: this.$t('project.create'),
condition: {},
items: [],
tapd: false,
jira: false,
form: {},
currentPage: 1,
pageSize: 5,
@ -171,6 +181,18 @@
this.createVisible = true;
listenGoBack(this.handleClose);
this.form = Object.assign({}, row);
if (this.baseUrl === 'track') {
this.$get("/service/integration/all/" + getCurrentUser().lastOrganizationId, response => {
let data = response.data;
let platforms = data.map(d => d.platform);
if (platforms.indexOf("Tapd") !== -1) {
this.tapd = true;
}
if (platforms.indexOf("Jira") !== -1) {
this.jira = true;
}
});
}
},
submit(formName) {
this.$refs[formName].validate((valid) => {

View File

@ -1,8 +1,8 @@
<template>
<el-card class="header-title">
<div>
<div v-loading="result.loading">
<div>{{$t('organization.select_defect_platform')}}</div>
<el-radio-group v-model="platform" style="margin-top: 10px">
<el-radio-group v-model="platform" style="margin-top: 10px" @change="change">
<el-radio v-for="(item, index) in platforms" :key="index" :label="item.value" size="small">
{{item.name}}
</el-radio>
@ -11,21 +11,26 @@
<div style="width: 500px">
<div style="margin-top: 20px;margin-bottom: 10px">{{$t('organization.basic_auth_info')}}</div>
<el-form :model="form" ref="form" label-width="100px" size="small">
<el-form :model="form" ref="form" label-width="100px" size="small" :disabled="show" :rules="rules">
<el-form-item :label="$t('organization.api_account')" prop="account">
<el-input v-model="form.account" :placeholder="$t('organization.input_api_account')"/>
</el-form-item>
<el-form-item :label="$t('organization.api_password')" prop="password">
<el-input v-model="form.password" auto-complete="new-password" :placeholder="$t('organization.input_api_password')" show-password/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="submit('form')" style="width: 400px">
{{$t('commons.save')}}
</el-button>
<el-input v-model="form.password" auto-complete="new-password"
:placeholder="$t('organization.input_api_password')" show-password/>
</el-form-item>
</el-form>
</div>
<div style="margin-left: 100px">
<el-button v-if="showEdit" size="small" @click="edit">{{$t('commons.edit')}}</el-button>
<el-button type="primary" v-if="showSave" size="small" @click="save('form')">{{$t('commons.save')}}</el-button>
<el-button v-if="showCancel" size="small" @click="cancelEdit">取消编辑</el-button>
<el-button type="info" size="small" @click="cancelIntegration('form')" :disabled="!show">
取消集成
</el-button>
</div>
<div class="defect-tip">
<div>{{$t('organization.use_tip')}}</div>
<div>
@ -33,27 +38,36 @@
</div>
<div>
2. {{$t('organization.use_tip_two')}}
<router-link to="/track/project/all" style="margin-left: 5px">{{$t('organization.link_the_project_now')}}</router-link>
<router-link to="/track/project/all" style="margin-left: 5px">{{$t('organization.link_the_project_now')}}
</router-link>
</div>
</div>
</el-card>
</template>
<script>
import {getCurrentUser} from "../../../../common/js/utils";
export default {
name: "DefectManagement",
data() {
return {
form: {},
result: {},
platform: '',
orgId: '',
show: true,
showEdit: true,
showSave: false,
showCancel: false,
platforms: [
{
name: 'TAPD',
value: 'tapd',
value: 'Tapd',
},
{
name: 'JIRA',
value: 'jira',
value: 'Jira',
}
],
rules: {
@ -62,9 +76,113 @@
},
}
},
created() {
this.init(this.platform);
},
methods: {
submit(form) {
init(platform) {
let param = {};
param.platform = platform;
param.orgId = getCurrentUser().lastOrganizationId;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
this.platform = data.platform;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
} else {
this.clear();
}
})
},
edit() {
this.show = false;
this.showEdit = false;
this.showSave = true;
this.showCancel = true;
},
cancelEdit() {
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
this.show = true;
this.init(this.platform);
},
cancelIntegration() {
if (this.form.account && this.form.password && this.platform) {
this.$alert("确认取消集成 " + this.platform + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
this.result = this.$post("service/integration/delete", param, () => {
this.$success("操作成功");
this.init('');
});
}
}
});
} else {
this.$warning("未集成该平台!");
}
},
save(form) {
if (!this.platform) {
this.$warning("请选择集成的平台!");
return;
}
let param = {};
let auth = {
account: this.form.account,
password: this.form.password
};
param.organizationId = getCurrentUser().lastOrganizationId;
param.platform = this.platform;
param.configuration = JSON.stringify(auth);
this.$refs[form].validate(valid => {
if (valid) {
this.result = this.$post("service/integration/save", param, () => {
this.show = true;
this.showEdit = true;
this.showSave = false;
this.showCancel = false;
this.init(this.platform);
this.$success(this.$t('commons.save_success'));
});
} else {
return false;
}
})
},
change(platform) {
this.show = true;
this.showEdit = true;
this.showCancel = false;
this.showSave = false;
let param = {};
param.orgId = getCurrentUser().lastOrganizationId;
param.platform = platform;
this.result = this.$post("service/integration/type", param, response => {
let data = response.data;
if (data.configuration) {
let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password);
} else {
this.clear();
}
})
},
clear() {
this.$set(this.form, 'account', '');
this.$set(this.form, 'password', '');
this.$nextTick(() => {
this.$refs.form.clearValidate();
});
}
}
}