Merge remote-tracking branch 'origin/master'

This commit is contained in:
Captain.B 2021-03-22 18:24:01 +08:00
commit a1fd1af3f5
12 changed files with 328 additions and 294 deletions

View File

@ -1,18 +1,19 @@
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
@Data @Data
public class TestCaseTest implements Serializable { public class TestCaseTest implements Serializable {
private String id;
private String testCaseId; private String testCaseId;
private String testId; private String testId;
private String testType; private String testType;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -104,76 +104,6 @@ public class TestCaseTestExample {
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
} }
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTestCaseIdIsNull() { public Criteria andTestCaseIdIsNull() {
addCriterion("test_case_id is null"); addCriterion("test_case_id is null");
return (Criteria) this; return (Criteria) this;
@ -383,6 +313,126 @@ public class TestCaseTestExample {
addCriterion("test_type not between", value1, value2, "testType"); addCriterion("test_type not between", value1, value2, "testType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -2,30 +2,21 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseTest; import io.metersphere.base.domain.TestCaseTest;
import io.metersphere.base.domain.TestCaseTestExample; import io.metersphere.base.domain.TestCaseTestExample;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestCaseTestMapper { public interface TestCaseTestMapper {
long countByExample(TestCaseTestExample example); long countByExample(TestCaseTestExample example);
int deleteByExample(TestCaseTestExample example); int deleteByExample(TestCaseTestExample example);
int deleteByPrimaryKey(String id);
int insert(TestCaseTest record); int insert(TestCaseTest record);
int insertSelective(TestCaseTest record); int insertSelective(TestCaseTest record);
List<TestCaseTest> selectByExample(TestCaseTestExample example); List<TestCaseTest> selectByExample(TestCaseTestExample example);
TestCaseTest selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example);
int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example);
int updateByPrimaryKeySelective(TestCaseTest record);
int updateByPrimaryKey(TestCaseTest record);
} }

View File

@ -1,201 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.TestCaseTestMapper"> <mapper namespace="io.metersphere.base.mapper.TestCaseTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseTest"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseTest">
<id column="id" jdbcType="VARCHAR" property="id"/> <result column="test_case_id" jdbcType="VARCHAR" property="testCaseId" />
<result column="test_case_id" jdbcType="VARCHAR" property="testCaseId"/> <result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="test_id" jdbcType="VARCHAR" property="testId"/> <result column="test_type" jdbcType="VARCHAR" property="testType" />
<result column="test_type" jdbcType="VARCHAR" property="testType"/> <result column="create_time" jdbcType="BIGINT" property="createTime" />
</resultMap> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<sql id="Example_Where_Clause"> </resultMap>
<where> <sql id="Example_Where_Clause">
<foreach collection="oredCriteria" item="criteria" separator="or"> <where>
<if test="criteria.valid"> <foreach collection="oredCriteria" item="criteria" separator="or">
<trim prefix="(" prefixOverrides="and" suffix=")"> <if test="criteria.valid">
<foreach collection="criteria.criteria" item="criterion"> <trim prefix="(" prefixOverrides="and" suffix=")">
<choose> <foreach collection="criteria.criteria" item="criterion">
<when test="criterion.noValue"> <choose>
and ${criterion.condition} <when test="criterion.noValue">
</when> and ${criterion.condition}
<when test="criterion.singleValue"> </when>
and ${criterion.condition} #{criterion.value} <when test="criterion.singleValue">
</when> and ${criterion.condition} #{criterion.value}
<when test="criterion.betweenValue"> </when>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} <when test="criterion.betweenValue">
</when> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<when test="criterion.listValue"> </when>
and ${criterion.condition} <when test="criterion.listValue">
<foreach close=")" collection="criterion.value" item="listItem" open="(" and ${criterion.condition}
separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
</choose> </choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</where> </trim>
</sql> </if>
<sql id="Update_By_Example_Where_Clause"> </foreach>
<where> </where>
<foreach collection="example.oredCriteria" item="criteria" separator="or"> </sql>
<if test="criteria.valid"> <sql id="Update_By_Example_Where_Clause">
<trim prefix="(" prefixOverrides="and" suffix=")"> <where>
<foreach collection="criteria.criteria" item="criterion"> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<choose> <if test="criteria.valid">
<when test="criterion.noValue"> <trim prefix="(" prefixOverrides="and" suffix=")">
and ${criterion.condition} <foreach collection="criteria.criteria" item="criterion">
</when> <choose>
<when test="criterion.singleValue"> <when test="criterion.noValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.betweenValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<foreach close=")" collection="criterion.value" item="listItem" open="(" </when>
separator=","> <when test="criterion.listValue">
#{listItem} and ${criterion.condition}
</foreach> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
</when> #{listItem}
</choose> </foreach>
</foreach> </when>
</trim> </choose>
</if>
</foreach> </foreach>
</where> </trim>
</sql>
<sql id="Base_Column_List">
id, test_case_id, test_id, test_type
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if> </if>
<include refid="Base_Column_List"/> </foreach>
from test_case_test </where>
<if test="_parameter != null"> </sql>
<include refid="Example_Where_Clause"/> <sql id="Base_Column_List">
</if> test_case_id, test_id, test_type, create_time, update_time
<if test="orderByClause != null"> </sql>
order by ${orderByClause} <select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample" resultMap="BaseResultMap">
</if> select
</select> <if test="distinct">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> distinct
select </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from test_case_test from test_case_test
where id = #{id,jdbcType=VARCHAR} <if test="_parameter != null">
</select> <include refid="Example_Where_Clause" />
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </if>
delete <if test="orderByClause != null">
from test_case_test order by ${orderByClause}
where id = #{id,jdbcType=VARCHAR} </if>
</delete> </select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample">
delete from test_case_test delete from test_case_test
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseTest"> <insert id="insert" parameterType="io.metersphere.base.domain.TestCaseTest">
insert into test_case_test (id, test_case_id, test_id, insert into test_case_test (test_case_id, test_id, test_type,
test_type) create_time, update_time)
values (#{id,jdbcType=VARCHAR}, #{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, values (#{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{testType,jdbcType=VARCHAR},
#{testType,jdbcType=VARCHAR}) #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTest"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTest">
insert into test_case_test insert into test_case_test
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="testCaseId != null">
id, test_case_id,
</if> </if>
<if test="testCaseId != null"> <if test="testId != null">
test_case_id, test_id,
</if> </if>
<if test="testId != null"> <if test="testType != null">
test_id, test_type,
</if> </if>
<if test="testType != null"> <if test="createTime != null">
test_type, create_time,
</if> </if>
</trim> <if test="updateTime != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> update_time,
<if test="id != null"> </if>
#{id,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="testCaseId != null"> <if test="testCaseId != null">
#{testCaseId,jdbcType=VARCHAR}, #{testCaseId,jdbcType=VARCHAR},
</if> </if>
<if test="testId != null"> <if test="testId != null">
#{testId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
</if> </if>
<if test="testType != null"> <if test="testType != null">
#{testType,jdbcType=VARCHAR}, #{testType,jdbcType=VARCHAR},
</if> </if>
</trim> <if test="createTime != null">
</insert> #{createTime,jdbcType=BIGINT},
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample" </if>
resultType="java.lang.Long"> <if test="updateTime != null">
select count(*) from test_case_test #{updateTime,jdbcType=BIGINT},
<if test="_parameter != null"> </if>
<include refid="Example_Where_Clause"/> </trim>
</if> </insert>
</select> <select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample" resultType="java.lang.Long">
<update id="updateByExampleSelective" parameterType="map"> select count(*) from test_case_test
update test_case_test <if test="_parameter != null">
<set> <include refid="Example_Where_Clause" />
<if test="record.id != null"> </if>
id = #{record.id,jdbcType=VARCHAR}, </select>
</if> <update id="updateByExampleSelective" parameterType="map">
<if test="record.testCaseId != null"> update test_case_test
test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, <set>
</if> <if test="record.testCaseId != null">
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.testType != null">
test_type = #{record.testType,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_test
set id = #{record.id,jdbcType=VARCHAR},
test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR}, test_id = #{record.testId,jdbcType=VARCHAR},
test_type = #{record.testType,jdbcType=VARCHAR} </if>
<if test="_parameter != null"> <if test="record.testType != null">
<include refid="Update_By_Example_Where_Clause"/> test_type = #{record.testType,jdbcType=VARCHAR},
</if> </if>
</update> <if test="record.createTime != null">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseTest"> create_time = #{record.createTime,jdbcType=BIGINT},
update test_case_test </if>
<set> <if test="record.updateTime != null">
<if test="testCaseId != null"> update_time = #{record.updateTime,jdbcType=BIGINT},
test_case_id = #{testCaseId,jdbcType=VARCHAR}, </if>
</if> </set>
<if test="testId != null"> <if test="_parameter != null">
test_id = #{testId,jdbcType=VARCHAR}, <include refid="Update_By_Example_Where_Clause" />
</if> </if>
<if test="testType != null"> </update>
test_type = #{testType,jdbcType=VARCHAR}, <update id="updateByExample" parameterType="map">
</if> update test_case_test
</set> set test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
where id = #{id,jdbcType=VARCHAR} test_id = #{record.testId,jdbcType=VARCHAR},
</update> test_type = #{record.testType,jdbcType=VARCHAR},
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseTest"> create_time = #{record.createTime,jdbcType=BIGINT},
update test_case_test update_time = #{record.updateTime,jdbcType=BIGINT}
set test_case_id = #{testCaseId,jdbcType=VARCHAR}, <if test="_parameter != null">
test_id = #{testId,jdbcType=VARCHAR}, <include refid="Update_By_Example_Where_Clause" />
test_type = #{testType,jdbcType=VARCHAR} </if>
where id = #{id,jdbcType=VARCHAR} </update>
</update>
</mapper> </mapper>

View File

@ -65,7 +65,7 @@ public interface ExtTestCaseMapper {
long countRelevanceCreatedThisWeek(@Param("projectId") String projectId,@Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); long countRelevanceCreatedThisWeek(@Param("projectId") String projectId,@Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
List<TrackCountResult> countCoverage(@Param("projectId") String projectId); int countCoverage(@Param("projectId") String projectId);
List<TrackCountResult> countFuncMaintainer(@Param("projectId") String projectId); List<TrackCountResult> countFuncMaintainer(@Param("projectId") String projectId);

View File

@ -343,17 +343,19 @@
</select> </select>
<select id="countRelevance" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countRelevance" resultType="io.metersphere.track.response.TrackCountResult">
SELECT type AS groupField, count(id) AS countNumber FROM test_case WHERE test_case.project_id = #{projectId} GROUP BY test_case.type SELECT test_case_test.test_type AS groupField, count(test_case_test.test_case_id) AS countNumber
FROM test_case join test_case_test on test_case.id = test_case_test.test_case_id
WHERE test_case.project_id = #{projectId} GROUP BY test_case_test.test_type
</select> </select>
<select id="countRelevanceCreatedThisWeek" resultType="java.lang.Long"> <select id="countRelevanceCreatedThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM test_case WHERE test_case.project_id = #{projectId} SELECT count(distinct test_case_test.test_case_id) AS countNumber FROM test_case join test_case_test on test_case.id = test_case_test.test_case_id
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} WHERE test_case.project_id = #{projectId}
AND test_case_test.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select> </select>
<select id="countCoverage" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countCoverage" resultType="int">
SELECT count(test_case.id) AS countNumber, select count(test_case.id) from test_case where test_case.project_id = #{projectId}
if(test_case.test_id is null,"uncoverage","coverage") AS groupField and test_case.id in (select distinct test_case_test.test_case_id from test_case_test)
FROM test_case WHERE test_case.project_id=#{projectId} and test_case.type != 'functional' GROUP BY groupField
</select> </select>
<select id="countFuncMaintainer" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countFuncMaintainer" resultType="io.metersphere.track.response.TrackCountResult">
select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id
@ -362,7 +364,7 @@
</select> </select>
<select id="countRelevanceMaintainer" resultType="io.metersphere.track.response.TrackCountResult"> <select id="countRelevanceMaintainer" resultType="io.metersphere.track.response.TrackCountResult">
select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id select count(tc.id) as countNumber, user.name as groupField from test_case tc right join user on tc.maintainer = user.id
where tc.project_id = #{projectId} and tc.test_id is not null where tc.project_id = #{projectId} and tc.id in (select distinct test_case_test.test_case_id from test_case_test)
group by tc.maintainer group by tc.maintainer
</select> </select>
<select id="getTestPlanBug" resultType="int"> <select id="getTestPlanBug" resultType="int">

View File

@ -1,11 +1,13 @@
package io.metersphere.track.controller; package io.metersphere.track.controller;
import io.metersphere.base.domain.TestCase;
import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.performance.base.ChartsData; import io.metersphere.performance.base.ChartsData;
import io.metersphere.track.response.BugStatustics; import io.metersphere.track.response.BugStatustics;
import io.metersphere.track.response.TrackCountResult; import io.metersphere.track.response.TrackCountResult;
import io.metersphere.track.response.TrackStatisticsDTO; import io.metersphere.track.response.TrackStatisticsDTO;
import io.metersphere.track.service.TestCaseService;
import io.metersphere.track.service.TrackService; import io.metersphere.track.service.TrackService;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@ -25,6 +27,8 @@ public class TrackController {
@Resource @Resource
private TrackService trackService; private TrackService trackService;
@Resource
private TestCaseService testCaseService;
@GetMapping("/count/{projectId}") @GetMapping("/count/{projectId}")
public TrackStatisticsDTO getTrackCount(@PathVariable String projectId) { public TrackStatisticsDTO getTrackCount(@PathVariable String projectId) {
@ -63,10 +67,11 @@ public class TrackController {
long size = trackService.countRelevanceCreatedThisWeek(projectId); long size = trackService.countRelevanceCreatedThisWeek(projectId);
statistics.setThisWeekAddedCount(size); statistics.setThisWeekAddedCount(size);
List<TrackCountResult> coverageResults = trackService.countCoverage(projectId); List<TestCase> list = testCaseService.getTestCaseByProjectId(projectId);
statistics.countCoverage(coverageResults); long total = list.size();
int coverage = trackService.countCoverage(projectId);
long total = statistics.getUncoverageCount() + statistics.getCoverageCount(); statistics.setCoverageCount(coverage);
statistics.setUncoverageCount(total - coverage);
if (total != 0) { if (total != 0) {
float coverageRageNumber = (float) statistics.getCoverageCount() * 100 / total; float coverageRageNumber = (float) statistics.getCoverageCount() * 100 / total;

View File

@ -664,8 +664,9 @@ public class TestCaseService {
selecteds.forEach(id -> { selecteds.forEach(id -> {
test.setTestType(id.get(0)); test.setTestType(id.get(0));
test.setTestId(id.get(1)); test.setTestId(id.get(1));
test.setId(UUID.randomUUID().toString());
test.setTestCaseId(request.getId()); test.setTestCaseId(request.getId());
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
testCaseTestMapper.insert(test); testCaseTestMapper.insert(test);
}); });
} }
@ -707,7 +708,8 @@ public class TestCaseService {
selecteds.forEach(id -> { selecteds.forEach(id -> {
test.setTestType(id.get(0)); test.setTestType(id.get(0));
test.setTestId(id.get(1)); test.setTestId(id.get(1));
test.setId(UUID.randomUUID().toString()); test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
test.setTestCaseId(request.getId()); test.setTestCaseId(request.getId());
testCaseTestMapper.insert(test); testCaseTestMapper.insert(test);
}); });
@ -779,4 +781,10 @@ public class TestCaseService {
} }
}); });
} }
public List<TestCase> getTestCaseByProjectId(String projectId) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andProjectIdEqualTo(projectId);
return testCaseMapper.selectByExample(example);
}
} }

View File

@ -80,7 +80,7 @@ public class TrackService {
} }
} }
public List<TrackCountResult> countCoverage(String projectId) { public int countCoverage(String projectId) {
return extTestCaseMapper.countCoverage(projectId); return extTestCaseMapper.countCoverage(projectId);
} }

View File

@ -185,6 +185,8 @@ create table test_case_test
test_case_id varchar(70) null, test_case_id varchar(70) null,
test_id varchar(70) null, test_id varchar(70) null,
test_type varchar(70) null, test_type varchar(70) null,
create_time bigint(13) null,
update_time bigint(13) null,
constraint test_case_test_pk constraint test_case_test_pk
primary key (id) primary key (id)
) ENGINE = InnoDB ) ENGINE = InnoDB

View File

@ -8,7 +8,8 @@
<env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false" <env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false"
ref="envSelect" @setProjectEnvMap="setProjectEnvMap" :project-list="projectList"/> ref="envSelect" @setProjectEnvMap="setProjectEnvMap" :project-list="projectList"/>
<el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;"> <el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;">
环境配置<i class="el-icon-caret-bottom el-icon--right"></i> {{ $t('api_test.definition.request.run_env') }}
<i class="el-icon-caret-bottom el-icon--right"></i>
</el-button> </el-button>
</el-popover> </el-popover>
</template> </template>

@ -1 +1 @@
Subproject commit 3dbd5a3d7ec96a10e11d817cdec25832986af1d2 Subproject commit f63ebb68ebad78de42fd711f17e2671e34577a86