fix(工作台): 1.20我的仪表盘状态统计处理 (#17717)

* fix(工作台): 1.20我的仪表盘状态统计处理

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016061

* fix(工作台): 1.20我的仪表盘状态统计处理

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016061

Co-authored-by: guoyuqi <xiaomeinvG@126.com>
This commit is contained in:
MeterSphere Bot 2022-09-06 18:32:01 +08:00 committed by GitHub
parent c7a7218c2f
commit c9b399172f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 24 deletions

View File

@ -0,0 +1,12 @@
package io.metersphere.api.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class IssuesStatusCountDao {
private int statusCount;
private String statusValue;
private String platform;
}

View File

@ -15,9 +15,8 @@ public class IssuesDao extends IssuesWithBLOBs {
private long caseCount;
private List<String> caseIds;
private String caseId;
private int totalIssueCount;
private List<String> tapdUsers;
private List<String>zentaoBuilds;
private List<String> zentaoBuilds;
private String zentaoAssigned;
private String refType;
private String refId;

View File

@ -1,5 +1,6 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.IssuesStatusCountDao;
import io.metersphere.base.domain.Issues;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.track.dto.PlanReportIssueDTO;
@ -24,7 +25,7 @@ public interface ExtIssuesMapper {
List<PlanReportIssueDTO> selectForPlanReport(String planId);
List<IssuesDao> getCountByStatus(@Param("request") IssuesRequest issuesRequest);
List<IssuesStatusCountDao> getCountByStatus(@Param("request") IssuesRequest issuesRequest);
List<String> selectIdNotInUuIds(@Param("projectId") String projectId, @Param("platform") String platform, @Param("platformIds") List<String> platformIds);

View File

@ -18,7 +18,8 @@
</select>
<select id="getIssueForMinder" resultType="io.metersphere.base.domain.IssuesDao">
select issues.id, issues.title , issues.num , test_case_issues.resource_id, test_case_issues.ref_id, test_case_issues.ref_type
select issues.id, issues.title , issues.num , test_case_issues.resource_id, test_case_issues.ref_id,
test_case_issues.ref_type
from issues
inner join test_case_issues
on test_case_issues.issues_id = issues.id
@ -71,24 +72,29 @@
inner join test_case_issues
on issues.id = test_case_issues.issues_id and test_case_issues.ref_type = 'PLAN_FUNCTIONAL'
and test_case_issues.resource_id in (
select id from test_plan_test_case tptc where plan_id = #{request.planId}
select id from test_plan_test_case tptc where plan_id = #{request.planId}
)
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<select id="getNextNum" resultType="io.metersphere.base.domain.Issues">
SELECT * FROM issues WHERE issues.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
SELECT *
FROM issues
WHERE issues.project_id = #{projectId}
ORDER BY num DESC LIMIT 1;
</select>
<select id="getCountByStatus" resultType="io.metersphere.base.domain.IssuesDao">
select count(issues.id) as totalIssueCount, ifnull(issues.status,issues.platform_status) as status from issues
<select id="getCountByStatus" resultType="io.metersphere.api.dto.IssuesStatusCountDao">
select count(issues.id) as statusCount, if(issues.platform = 'Local',issues.status,issues.platform_status)
as statusValue from issues
left join project on issues.project_id = project.id
<include refid="queryWhereCondition"/>
group by status;
group by statusValue;
</select>
<select id="getRelateIssues" resultType="io.metersphere.base.domain.IssuesDao">
select issues.id, issues.num, issues.title, issues.project_id, issues.create_time, issues.update_time,
issues.description, issues.status, issues.platform, issues.custom_fields,test_case_issues.resource_id,issues.platform_status,
issues.description, issues.status, issues.platform,
issues.custom_fields,test_case_issues.resource_id,issues.platform_status,
issues.lastmodify
from issues
left join
@ -98,12 +104,17 @@
group by issues.id
</select>
<select id="getIssueForSync" resultType="io.metersphere.base.domain.IssuesDao">
select id,platform, platform_id
select id, platform, platform_id
from issues
where project_id = #{projectId} and platform = #{platform} and (platform_status != 'delete' or platform_status is null);
where project_id = #{projectId}
and platform = #{platform}
and (platform_status != 'delete' or platform_status is null);
</select>
<select id="selectForPlanReport" resultType="io.metersphere.track.dto.PlanReportIssueDTO">
select id,status,platform_status,platform from issues where resource_id = #{planId} and ( platform_status != 'delete' or platform_status is null);
select id, status, platform_status, platform
from issues
where resource_id = #{planId}
and (platform_status != 'delete' or platform_status is null);
</select>
<select id="selectIdNotInUuIds" resultType="java.lang.String">
select id from issues
@ -112,9 +123,9 @@
#{value}
</foreach>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="io.metersphere.base.domain.IssuesDao">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultType="io.metersphere.base.domain.IssuesDao">
select
<include refid="Issue_List_Column" />
<include refid="Issue_List_Column"/>
from issues
where id = #{id,jdbcType=VARCHAR}
</select>
@ -130,9 +141,9 @@
</if>
<if test="request.name != null">
and (
issues.title LIKE CONCAT('%', #{request.name}, '%')
or issues.num LIKE CONCAT('%', #{request.name}, '%')
)
issues.title LIKE CONCAT('%', #{request.name}, '%')
or issues.num LIKE CONCAT('%', #{request.name}, '%')
)
</if>
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
@ -147,7 +158,8 @@
<if test="request.caseResourceId != null and request.caseResourceId != ''">
<if test="request.refType == 'FUNCTIONAL'">
and (test_case_issues.resource_id = #{request.caseResourceId} or test_case_issues.ref_id = #{request.caseResourceId})
and (test_case_issues.resource_id = #{request.caseResourceId} or test_case_issues.ref_id =
#{request.caseResourceId})
</if>
<if test="request.refType == 'PLAN_FUNCTIONAL'">
and test_case_issues.resource_id = #{request.caseResourceId} and test_case_issues.ref_type

View File

@ -2,6 +2,7 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.IssuesStatusCountDao;
import io.metersphere.base.domain.Issues;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.base.domain.IssuesWithBLOBs;
@ -151,7 +152,7 @@ public class IssuesController {
}
@PostMapping("/status/count")
public List<IssuesDao> getCountByStatus(@RequestBody IssuesRequest request) {
public List<IssuesStatusCountDao> getCountByStatus(@RequestBody IssuesRequest request) {
return issuesService.getCountByStatus(request);
}
@ -161,8 +162,8 @@ public class IssuesController {
}
@PostMapping("/up/follows/{issueId}")
public void saveFollows(@PathVariable String issueId,@RequestBody List<String> follows) {
issuesService.saveFollows(issueId,follows);
public void saveFollows(@PathVariable String issueId, @RequestBody List<String> follows) {
issuesService.saveFollows(issueId, follows);
}
@GetMapping("/thirdpart/template/{projectId}")

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.IssuesStatusCountDao;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.IssueFollowMapper;
import io.metersphere.base.mapper.IssuesMapper;
@ -425,7 +426,7 @@ public class IssuesService {
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(example);
List<String> caseIds = testCaseIssues.stream().map(x ->
x.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name()) ? x.getRefId() : x.getResourceId())
x.getRefType().equals(IssueRefType.PLAN_FUNCTIONAL.name()) ? x.getRefId() : x.getResourceId())
.collect(Collectors.toList());
List<TestCaseDTO> notInTrashCase = testCaseService.getTestCaseByIds(caseIds);
@ -714,7 +715,7 @@ public class IssuesService {
issuesMapper.updateByPrimaryKeySelective(issues);
}
public List<IssuesDao> getCountByStatus(IssuesRequest request) {
public List<IssuesStatusCountDao> getCountByStatus(IssuesRequest request) {
return extIssuesMapper.getCountByStatus(request);
}