父子编排列表调整

This commit is contained in:
liangdaliang
2025-03-11 16:27:54 +08:00
parent 5d8cc54668
commit a1171c0a4a
4 changed files with 24 additions and 5 deletions

View File

@@ -1,10 +1,12 @@
package com.test.test.domain; package com.test.test.domain;
import com.test.common.annotation.Excel;
import com.test.common.core.domain.BaseEntity; import com.test.common.core.domain.BaseEntity;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import com.test.common.annotation.Excel;
import java.util.List;
/** /**
* 用例步骤对象 test_case_step * 用例步骤对象 test_case_step
@@ -132,4 +134,7 @@ public class TestCaseStep extends BaseEntity {
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
/** 循环或轮询的子步骤列表 */
private List<TestCaseStep> childrenList;
} }

View File

@@ -46,7 +46,19 @@ public class TestCaseStepServiceImpl implements ITestCaseStepService {
*/ */
@Override @Override
public List<TestCaseStep> selectTestCaseStepList(TestCaseStep testCaseStep) { public List<TestCaseStep> selectTestCaseStepList(TestCaseStep testCaseStep) {
return testCaseStepMapper.selectTestCaseStepList(testCaseStep); testCaseStep.setDelFlag("0");
List<TestCaseStep> caseStepParentList = testCaseStepMapper.selectTestCaseStepList(testCaseStep);
for (TestCaseStep testCaseStepParent : caseStepParentList) {
if (testCaseStepParent.getType() > 2) {
// 加载子步骤
TestCaseStep testCaseStepChild = new TestCaseStep();
testCaseStepChild.setDelFlag("0");
testCaseStepChild.setParentId(testCaseStepParent.getId());
List<TestCaseStep> caseStepChildrenList = testCaseStepMapper.selectTestCaseStepList(testCaseStepChild);
testCaseStepParent.setChildrenList(caseStepChildrenList);
}
}
return caseStepParentList;
} }
/** /**

View File

@@ -75,6 +75,7 @@
<include refid="selectTestCaseStepVo"/> <include refid="selectTestCaseStepVo"/>
<where> <where>
<if test="parentId != null ">and parent_id = #{parentId}</if> <if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="parentId == null ">and parent_id is null</if>
<if test="caseId != null ">and case_id = #{caseId}</if> <if test="caseId != null ">and case_id = #{caseId}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="stepNum != null ">and step_num = #{stepNum}</if> <if test="stepNum != null ">and step_num = #{stepNum}</if>
@@ -98,6 +99,7 @@
<if test="postScript != null and postScript != ''">and post_script = #{postScript}</if> <if test="postScript != null and postScript != ''">and post_script = #{postScript}</if>
<if test="assignment != null and assignment != ''">and assignment = #{assignment}</if> <if test="assignment != null and assignment != ''">and assignment = #{assignment}</if>
<if test="assertion != null and assertion != ''">and assertion = #{assertion}</if> <if test="assertion != null and assertion != ''">and assertion = #{assertion}</if>
<if test="delFlag != null">and del_flag = #{delFlag}</if>
</where> </where>
ORDER BY step_num ORDER BY step_num
</select> </select>

View File

@@ -17,15 +17,15 @@
<el-button size="mini" plain type="warning" icon="el-icon-rank" circle style="margin-right: 12px" class="drag-handle"/> <el-button size="mini" plain type="warning" icon="el-icon-rank" circle style="margin-right: 12px" class="drag-handle"/>
<el-tag effect="plain" style="width: 70px;text-align: center;margin-right: 12px;" class="drag-handle">{{ dict.type.step_type.findLast(t => t.value == item.type).label }}</el-tag> <el-tag effect="plain" style="width: 70px;text-align: center;margin-right: 12px;" class="drag-handle">{{ dict.type.step_type.findLast(t => t.value == item.type).label }}</el-tag>
<el-tag v-if="item.name" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ item.name }}</el-tag> <el-tag v-if="item.name" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ item.name }}</el-tag>
<el-tag v-if="item.datasourceId" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ datasourceList.findLast(t => t.id === item.datasourceId).name }}</el-tag> <el-tag v-if="item.datasourceId && item.type < 3" effect="plain" style="width: 240px;text-align: center;margin-right: 12px;" type="info" class="drag-handle">{{ datasourceList.findLast(t => t.id === item.datasourceId).name }}</el-tag>
<el-tag v-if="item.requestUrl" effect="plain" style="text-align: center;margin-right: 12px;" type="success" class="drag-handle">{{ item.requestUrl }}</el-tag> <el-tag v-if="item.requestUrl" effect="plain" style="text-align: center;margin-right: 12px;" type="success" class="drag-handle">{{ item.requestUrl }}</el-tag>
<el-tag effect="plain" style="text-align: center;margin-right: 12px;" class="drag-handle">{{ index + 1 }}</el-tag> <el-tag effect="plain" style="text-align: center;margin-right: 12px;" class="drag-handle">{{ index + 1 }}</el-tag>
</template> </template>
<el-button size="mini" type="text" @click="handleDel(index)" style="float: right">删除</el-button> <el-button size="mini" type="text" @click="handleDel(index)" style="float: right">删除</el-button>
<page1 v-if="item.type == 1" :form="item" :hosts="hosts"/> <page1 v-if="item.type == 1" :form="item" :hosts="hosts"/>
<page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList"/> <page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList"/>
<page3 v-if="item.type == 3" :form="item" :list="list" :hosts="hosts" :datasourceList="datasourceList"/> <page3 v-if="item.type == 3" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList"/>
<page4 v-if="item.type == 4" :form="item" :list="list" :hosts="hosts" :datasourceList="datasourceList"/> <page4 v-if="item.type == 4" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList"/>
</el-collapse-item> </el-collapse-item>
</draggable> </draggable>
</el-collapse> </el-collapse>