This commit is contained in:
fit2-zhao 2021-01-25 18:45:54 +08:00
commit cf013c1e84
5 changed files with 21 additions and 24 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.TestPlan;
import io.metersphere.track.dto.TestPlanDTO; import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.dto.TestPlanDTOWithMetric; import io.metersphere.track.dto.TestPlanDTOWithMetric;
import io.metersphere.track.request.testcase.QueryTestPlanRequest; import io.metersphere.track.request.testcase.QueryTestPlanRequest;
@ -32,4 +33,6 @@ public interface ExtTestPlanMapper {
String findScheduleCreateUserById(String testPlanId); String findScheduleCreateUserById(String testPlanId);
List<String> findIdByPerformanceReportId(String reportId); List<String> findIdByPerformanceReportId(String reportId);
List<TestPlan> listRecent(@Param("userId") String userId, @Param("projectId") String currentProjectId);
} }

View File

@ -240,5 +240,16 @@
WHERE reportData.performance_info like CONCAT('%', #{0},'%') WHERE reportData.performance_info like CONCAT('%', #{0},'%')
AND report.is_performance_executing = true; AND report.is_performance_executing = true;
</select> </select>
<select id="listRecent" resultType="io.metersphere.base.domain.TestPlan">
select distinct test_plan.*
from test_plan
<where>
<if test="projectId != null">
and test_plan.project_id = #{projectId}
</if>
and (test_plan.creator = #{userId} or test_plan.principal = #{userId})
</where>
order by test_plan.update_time desc
</select>
</mapper> </mapper>

View File

@ -66,9 +66,8 @@ public class TestPlanController {
@GetMapping("recent/{count}") @GetMapping("recent/{count}")
public List<TestPlan> recentTestPlans(@PathVariable int count) { public List<TestPlan> recentTestPlans(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
return testPlanService.recentTestPlans(currentWorkspaceId); return testPlanService.recentTestPlans();
} }
@PostMapping("/get/{testPlanId}") @PostMapping("/get/{testPlanId}")

View File

@ -467,26 +467,8 @@ public class TestPlanService {
} }
} }
public List<TestPlan> recentTestPlans(String currentWorkspaceId) { public List<TestPlan> recentTestPlans() {
if (StringUtils.isBlank(currentWorkspaceId)) { return extTestPlanMapper.listRecent(SessionUtils.getUserId(), SessionUtils.getCurrentProjectId());
return null;
}
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
TestPlanExample testPlanExample = new TestPlanExample();
TestPlanExample.Criteria criteria = testPlanExample.createCriteria();
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
List<TestPlan> testPlans = testPlanMapper.selectByExample(testPlanExample);
if (!CollectionUtils.isEmpty(testPlans)) {
List<String> testPlanIds = testPlans.stream().map(TestPlan::getId).collect(Collectors.toList());
TestPlanExample testPlanTestCaseExample = new TestPlanExample();
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId)
.andIdIn(testPlanIds)
.andPrincipalEqualTo(SessionUtils.getUserId());
testPlanTestCaseExample.setOrderByClause("update_time desc");
return testPlanMapper.selectByExample(testPlanTestCaseExample);
}
}
return new ArrayList<>();
} }
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) { public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {

View File

@ -3,12 +3,14 @@
<ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/> <ms-tag v-if="value == 'Prepare'" type="info" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/> <ms-tag v-if="value == 'Underway'" type="primary" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="value == 'Completed'" type="success" :content="$t('test_track.plan.plan_status_completed')"/> <ms-tag v-if="value == 'Completed'" type="success" :content="$t('test_track.plan.plan_status_completed')"/>
<ms-tag v-if="value === 'Trash'" type="danger" effect="plain" content="废弃"/>
</div> </div>
</template> </template>
<script> <script>
import MsTag from "../../../../common/components/MsTag"; import MsTag from "../../../../common/components/MsTag";
export default {
export default {
name: "PlanStatusTableItem", name: "PlanStatusTableItem",
components: {MsTag}, components: {MsTag},
props: { props: {