refactor: 修改方法名;调整条件筛选sql
This commit is contained in:
parent
9bd0b71662
commit
dd39904c5d
|
@ -16,7 +16,7 @@ public interface ExtTestCaseMapper {
|
||||||
|
|
||||||
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
List<TestCaseDTO> listByMethod(@Param("request") QueryTestCaseRequest request);
|
||||||
|
|
||||||
List<TestCaseDTO> listBytestCaseIds(@Param("request") TestCaseBatchRequest request);
|
List<TestCaseDTO> listByTestCaseIds(@Param("request") TestCaseBatchRequest request);
|
||||||
|
|
||||||
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
TestCase getMaxNumByProjectId(@Param("projectId") String projectId);
|
||||||
|
|
||||||
|
|
|
@ -128,10 +128,20 @@
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
and test_case.${key} in
|
<choose>
|
||||||
|
<when test="key=='priority'">
|
||||||
|
and test_case.priority in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and test_case.type in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
@ -214,7 +224,7 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="listBytestCaseIds" resultType="io.metersphere.track.dto.TestCaseDTO">
|
<select id="listByTestCaseIds" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||||
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
select test_case.*,api_test.name as apiName,load_test.name AS performName from test_case left join api_test on
|
||||||
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
test_case.test_id=api_test.id left join load_test on test_case.test_id=load_test.id
|
||||||
<where>
|
<where>
|
||||||
|
|
|
@ -95,7 +95,8 @@
|
||||||
</if>
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
<select id="list" resultMap="BaseResultMap"
|
||||||
|
parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
|
||||||
select test_plan.*, project.name as project_name
|
select test_plan.*, project.name as project_name
|
||||||
from test_plan
|
from test_plan
|
||||||
left join project on test_plan.project_id = project.id
|
left join project on test_plan.project_id = project.id
|
||||||
|
@ -126,10 +127,21 @@
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
and ${key} in
|
<choose>
|
||||||
|
|
||||||
|
<when test="key=='stage'">
|
||||||
|
and test_plan.stage in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and test_plan.status in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -157,10 +157,26 @@
|
||||||
<if test="request.filters != null and request.filters.size() > 0">
|
<if test="request.filters != null and request.filters.size() > 0">
|
||||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||||
<if test="values != null and values.size() > 0">
|
<if test="values != null and values.size() > 0">
|
||||||
and ${key} in
|
<choose>
|
||||||
|
<when test="key=='priority'">
|
||||||
|
and test_case.priority in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<when test="key=='type'">
|
||||||
|
and test_case.type in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and test_case.method in
|
||||||
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
|
#{value}
|
||||||
|
</foreach>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TestCaseController {
|
||||||
return testCaseService.listTestCase(request);
|
return testCaseService.listTestCase(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*项目下自动测试*/
|
|
||||||
@GetMapping("/list/method/{projectId}")
|
@GetMapping("/list/method/{projectId}")
|
||||||
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
|
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
|
||||||
QueryTestCaseRequest request = new QueryTestCaseRequest();
|
QueryTestCaseRequest request = new QueryTestCaseRequest();
|
||||||
|
|
|
@ -353,7 +353,7 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) {
|
private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) {
|
||||||
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listBytestCaseIds(request);
|
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listByTestCaseIds(request);
|
||||||
List<TestCaseExcelData> list = new ArrayList<>();
|
List<TestCaseExcelData> list = new ArrayList<>();
|
||||||
SessionUser user = SessionUtils.getUser();
|
SessionUser user = SessionUtils.getUser();
|
||||||
StringBuilder step = new StringBuilder("");
|
StringBuilder step = new StringBuilder("");
|
||||||
|
|
Loading…
Reference in New Issue