feat: azure 支持根据父workItem过滤需求

This commit is contained in:
chenjianxing 2021-11-05 14:35:37 +08:00 committed by jianxing
parent a570d90d6b
commit 0df85b25dc
9 changed files with 159 additions and 23 deletions

View File

@ -43,5 +43,7 @@ public class Project implements Serializable {
private Boolean isMockTcpOpen;
private String azureFilterId;
private static final long serialVersionUID = 1L;
}

View File

@ -1363,6 +1363,76 @@ public class ProjectExample {
addCriterion("is_mock_tcp_open not between", value1, value2, "isMockTcpOpen");
return (Criteria) this;
}
public Criteria andAzureFilterIdIsNull() {
addCriterion("azure_filter_id is null");
return (Criteria) this;
}
public Criteria andAzureFilterIdIsNotNull() {
addCriterion("azure_filter_id is not null");
return (Criteria) this;
}
public Criteria andAzureFilterIdEqualTo(String value) {
addCriterion("azure_filter_id =", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdNotEqualTo(String value) {
addCriterion("azure_filter_id <>", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdGreaterThan(String value) {
addCriterion("azure_filter_id >", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdGreaterThanOrEqualTo(String value) {
addCriterion("azure_filter_id >=", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdLessThan(String value) {
addCriterion("azure_filter_id <", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdLessThanOrEqualTo(String value) {
addCriterion("azure_filter_id <=", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdLike(String value) {
addCriterion("azure_filter_id like", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdNotLike(String value) {
addCriterion("azure_filter_id not like", value, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdIn(List<String> values) {
addCriterion("azure_filter_id in", values, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdNotIn(List<String> values) {
addCriterion("azure_filter_id not in", values, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdBetween(String value1, String value2) {
addCriterion("azure_filter_id between", value1, value2, "azureFilterId");
return (Criteria) this;
}
public Criteria andAzureFilterIdNotBetween(String value1, String value2) {
addCriterion("azure_filter_id not between", value1, value2, "azureFilterId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -21,6 +21,7 @@
<result column="system_id" jdbcType="VARCHAR" property="systemId" />
<result column="mock_tcp_port" jdbcType="INTEGER" property="mockTcpPort" />
<result column="is_mock_tcp_open" jdbcType="BIT" property="isMockTcpOpen" />
<result column="azure_filter_id" jdbcType="VARCHAR" property="azureFilterId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -83,7 +84,7 @@
<sql id="Base_Column_List">
id, workspace_id, `name`, description, create_time, update_time, tapd_id, jira_key,
zentao_id, azure_devops_id, `repeatable`, case_template_id, issue_template_id, custom_num,
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open
scenario_custom_num, create_user, system_id, mock_tcp_port, is_mock_tcp_open, azure_filter_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultMap="BaseResultMap">
select
@ -122,14 +123,14 @@
azure_devops_id, `repeatable`, case_template_id,
issue_template_id, custom_num, scenario_custom_num,
create_user, system_id, mock_tcp_port,
is_mock_tcp_open)
is_mock_tcp_open, azure_filter_id)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{tapdId,jdbcType=VARCHAR}, #{jiraKey,jdbcType=VARCHAR}, #{zentaoId,jdbcType=VARCHAR},
#{azureDevopsId,jdbcType=VARCHAR}, #{repeatable,jdbcType=BIT}, #{caseTemplateId,jdbcType=VARCHAR},
#{issueTemplateId,jdbcType=VARCHAR}, #{customNum,jdbcType=BIT}, #{scenarioCustomNum,jdbcType=BIT},
#{createUser,jdbcType=VARCHAR}, #{systemId,jdbcType=VARCHAR}, #{mockTcpPort,jdbcType=INTEGER},
#{isMockTcpOpen,jdbcType=BIT})
#{isMockTcpOpen,jdbcType=BIT}, #{azureFilterId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Project">
insert into project
@ -191,6 +192,9 @@
<if test="isMockTcpOpen != null">
is_mock_tcp_open,
</if>
<if test="azureFilterId != null">
azure_filter_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -250,6 +254,9 @@
<if test="isMockTcpOpen != null">
#{isMockTcpOpen,jdbcType=BIT},
</if>
<if test="azureFilterId != null">
#{azureFilterId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ProjectExample" resultType="java.lang.Long">
@ -318,6 +325,9 @@
<if test="record.isMockTcpOpen != null">
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
</if>
<if test="record.azureFilterId != null">
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -343,7 +353,8 @@
create_user = #{record.createUser,jdbcType=VARCHAR},
system_id = #{record.systemId,jdbcType=VARCHAR},
mock_tcp_port = #{record.mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT}
is_mock_tcp_open = #{record.isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{record.azureFilterId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -405,6 +416,9 @@
<if test="isMockTcpOpen != null">
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
</if>
<if test="azureFilterId != null">
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -427,7 +441,8 @@
create_user = #{createUser,jdbcType=VARCHAR},
system_id = #{systemId,jdbcType=VARCHAR},
mock_tcp_port = #{mockTcpPort,jdbcType=INTEGER},
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT}
is_mock_tcp_open = #{isMockTcpOpen,jdbcType=BIT},
azure_filter_id = #{azureFilterId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -48,6 +48,7 @@
p.azure_devops_id,
p.repeatable,
p.custom_num,
p.azure_filter_id,
user.name AS createUserName,
p.mock_tcp_port AS mockTcpPort,
p.is_mock_tcp_open AS isMockTcpOpen,

View File

@ -3,10 +3,13 @@ package io.metersphere.track.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class DemandDTO {
private String id;
private String name;
private String platform;
protected String id;
protected String name;
protected String platform;
protected List<? extends DemandDTO> children;
}

@ -1 +1 @@
Subproject commit 268ba4531c398642aa967b66103b118377a05ebe
Subproject commit bc3b1aac251a5520e26b12ae8df0fafbf5f43cff

View File

@ -9,3 +9,8 @@ insert into user_group_permission (id, group_id, permission_id, module_id)
values (UUID(), 'ws_admin', 'WORKSPACE_PROJECT_MANAGER:READ+UPLOAD_JAR', 'WORKSPACE_PROJECT_MANAGER');
insert into user_group_permission (id, group_id, permission_id, module_id)
values (UUID(), 'ws_member', 'WORKSPACE_PROJECT_MANAGER:READ+UPLOAD_JAR', 'WORKSPACE_PROJECT_MANAGER');
<<<<<<< HEAD
=======
ALTER TABLE project ADD COLUMN azure_filter_id varchar(50) NULL COMMENT 'azure 过滤需求的 parent workItem ID';
>>>>>>> 92dace863... feat: azure workItem过滤需求

View File

@ -142,6 +142,10 @@
<el-form-item :label-width="labelWidth" :label="$t('project.azureDevops_id')" v-if="azuredevops">
<el-input v-model="form.azureDevopsId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="'AzureDevops过滤ID'" v-if="azuredevops">
<el-input v-model="form.azureFilterId" autocomplete="off"/>
<ms-instructions-icon content="非必填项,用例关联需求时,可以只筛选出,所填的 workItem 下的选项" effect="light"/>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.repeatable')" prop="repeatable">
<el-switch v-model="form.repeatable"></el-switch>
</el-form-item>

View File

@ -13,15 +13,17 @@
<el-col :span="7">
<el-form-item :label="$t('test_track.related_requirements')" :label-width="labelWidth"
prop="demandId">
<el-select filterable :disabled="readOnly" v-model="form.demandId" @visible-change="visibleChange"
:placeholder="$t('test_track.please_related_requirements')" class="ms-case-input">
<el-option
v-for="item in demandOptions"
:key="item.id"
:label="item.platform + ': '+item.name"
:value="item.id">
</el-option>
</el-select>
<!-- <el-select filterable :disabled="readOnly" v-model="form.demandId" @visible-change="visibleChange"-->
<!-- :placeholder="$t('test_track.please_related_requirements')" class="ms-case-input">-->
<!-- <el-option-->
<!-- v-for="item in demandOptions"-->
<!-- :key="item.id"-->
<!-- :label="item.platform + ': '+item.name"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<el-cascader v-model="demandValue" :show-all-levels="false" :options="demandOptions" clearable/>
</el-form-item>
</el-col>
<el-col :span="7">
@ -106,6 +108,7 @@ export default {
tableData: [],
demandOptions: [],
relationshipCount: 0,
demandValue: [],
//sysList:this.sysList,//
props: {
multiple: true,
@ -135,6 +138,13 @@ export default {
getRelationshipCountCase(this.caseId, (data) => {
this.relationshipCount = data;
});
},
demandValue() {
if (this.demandValue.length > 0) {
this.form.demandId = this.demandValue[this.demandValue.length - 1];
} else {
this.form.demandId = null;
}
}
},
methods: {
@ -261,16 +271,42 @@ export default {
if (this.demandOptions.length === 0) {
this.result = {loading: true};
this.$get("demand/list/" + this.projectId).then(response => {
this.demandOptions = response.data.data;
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'});
this.demandOptions = [];
if (response.data.data && response.data.data.length > 0) {
this.buildDemandCascaderOptions(response.data.data, this.demandOptions, []);
}
this.demandOptions.unshift({value: 'other', label: 'Other: ' + this.$t('test_track.case.other'), platform: 'Other'});
if (this.form.demandId === 'other') {
this.demandValue = ['other'];
}
this.result = {loading: false};
}).catch(() => {
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'});
this.demandOptions.unshift({value: 'other', label: 'Other: ' + this.$t('test_track.case.other'), platform: 'Other'});
if (this.form.demandId === 'other') {
this.demandValue = ['other'];
}
this.result = {loading: false};
});
}
},
buildDemandCascaderOptions(data, options, pathArray) {
data.forEach(item => {
let option = {
label: item.platform + ': ' + item.name,
value: item.id
}
options.push(option);
pathArray.push(item.id);
if (item.id === this.form.demandId) {
this.demandValue = [...pathArray]; //
}
if (item.children && item.children.length > 0) {
option.children = [];
this.buildDemandCascaderOptions(item.children, option.children, pathArray);
}
pathArray.pop();
});
}
}
};
</script>
@ -291,6 +327,6 @@ export default {
.el-cascader >>> .el-input {
cursor: pointer;
width: 500px;
width: 250px;
}
</style>