fix(高级查询): 修复部分高级查询报错的bug

This commit is contained in:
q4speed 2020-07-23 10:20:40 +08:00
parent 78ccfcd99b
commit b316344788
4 changed files with 24 additions and 37 deletions

View File

@ -137,20 +137,15 @@
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
select test_case.* from test_case
<where>
<choose>
<!--高级-->
<when test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
</include>
</when>
<!--普通-->
<otherwise>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
</otherwise>
</choose>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">

View File

@ -1,9 +1,8 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.Workspace;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;

View File

@ -46,7 +46,7 @@
</sql>
<sql id="combine">
<if test="${condition}.name != null">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and test_case.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
@ -119,20 +119,15 @@
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
<where>
<choose>
<!--高级-->
<when test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
</include>
</when>
<!--普通-->
<otherwise>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
</otherwise>
</choose>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
</include>
</if>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
</if>

View File

@ -266,19 +266,17 @@
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
},
methods: {
initTableData(combine) {
// combine
let condition = combine ? {combine: combine} : this.condition;
initTableData() {
if (this.planId) {
// param.planId = this.planId;
condition.planId = this.planId;
this.condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
condition.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
if (this.planId) {
this.result = this.$post(this.buildPagePath('/test/plan/case/list'), condition, response => {
this.result = this.$post(this.buildPagePath('/test/plan/case/list'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;