mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 20:19:16 +08:00
feat(测试计划): 计划详情返回关注计划标识
This commit is contained in:
parent
8e41b18136
commit
2b609c41f9
@ -131,7 +131,7 @@ public class TestPlanController {
|
||||
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ)
|
||||
@CheckOwner(resourceId = "#id", resourceType = "test_plan")
|
||||
public TestPlanDetailResponse detail(@NotBlank @PathVariable String id) {
|
||||
return testPlanService.detail(id);
|
||||
return testPlanService.detail(id, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/batch-delete")
|
||||
|
@ -60,4 +60,7 @@ public class TestPlanDetailResponse extends TestPlanStatisticsResponse implement
|
||||
|
||||
@Schema(description = "是否定时任务")
|
||||
private Boolean useSchedule;
|
||||
|
||||
@Schema(description = "关注标识")
|
||||
private Boolean followFlag;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||
* @param id 计划ID
|
||||
* @return 计划的详情数据
|
||||
*/
|
||||
public TestPlanDetailResponse detail(String id) {
|
||||
public TestPlanDetailResponse detail(String id, String userId) {
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(id);
|
||||
TestPlanDetailResponse response = new TestPlanDetailResponse();
|
||||
String moduleName = getModuleName(testPlan.getModuleId());
|
||||
@ -485,9 +485,21 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||
ScheduleExample example = new ScheduleExample();
|
||||
example.createCriteria().andResourceIdEqualTo(id).andResourceTypeEqualTo("TEST_PLAN");
|
||||
response.setUseSchedule(scheduleMapper.countByExample(example) > 0);
|
||||
|
||||
//是否关注计划
|
||||
Boolean isFollow = checkIsFollowCase(id, userId);
|
||||
response.setFollowFlag(isFollow);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
private Boolean checkIsFollowCase(String testPlanId, String userId) {
|
||||
TestPlanFollowerExample example = new TestPlanFollowerExample();
|
||||
example.createCriteria().andTestPlanIdEqualTo(testPlanId).andUserIdEqualTo(userId);
|
||||
return testPlanFollowerMapper.countByExample(example) > 0;
|
||||
}
|
||||
|
||||
private void getOtherConfig(TestPlanDetailResponse response, TestPlan testPlan) {
|
||||
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(testPlan.getId());
|
||||
response.setAutomaticStatusUpdate(testPlanConfig.getAutomaticStatusUpdate());
|
||||
|
Loading…
Reference in New Issue
Block a user