fix(高级查询): 修复部分高级查询报错的bug
This commit is contained in:
parent
78ccfcd99b
commit
b316344788
|
@ -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=")">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue