From a3acd04f2c7b3f17d4687d3e8fa00929c336428f Mon Sep 17 00:00:00 2001 From: youys <1272586223@qq.com> Date: Fri, 30 Dec 2022 18:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecsonar/controller/QualityInspectController.java | 2 +- .../ecsonar/services/QualityInspectService.java | 9 ++++++++- src/main/resources/mapper/IssuesMapper.xml | 12 +++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java b/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java index ad5cac5..4985fc5 100644 --- a/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java +++ b/src/main/java/net/educoder/ecsonar/controller/QualityInspectController.java @@ -129,7 +129,7 @@ public class QualityInspectController { */ @GetMapping("/problemAnalysis") @ResponseBody - public ResponseResult problemAnalysis(@RequestParam Integer ruleId) { + public ResponseResult problemAnalysis(@RequestParam Integer ruleId) { ProblemAnalysisDTO problemAnalysis = qualityInspectService.getProblemAnalysis(ruleId); return ResponseResult.success(problemAnalysis); } diff --git a/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java b/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java index 16955f3..2a59d75 100644 --- a/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java +++ b/src/main/java/net/educoder/ecsonar/services/QualityInspectService.java @@ -20,6 +20,7 @@ import net.educoder.ecsonar.utils.IdUtils; import net.educoder.ecsonar.utils.SystemUtil; import net.educoder.ecsonar.utils.html.HtmlSourceDecorator; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -318,7 +319,13 @@ public class QualityInspectService { problemAnalysisDTO.setExample(example); problemAnalysisDTO.setLanguage(rule.getLanguage()); problemAnalysisDTO.setConstantIssue(rule.getDefRemediationBaseEffort()); - problemAnalysisDTO.setTags(Arrays.asList(rule.getTags().split(","))); + + if (StringUtils.isBlank(rule.getTags())) { + problemAnalysisDTO.setTags(new ArrayList<>()); + }else{ + problemAnalysisDTO.setTags(Arrays.asList(rule.getTags().split(","))); + } + problemAnalysisDTO.setCreateTime(DateUtil.formatDateTime(new Date(rule.getCreateTime()))); }else{ problemAnalysisDTO.setTitle(""); diff --git a/src/main/resources/mapper/IssuesMapper.xml b/src/main/resources/mapper/IssuesMapper.xml index 8150707..5ae3b15 100644 --- a/src/main/resources/mapper/IssuesMapper.xml +++ b/src/main/resources/mapper/IssuesMapper.xml @@ -11,6 +11,7 @@ inner join rules r on i.rule_id =r.id inner join projects p on p.uuid =i.component_uuid where i.project_uuid = #{projectUuid,jdbcType=VARCHAR} + and i.status='OPEN' and p.root_uuid =#{projectUuid,jdbcType=VARCHAR} and p.uuid !=#{projectUuid,jdbcType=VARCHAR} and p."scope" ='FIL' and i.issue_type=#{issueType,jdbcType=INTEGER} @@ -28,6 +29,7 @@ inner join rules r on i.rule_id =r.id inner join projects p on p.uuid =i.component_uuid where i.project_uuid = #{projectUuid,jdbcType=VARCHAR} + and i.status='OPEN' and p.root_uuid =#{projectUuid,jdbcType=VARCHAR} and p.uuid !=#{projectUuid,jdbcType=VARCHAR} and p."scope" ='FIL' and i.issue_type=#{issueType,jdbcType=INTEGER} @@ -40,11 +42,11 @@