refactor(缺陷管理):缺陷管理详情查询添加支持关注人字段

This commit is contained in:
song-cc-rock 2024-02-06 23:06:37 +08:00 committed by Craftsman
parent 152ea72a4c
commit 16533c9237
3 changed files with 9 additions and 2 deletions

View File

@ -119,7 +119,7 @@ public class BugController {
@Operation(summary = "缺陷管理-列表-查看缺陷(详情&&编辑&&复制)")
@RequiresPermissions(PermissionConstants.PROJECT_BUG_READ)
public BugDetailDTO get(@PathVariable String id) {
return bugService.get(id);
return bugService.get(id, SessionUtils.getUserId());
}
@GetMapping("/delete/{id}")

View File

@ -43,6 +43,9 @@ public class BugDetailDTO {
@Schema(description = "是否平台默认模板")
private Boolean platformDefault;
@Schema(description = "是否关注")
private Boolean followFlag;
@Schema(description = "附件集合")
List<BugFileDTO> attachments;
}

View File

@ -242,7 +242,7 @@ public class BugService {
* @param id 缺陷ID
* @return 缺陷详情
*/
public BugDetailDTO get(String id) {
public BugDetailDTO get(String id, String currentUser) {
Bug bug = checkBugExist(id);
TemplateDTO template = getTemplate(bug.getTemplateId(), bug.getProjectId(), null, null);
List<BugCustomFieldDTO> allCustomFields = extBugCustomFieldMapper.getBugAllCustomFields(List.of(id), bug.getProjectId());
@ -288,6 +288,10 @@ public class BugService {
detail.setCustomFields(allCustomFields);
// 缺陷附件信息
detail.setAttachments(bugAttachmentService.getAllBugFiles(id));
// 当前登录人是否关注该缺陷
BugFollowerExample example = new BugFollowerExample();
example.createCriteria().andBugIdEqualTo(id).andUserIdEqualTo(currentUser);
detail.setFollowFlag(bugFollowerMapper.countByExample(example) > 0);
return detail;
}