fix(测试跟踪): 测试评审打开用例报错

This commit is contained in:
AgAngle 2024-06-12 11:53:18 +08:00 committed by 刘瑞斌
parent edcb46a44c
commit 8ce127cfc5
3 changed files with 13 additions and 11 deletions

View File

@ -4,12 +4,14 @@
<select id="checkoutOwner" resultType="boolean">
SELECT count(1) > 0
FROM user_group
WHERE source_id IN (SELECT project_id
WHERE source_id IN (
SELECT project_id
FROM ${table} JOIN project ON ${table}.project_id = project.id
WHERE ${table}.id IN
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>)
</foreach>
)
AND user_id = #{userId}
</select>

View File

@ -104,7 +104,7 @@ public class TestReviewTestCaseController {
@GetMapping("/get/{reviewId}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ)
public TestReviewCaseDTO get(@PathVariable String reviewId) {
return testReviewTestCaseService.get(reviewId, SessionUtils.getCurrentProjectId());
return testReviewTestCaseService.get(reviewId, SessionUtils.getUserId());
}
@GetMapping("/reviewer/status/{id}")

View File

@ -459,9 +459,9 @@ public class TestReviewTestCaseService {
return comments;
}
public TestReviewCaseDTO get(String testReviewTestCaseId, String currentProjectId) {
public TestReviewCaseDTO get(String testReviewTestCaseId, String currentUserId) {
TestReviewCaseDTO testReviewCaseDTO = extTestReviewCaseMapper.get(testReviewTestCaseId);
checkReviewCaseOwner(testReviewCaseDTO.getCaseId(), currentProjectId);
checkReviewCaseOwner(testReviewCaseDTO.getCaseId(), currentUserId);
testReviewCaseDTO.setFields(testCaseService.getCustomFieldByCaseId(testReviewCaseDTO.getCaseId()));
return testReviewCaseDTO;
}
@ -881,8 +881,8 @@ public class TestReviewTestCaseService {
}
}
private void checkReviewCaseOwner(String caseId, String currentProjectId) {
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", currentProjectId, List.of(caseId));
private void checkReviewCaseOwner(String caseId, String currentUserId) {
boolean hasPermission = extCheckOwnerMapper.checkoutOwner("test_case", currentUserId, List.of(caseId));
if (!hasPermission) {
MSException.throwException(Translator.get("check_owner_case"));
}