Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-05-21 14:18:13 +08:00
commit 77db7f8464
50 changed files with 832 additions and 368 deletions

View File

@ -18,5 +18,7 @@ public class LoadTestReport implements Serializable {
private String status; private String status;
private String description;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -1,13 +1,15 @@
package io.metersphere.base.domain; package io.metersphere.base.domain;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
@Data @Data
public class LoadTestReportDetail implements Serializable { @EqualsAndHashCode(callSuper = true)
private String reportId; @ToString(callSuper = true)
public class LoadTestReportDetail extends LoadTestReportDetailKey implements Serializable {
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -173,6 +173,66 @@ public class LoadTestReportDetailExample {
addCriterion("report_id not between", value1, value2, "reportId"); addCriterion("report_id not between", value1, value2, "reportId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPartIsNull() {
addCriterion("part is null");
return (Criteria) this;
}
public Criteria andPartIsNotNull() {
addCriterion("part is not null");
return (Criteria) this;
}
public Criteria andPartEqualTo(Long value) {
addCriterion("part =", value, "part");
return (Criteria) this;
}
public Criteria andPartNotEqualTo(Long value) {
addCriterion("part <>", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThan(Long value) {
addCriterion("part >", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThanOrEqualTo(Long value) {
addCriterion("part >=", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThan(Long value) {
addCriterion("part <", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThanOrEqualTo(Long value) {
addCriterion("part <=", value, "part");
return (Criteria) this;
}
public Criteria andPartIn(List<Long> values) {
addCriterion("part in", values, "part");
return (Criteria) this;
}
public Criteria andPartNotIn(List<Long> values) {
addCriterion("part not in", values, "part");
return (Criteria) this;
}
public Criteria andPartBetween(Long value1, Long value2) {
addCriterion("part between", value1, value2, "part");
return (Criteria) this;
}
public Criteria andPartNotBetween(Long value1, Long value2) {
addCriterion("part not between", value1, value2, "part");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -0,0 +1,14 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTestReportDetailKey implements Serializable {
private String reportId;
private Long part;
private static final long serialVersionUID = 1L;
}

View File

@ -12,6 +12,8 @@ public class LoadTestReportLog implements Serializable {
private String resourceId; private String resourceId;
private Long part;
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -313,6 +313,66 @@ public class LoadTestReportLogExample {
addCriterion("resource_id not between", value1, value2, "resourceId"); addCriterion("resource_id not between", value1, value2, "resourceId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPartIsNull() {
addCriterion("part is null");
return (Criteria) this;
}
public Criteria andPartIsNotNull() {
addCriterion("part is not null");
return (Criteria) this;
}
public Criteria andPartEqualTo(Long value) {
addCriterion("part =", value, "part");
return (Criteria) this;
}
public Criteria andPartNotEqualTo(Long value) {
addCriterion("part <>", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThan(Long value) {
addCriterion("part >", value, "part");
return (Criteria) this;
}
public Criteria andPartGreaterThanOrEqualTo(Long value) {
addCriterion("part >=", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThan(Long value) {
addCriterion("part <", value, "part");
return (Criteria) this;
}
public Criteria andPartLessThanOrEqualTo(Long value) {
addCriterion("part <=", value, "part");
return (Criteria) this;
}
public Criteria andPartIn(List<Long> values) {
addCriterion("part in", values, "part");
return (Criteria) this;
}
public Criteria andPartNotIn(List<Long> values) {
addCriterion("part not in", values, "part");
return (Criteria) this;
}
public Criteria andPartBetween(Long value1, Long value2) {
addCriterion("part between", value1, value2, "part");
return (Criteria) this;
}
public Criteria andPartNotBetween(Long value1, Long value2) {
addCriterion("part not between", value1, value2, "part");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -1,18 +0,0 @@
package io.metersphere.base.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class LoadTestReportWithBLOBs extends LoadTestReport implements Serializable {
private String description;
private String content;
private static final long serialVersionUID = 1L;
}

View File

@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.LoadTestReportDetail; import io.metersphere.base.domain.LoadTestReportDetail;
import io.metersphere.base.domain.LoadTestReportDetailExample; import io.metersphere.base.domain.LoadTestReportDetailExample;
import io.metersphere.base.domain.LoadTestReportDetailKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -11,7 +12,7 @@ public interface LoadTestReportDetailMapper {
int deleteByExample(LoadTestReportDetailExample example); int deleteByExample(LoadTestReportDetailExample example);
int deleteByPrimaryKey(String reportId); int deleteByPrimaryKey(LoadTestReportDetailKey key);
int insert(LoadTestReportDetail record); int insert(LoadTestReportDetail record);
@ -21,7 +22,7 @@ public interface LoadTestReportDetailMapper {
List<LoadTestReportDetail> selectByExample(LoadTestReportDetailExample example); List<LoadTestReportDetail> selectByExample(LoadTestReportDetailExample example);
LoadTestReportDetail selectByPrimaryKey(String reportId); LoadTestReportDetail selectByPrimaryKey(LoadTestReportDetailKey key);
int updateByExampleSelective(@Param("record") LoadTestReportDetail record, @Param("example") LoadTestReportDetailExample example); int updateByExampleSelective(@Param("record") LoadTestReportDetail record, @Param("example") LoadTestReportDetailExample example);

View File

@ -3,6 +3,7 @@
<mapper namespace="io.metersphere.base.mapper.LoadTestReportDetailMapper"> <mapper namespace="io.metersphere.base.mapper.LoadTestReportDetailMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReportDetail"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReportDetail">
<id column="report_id" jdbcType="VARCHAR" property="reportId" /> <id column="report_id" jdbcType="VARCHAR" property="reportId" />
<id column="part" jdbcType="BIGINT" property="part"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportDetail"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportDetail">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -66,7 +67,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
report_id report_id,
part
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
@ -101,18 +103,20 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportDetailKey" resultMap="ResultMapWithBLOBs">
select SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List"/>
from load_test_report_detail FROM load_test_report_detail
where report_id = #{reportId,jdbcType=VARCHAR} WHERE report_id = #{reportId,jdbcType=VARCHAR}
</select> AND part = #{part,jdbcType=BIGINT}
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> </select>
delete from load_test_report_detail <delete id="deleteByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportDetailKey">
where report_id = #{reportId,jdbcType=VARCHAR} DELETE FROM load_test_report_detail
</delete> WHERE report_id = #{reportId,jdbcType=VARCHAR}
AND part = #{part,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample"> <delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample">
delete from load_test_report_detail delete from load_test_report_detail
<if test="_parameter != null"> <if test="_parameter != null">
@ -120,27 +124,35 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
insert into load_test_report_detail (report_id, content) insert into load_test_report_detail (report_id, part, content
values (#{reportId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}) )
values (#{reportId,jdbcType=VARCHAR}, #{part,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
insert into load_test_report_detail insert into load_test_report_detail
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="content != null"> <if test="part != null">
content, part,
</if> </if>
</trim> <if test="content != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> content,
<if test="reportId != null"> </if>
#{reportId,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="content != null"> <if test="reportId != null">
#{content,jdbcType=LONGVARCHAR}, #{reportId,jdbcType=VARCHAR},
</if> </if>
</trim> <if test="part != null">
#{part,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportDetailExample" resultType="java.lang.Long">
select count(*) from load_test_report_detail select count(*) from load_test_report_detail
@ -150,30 +162,35 @@
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update load_test_report_detail update load_test_report_detail
<set> <set>
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
</if> </if>
<if test="record.content != null"> <if test="record.part != null">
content = #{record.content,jdbcType=LONGVARCHAR}, part = #{record.part,jdbcType=BIGINT},
</if> </if>
</set> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report_detail update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR}, set report_id = #{record.reportId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update load_test_report_detail update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR} set report_id = #{record.reportId,jdbcType=VARCHAR},
<if test="_parameter != null"> part = #{record.part,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
@ -184,11 +201,13 @@
content = #{content,jdbcType=LONGVARCHAR}, content = #{content,jdbcType=LONGVARCHAR},
</if> </if>
</set> </set>
where report_id = #{reportId,jdbcType=VARCHAR} where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportDetail"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportDetail">
update load_test_report_detail update load_test_report_detail
set content = #{content,jdbcType=LONGVARCHAR} set content = #{content,jdbcType=LONGVARCHAR}
where report_id = #{reportId,jdbcType=VARCHAR} where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" /> <result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" /> <result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="part" jdbcType="BIGINT" property="part"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportLog"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportLog">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -68,7 +69,10 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, report_id, resource_id id,
report_id,
resource_id,
part
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
@ -122,41 +126,47 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportLog">
insert into load_test_report_log (id, report_id, resource_id, insert into load_test_report_log (id, report_id, resource_id,
content) part, content)
values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR}) #{part,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportLog">
insert into load_test_report_log insert into load_test_report_log
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="reportId != null"> <if test="reportId != null">
report_id, report_id,
</if> </if>
<if test="resourceId != null"> <if test="resourceId != null">
resource_id, resource_id,
</if> </if>
<if test="content != null"> <if test="part != null">
content, part,
</if> </if>
</trim> <if test="content != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> content,
<if test="id != null"> </if>
#{id,jdbcType=VARCHAR}, </trim>
</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reportId != null"> <if test="id != null">
#{reportId,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR},
</if> </if>
<if test="resourceId != null"> <if test="reportId != null">
#{resourceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null"> <if test="resourceId != null">
#{content,jdbcType=LONGVARCHAR}, #{resourceId,jdbcType=VARCHAR},
</if> </if>
</trim> <if test="part != null">
#{part,jdbcType=BIGINT},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportLogExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportLogExample" resultType="java.lang.Long">
select count(*) from load_test_report_log select count(*) from load_test_report_log
@ -166,69 +176,79 @@
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update load_test_report_log update load_test_report_log
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR}, id = #{record.id,jdbcType=VARCHAR},
</if> </if>
<if test="record.reportId != null"> <if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
</if> </if>
<if test="record.resourceId != null"> <if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR}, resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if> </if>
<if test="record.content != null"> <if test="record.part != null">
content = #{record.content,jdbcType=LONGVARCHAR}, part = #{record.part,jdbcType=BIGINT},
</if> </if>
</set> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report_log update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR}, resource_id = #{record.resourceId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update load_test_report_log update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR} resource_id = #{record.resourceId,jdbcType=VARCHAR},
<if test="_parameter != null"> part = #{record.part,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
<set> <set>
<if test="reportId != null"> <if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR}, report_id = #{reportId,jdbcType=VARCHAR},
</if> </if>
<if test="resourceId != null"> <if test="resourceId != null">
resource_id = #{resourceId,jdbcType=VARCHAR}, resource_id = #{resourceId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null"> <if test="part != null">
content = #{content,jdbcType=LONGVARCHAR}, part = #{part,jdbcType=BIGINT},
</if> </if>
</set> <if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR}, set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR}, resource_id = #{resourceId,jdbcType=VARCHAR},
part = #{part,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR} content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportLog"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportLog">
update load_test_report_log update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR}, set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR} resource_id = #{resourceId,jdbcType=VARCHAR},
where id = #{id,jdbcType=VARCHAR} part = #{part,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -2,7 +2,6 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.LoadTestReport; import io.metersphere.base.domain.LoadTestReport;
import io.metersphere.base.domain.LoadTestReportExample; import io.metersphere.base.domain.LoadTestReportExample;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -14,25 +13,25 @@ public interface LoadTestReportMapper {
int deleteByPrimaryKey(String id); int deleteByPrimaryKey(String id);
int insert(LoadTestReportWithBLOBs record); int insert(LoadTestReport record);
int insertSelective(LoadTestReportWithBLOBs record); int insertSelective(LoadTestReport record);
List<LoadTestReportWithBLOBs> selectByExampleWithBLOBs(LoadTestReportExample example); List<LoadTestReport> selectByExampleWithBLOBs(LoadTestReportExample example);
List<LoadTestReport> selectByExample(LoadTestReportExample example); List<LoadTestReport> selectByExample(LoadTestReportExample example);
LoadTestReportWithBLOBs selectByPrimaryKey(String id); LoadTestReport selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example); int updateByExampleSelective(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByExampleWithBLOBs(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example); int updateByExampleWithBLOBs(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example); int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
int updateByPrimaryKeySelective(LoadTestReportWithBLOBs record); int updateByPrimaryKeySelective(LoadTestReport record);
int updateByPrimaryKeyWithBLOBs(LoadTestReportWithBLOBs record); int updateByPrimaryKeyWithBLOBs(LoadTestReport record);
int updateByPrimaryKey(LoadTestReport record); int updateByPrimaryKey(LoadTestReport record);
} }

View File

@ -9,9 +9,8 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="status" jdbcType="VARCHAR" property="status" /> <result column="status" jdbcType="VARCHAR" property="status" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReport">
<result column="description" jdbcType="LONGVARCHAR" property="description" /> <result column="description" jdbcType="LONGVARCHAR" property="description"/>
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -75,7 +74,7 @@
id, test_id, name, create_time, update_time, status id, test_id, name, create_time, update_time, status
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
description, content description
</sql> </sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs"> <select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs">
select select
@ -125,25 +124,25 @@
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReport">
insert into load_test_report (id, test_id, name, INSERT INTO load_test_report (id, test_id, name,
create_time, update_time, status, create_time, update_time, status,
description, content) description)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, VALUES (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{description,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR}) #{description,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReport">
insert into load_test_report insert into load_test_report
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="testId != null"> <if test="testId != null">
test_id, test_id,
</if> </if>
<if test="name != null"> <if test="name != null">
name, name,
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
@ -157,9 +156,6 @@
<if test="description != null"> <if test="description != null">
description, description,
</if> </if>
<if test="content != null">
content,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -183,9 +179,6 @@
<if test="description != null"> <if test="description != null">
#{description,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultType="java.lang.Long">
@ -218,25 +211,21 @@
<if test="record.description != null"> <if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update load_test_report update load_test_report
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR}, test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
status = #{record.status,jdbcType=VARCHAR}, status = #{record.status,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}, description = #{record.description,jdbcType=LONGVARCHAR}
content = #{record.content,jdbcType=LONGVARCHAR} <if test="_parameter != null">
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
@ -252,17 +241,17 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report update load_test_report
<set> <set>
<if test="testId != null"> <if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR}, test_id = #{testId,jdbcType=VARCHAR},
</if> </if>
<if test="name != null"> <if test="name != null">
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
@ -273,23 +262,19 @@
<if test="description != null"> <if test="description != null">
description = #{description,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=LONGVARCHAR},
</if> </if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report UPDATE load_test_report
set test_id = #{testId,jdbcType=VARCHAR}, SET test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
status = #{status,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR}, description = #{description,jdbcType=LONGVARCHAR}
content = #{content,jdbcType=LONGVARCHAR} WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} </update>
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReport"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReport">
update load_test_report update load_test_report
set test_id = #{testId,jdbcType=VARCHAR}, set test_id = #{testId,jdbcType=VARCHAR},

View File

@ -14,8 +14,6 @@ public interface ExtLoadTestReportMapper {
ReportDTO getReportTestAndProInfo(@Param("id") String id); ReportDTO getReportTestAndProInfo(@Param("id") String id);
int appendLine(@Param("testId") String id, @Param("line") String line);
LoadTestReport selectByPrimaryKey(String id); LoadTestReport selectByPrimaryKey(String id);
List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp); List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp);

View File

@ -41,12 +41,6 @@
where ltr.id = #{id} where ltr.id = #{id}
</select> </select>
<update id="appendLine">
UPDATE load_test_report
SET content = concat(content, #{line})
WHERE id = #{testId}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>

View File

@ -1,5 +1,6 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.Workspace;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.dto.TestCaseReportStatusResultDTO; import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.dto.TestPlanCaseDTO;
@ -15,7 +16,7 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request); List<TestPlanCaseDTO> list(@Param("request") QueryTestPlanCaseRequest request);
List<String> findRelateTestPlanId(String userId); List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request); List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);

View File

@ -62,7 +62,11 @@
</select> </select>
<select id="findRelateTestPlanId" resultType="java.lang.String"> <select id="findRelateTestPlanId" resultType="java.lang.String">
select distinct plan_id from test_plan_test_case where executor = #{userId} select distinct plan_id from test_plan_test_case
inner join test_plan
on test_plan_test_case.plan_id = test_plan.id
where test_plan_test_case.executor = #{userId}
and test_plan.workspace_id = #{workspaceId}
</select> </select>
<select id="getRecentTestedTestCase" resultType="io.metersphere.track.dto.TestPlanCaseDTO"> <select id="getRecentTestedTestCase" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.*, test_case.* select test_plan_test_case.*, test_case.*

View File

@ -85,6 +85,7 @@ public interface ParamConstants {
this.value = value; this.value = value;
} }
} }
public static enum MAIL { public static enum MAIL {
HOST("meter.host", 1), HOST("meter.host", 1),
PORT("meter.port", 2), PORT("meter.port", 2),

View File

@ -22,4 +22,9 @@ public class RoleController {
return roleService.getRoleList(sign); return roleService.getRoleList(sign);
} }
@GetMapping("/all")
public List<Role> getAllRole() {
return roleService.getAllRole();
}
} }

View File

@ -15,13 +15,15 @@ import java.util.List;
@RequestMapping(value = "/system") @RequestMapping(value = "/system")
public class SystemParameterController { public class SystemParameterController {
@Resource @Resource
private SystemParameterService SystemParameterService; private SystemParameterService SystemParameterService;
@PostMapping("/edit/email") @PostMapping("/edit/email")
public void editMail(@RequestBody List<SystemParameter> SystemParameter){ public void editMail(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.editMail(SystemParameter); SystemParameterService.editMail(systemParameter);
} }
@PostMapping("/testConnection") @PostMapping("/testConnection")
public void testConnection(@RequestBody HashMap<String, String> hashMap){ public void testConnection(@RequestBody HashMap<String, String> hashMap) {
SystemParameterService.testConnection(hashMap); SystemParameterService.testConnection(hashMap);
} }

View File

@ -9,8 +9,8 @@ import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.UserRequest;
import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest; import io.metersphere.controller.request.organization.AddOrgMemberRequest;
@ -38,16 +38,15 @@ public class UserController {
@Resource @Resource
private WorkspaceService workspaceService; private WorkspaceService workspaceService;
// admin api
@PostMapping("/special/add") @PostMapping("/special/add")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public UserDTO insertUser(@RequestBody User user) { public UserDTO insertUser(@RequestBody UserRequest user) {
return userService.insert(user); return userService.insert(user);
} }
@PostMapping("/special/list/{goPage}/{pageSize}") @PostMapping("/special/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody UserRequest request) { public Pager<List<User>> getUserList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody io.metersphere.controller.request.UserRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request)); return PageUtils.setPageInfo(page, userService.getUserListWithRequest(request));
} }
@ -66,8 +65,8 @@ public class UserController {
@PostMapping("/special/update") @PostMapping("/special/update")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public void updateUser(@RequestBody User user) { public void updateUser(@RequestBody UserRequest user) {
userService.updateUser(user); userService.updateUserRole(user);
} }
@PostMapping("/special/ws/member/list/{goPage}/{pageSize}") @PostMapping("/special/ws/member/list/{goPage}/{pageSize}")
@ -119,7 +118,6 @@ public class UserController {
public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) { public List<User> getOrgMemberListByAdmin(@RequestBody QueryOrgMemberRequest request) {
return userService.getOrgMemberList(request); return userService.getOrgMemberList(request);
} }
// admin api
@GetMapping("/list") @GetMapping("/list")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
@RequestMapping("userrole") @RequestMapping("userrole")
@RestController @RestController
@ -20,14 +21,20 @@ public class UserRoleController {
private UserRoleService userRoleService; private UserRoleService userRoleService;
@GetMapping("/list/org/{orgId}/{userId}") @GetMapping("/list/org/{orgId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) { public List<Role> getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) {
return userRoleService.getOrganizationMemberRoles(orgId, userId); return userRoleService.getOrganizationMemberRoles(orgId, userId);
} }
@GetMapping("/list/ws/{workspaceId}/{userId}") @GetMapping("/list/ws/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) { public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) {
return userRoleService.getWorkspaceMemberRoles(workspaceId, userId); return userRoleService.getWorkspaceMemberRoles(workspaceId, userId);
} }
@GetMapping("/all/{userId}")
@RequiresRoles(RoleConstants.ADMIN)
public List<Map<String,Object>> getUserRole(@PathVariable("userId") String userId) {
return userRoleService.getUserRole(userId);
}
} }

View File

@ -38,6 +38,11 @@ public class WorkspaceController {
return workspaceService.saveWorkspace(workspace); return workspaceService.saveWorkspace(workspace);
} }
@GetMapping("/list")
public List<Workspace> getWorkspaceList() {
return workspaceService.getWorkspaceList(new WorkspaceRequest());
}
@PostMapping("special/add") @PostMapping("special/add")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public void addWorkspaceByAdmin(@RequestBody Workspace workspace) { public void addWorkspaceByAdmin(@RequestBody Workspace workspace) {

View File

@ -0,0 +1,16 @@
package io.metersphere.controller.request.member;
import io.metersphere.base.domain.User;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class UserRequest extends User {
private List<Map<String,Object>> roles = new ArrayList<>();
}

View File

@ -6,7 +6,7 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class LogDetailDTO { public class LogDetailDTO {
private String id; private String resourceId;
private String resourceName; private String resourceName;
private String content; private String content;
} }

View File

@ -32,8 +32,11 @@ public abstract class EasyExcelListener <T> extends AnalysisEventListener<T> {
public EasyExcelListener(){ public EasyExcelListener(){
Type type = getClass().getGenericSuperclass(); Type type = getClass().getGenericSuperclass();
this.clazz = (Class<T>) ((ParameterizedType) type).getActualTypeArguments()[0]; this.clazz = (Class<T>) ((ParameterizedType) type).getActualTypeArguments()[0];
this.easyExcelI18nTranslator = new EasyExcelI18nTranslator(this.clazz); //防止多线程修改运行时类注解后saveOriginalExcelProperty保存的是修改后的值
this.easyExcelI18nTranslator.translateExcelProperty(); synchronized (EasyExcelI18nTranslator.class) {
this.easyExcelI18nTranslator = new EasyExcelI18nTranslator(this.clazz);
this.easyExcelI18nTranslator.translateExcelProperty();
}
} }
/** /**

View File

@ -24,17 +24,24 @@ public class EasyExcelExporter {
EasyExcelI18nTranslator easyExcelI18nTranslator; EasyExcelI18nTranslator easyExcelI18nTranslator;
public EasyExcelExporter() { private Class clazz;
easyExcelI18nTranslator = new EasyExcelI18nTranslator(TestCaseExcelData.class);
easyExcelI18nTranslator.translateExcelProperty(); public EasyExcelExporter(Class clazz) {
this.clazz = clazz;
//防止多线程修改运行时类注解后saveOriginalExcelProperty保存的是修改后的值
synchronized (EasyExcelI18nTranslator.class) {
easyExcelI18nTranslator = new EasyExcelI18nTranslator(clazz);
easyExcelI18nTranslator.translateExcelProperty();
}
} }
public void export(HttpServletResponse response, Class clazz, List data, String fileName, String sheetName) { public void export(HttpServletResponse response, List data, String fileName, String sheetName) {
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
try { try {
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx");
EasyExcel.write(response.getOutputStream(), clazz).sheet(sheetName).doWrite(data); EasyExcel.write(response.getOutputStream(), this.clazz).sheet(sheetName).doWrite(data);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
LogUtil.error(e.getMessage(), e); LogUtil.error(e.getMessage(), e);
throw new ExcelException("Utf-8 encoding is not supported"); throw new ExcelException("Utf-8 encoding is not supported");
@ -42,7 +49,6 @@ public class EasyExcelExporter {
LogUtil.error(e.getMessage(), e); LogUtil.error(e.getMessage(), e);
throw new ExcelException("IO exception"); throw new ExcelException("IO exception");
} }
} }
public void close() { public void close() {

View File

@ -104,9 +104,9 @@ public class PerformanceReportController {
return reportService.logs(reportId); return reportService.logs(reportId);
} }
@GetMapping("log/download/{logId}") @GetMapping("log/download/{reportId}/{resourceId}")
public ResponseEntity<byte[]> downloadLog(@PathVariable String logId) { public ResponseEntity<byte[]> downloadLog(@PathVariable String reportId, @PathVariable String resourceId) {
byte[] bytes = reportService.downloadLog(logId); byte[] bytes = reportService.downloadLog(reportId, resourceId);
return ResponseEntity.ok() return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("application/octet-stream")) .contentType(MediaType.parseMediaType("application/octet-stream"))
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"jmeter.log\"") .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"jmeter.log\"")

View File

@ -79,7 +79,9 @@ public class PerformanceTestService {
// delete load_test_report, delete load_test_report_detail // delete load_test_report, delete load_test_report_detail
reportIdList.forEach(reportId -> { reportIdList.forEach(reportId -> {
loadTestReportDetailMapper.deleteByPrimaryKey(reportId); LoadTestReportDetailExample example = new LoadTestReportDetailExample();
example.createCriteria().andReportIdEqualTo(reportId);
loadTestReportDetailMapper.deleteByExample(example);
reportService.deleteReport(reportId); reportService.deleteReport(reportId);
}); });
@ -202,7 +204,7 @@ public class PerformanceTestService {
} }
private void startEngine(LoadTestWithBLOBs loadTest, Engine engine) { private void startEngine(LoadTestWithBLOBs loadTest, Engine engine) {
LoadTestReportWithBLOBs testReport = new LoadTestReportWithBLOBs(); LoadTestReport testReport = new LoadTestReport();
testReport.setId(engine.getReportId()); testReport.setId(engine.getReportId());
testReport.setCreateTime(engine.getStartTime()); testReport.setCreateTime(engine.getStartTime());
testReport.setUpdateTime(engine.getStartTime()); testReport.setUpdateTime(engine.getStartTime());
@ -216,29 +218,16 @@ public class PerformanceTestService {
loadTest.setStatus(PerformanceTestStatus.Starting.name()); loadTest.setStatus(PerformanceTestStatus.Starting.name());
loadTestMapper.updateByPrimaryKeySelective(loadTest); loadTestMapper.updateByPrimaryKeySelective(loadTest);
// 启动正常插入 report // 启动正常插入 report
testReport.setContent(HEADERS);
testReport.setStatus(PerformanceTestStatus.Starting.name()); testReport.setStatus(PerformanceTestStatus.Starting.name());
loadTestReportMapper.insertSelective(testReport); loadTestReportMapper.insertSelective(testReport);
LoadTestReportDetail reportDetail = new LoadTestReportDetail(); LoadTestReportDetail reportDetail = new LoadTestReportDetail();
reportDetail.setContent(HEADERS); reportDetail.setContent(HEADERS);
reportDetail.setReportId(testReport.getId()); reportDetail.setReportId(testReport.getId());
reportDetail.setPart(1L);
loadTestReportDetailMapper.insertSelective(reportDetail); loadTestReportDetailMapper.insertSelective(reportDetail);
// append \n // append \n
extLoadTestReportMapper.appendLine(testReport.getId(), "\n");
// append \n
extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n"); extLoadTestReportDetailMapper.appendLine(testReport.getId(), "\n");
// 保存 load_test_report_log
String resourcePoolId = loadTest.getTestResourcePoolId();
List<TestResource> testResourceList = testResourceService.getResourcesByPoolId(resourcePoolId);
testResourceList.forEach(r -> {
LoadTestReportLog record = new LoadTestReportLog();
record.setId(UUID.randomUUID().toString());
record.setReportId(testReport.getId());
record.setResourceId(r.getId());
record.setContent(StringUtils.EMPTY);
loadTestReportLogMapper.insert(record);
});
} catch (MSException e) { } catch (MSException e) {
LogUtil.error(e); LogUtil.error(e);
loadTest.setStatus(PerformanceTestStatus.Error.name()); loadTest.setStatus(PerformanceTestStatus.Error.name());

View File

@ -24,7 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -57,7 +59,7 @@ public class ReportService {
MSException.throwException("report id cannot be null"); MSException.throwException("report id cannot be null");
} }
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId()); LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId());
LogUtil.info("Delete report started, report ID: %s" + reportId); LogUtil.info("Delete report started, report ID: %s" + reportId);
@ -142,7 +144,7 @@ public class ReportService {
} }
public void checkReportStatus(String reportId) { public void checkReportStatus(String reportId) {
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
String reportStatus = loadTestReport.getStatus(); String reportStatus = loadTestReport.getStatus();
if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) { if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) {
MSException.throwException("Reporting in progress..."); MSException.throwException("Reporting in progress...");
@ -160,42 +162,50 @@ public class ReportService {
public List<LogDetailDTO> logs(String reportId) { public List<LogDetailDTO> logs(String reportId) {
LoadTestReportLogExample example = new LoadTestReportLogExample(); LoadTestReportLogExample example = new LoadTestReportLogExample();
example.createCriteria().andReportIdEqualTo(reportId); example.createCriteria().andReportIdEqualTo(reportId);
example.setOrderByClause("part");
List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example); List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
return loadTestReportLogs.stream().map(log -> { Map<String, List<LoadTestReportLog>> reportLogs = loadTestReportLogs.stream().collect(Collectors.groupingBy(LoadTestReportLog::getResourceId));
List<LogDetailDTO> result = new ArrayList<>();
reportLogs.forEach((resourceId, resourceLogs) -> {
LogDetailDTO detailDTO = new LogDetailDTO(); LogDetailDTO detailDTO = new LogDetailDTO();
detailDTO.setId(log.getId()); TestResource testResource = testResourceService.getTestResource(resourceId);
TestResource testResource = testResourceService.getTestResource(log.getResourceId()); String content = resourceLogs.stream().map(LoadTestReportLog::getContent).reduce("", (a, b) -> a + b);
String content = log.getContent();
// 显示前 2048 // 显示前 2048
content = StringUtils.substring(content, 0, 2048); content = StringUtils.substring(content, 0, 2048);
detailDTO.setResourceId(resourceId);
detailDTO.setContent(content); detailDTO.setContent(content);
if (testResource == null) { if (testResource == null) {
detailDTO.setResourceName(log.getResourceId()); detailDTO.setResourceName(resourceId);
return detailDTO; result.add(detailDTO);
return;
} }
String configuration = testResource.getConfiguration(); String configuration = testResource.getConfiguration();
if (StringUtils.isBlank(configuration)) { if (StringUtils.isBlank(configuration)) {
detailDTO.setResourceName(log.getResourceId()); detailDTO.setResourceName(resourceId);
return detailDTO; result.add(detailDTO);
return;
} }
JSONObject object = JSON.parseObject(configuration); JSONObject object = JSON.parseObject(configuration);
if (StringUtils.isNotBlank(object.getString("masterUrl"))) { if (StringUtils.isNotBlank(object.getString("masterUrl"))) {
detailDTO.setResourceName(object.getString("masterUrl")); detailDTO.setResourceName(object.getString("masterUrl"));
return detailDTO; result.add(detailDTO);
return;
} }
if (StringUtils.isNotBlank(object.getString("ip"))) { if (StringUtils.isNotBlank(object.getString("ip"))) {
detailDTO.setResourceName(object.getString("ip")); detailDTO.setResourceName(object.getString("ip"));
return detailDTO; result.add(detailDTO);
} }
return detailDTO; });
}).collect(Collectors.toList()); return result;
} }
public byte[] downloadLog(String logId) {
LoadTestReportLog loadTestReportLog = loadTestReportLogMapper.selectByPrimaryKey(logId); public byte[] downloadLog(String reportId, String resourceId) {
if (loadTestReportLog != null) { LoadTestReportLogExample example = new LoadTestReportLogExample();
return loadTestReportLog.getContent().getBytes(); example.createCriteria().andReportIdEqualTo(reportId).andResourceIdEqualTo(resourceId);
} List<LoadTestReportLog> loadTestReportLogs = loadTestReportLogMapper.selectByExampleWithBLOBs(example);
return new byte[0];
String content = loadTestReportLogs.stream().map(LoadTestReportLog::getContent).reduce("", (a, b) -> a + b);
return content.getBytes();
} }
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.service; package io.metersphere.service;
import io.metersphere.base.domain.Role; import io.metersphere.base.domain.Role;
import io.metersphere.base.mapper.RoleMapper;
import io.metersphere.base.mapper.ext.ExtRoleMapper; import io.metersphere.base.mapper.ext.ExtRoleMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -13,8 +14,14 @@ public class RoleService {
@Resource @Resource
private ExtRoleMapper extRoleMapper; private ExtRoleMapper extRoleMapper;
@Resource
private RoleMapper roleMapper;
public List<Role> getRoleList(String sign) { public List<Role> getRoleList(String sign) {
return extRoleMapper.getRoleList(sign); return extRoleMapper.getRoleList(sign);
} }
public List<Role> getAllRole() {
return roleMapper.selectByExample(null);
}
} }

View File

@ -9,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -16,7 +17,6 @@ import java.util.Properties;
import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.JavaMailSenderImpl;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -39,7 +39,8 @@ public class SystemParameterService {
} }
return result; return result;
} }
public void editMail(List<SystemParameter> parameters){
public void editMail(List<SystemParameter> parameters) {
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue()); List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
boolean empty = paramList.size() < 2; boolean empty = paramList.size() < 2;
parameters.forEach(parameter -> { parameters.forEach(parameter -> {
@ -54,13 +55,14 @@ public class SystemParameterService {
} }
}); });
} }
public List<SystemParameter> getParamList(String type) { public List<SystemParameter> getParamList(String type) {
SystemParameterExample example = new SystemParameterExample(); SystemParameterExample example = new SystemParameterExample();
example.createCriteria().andParamKeyLike(type + "%"); example.createCriteria().andParamKeyLike(type + "%");
return systemParameterMapper.selectByExample(example); return systemParameterMapper.selectByExample(example);
} }
public void testConnection(HashMap<String, String> hashMap){ public void testConnection(HashMap<String, String> hashMap) {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setDefaultEncoding("UTF-8"); javaMailSender.setDefaultEncoding("UTF-8");
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey())); javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey()));

View File

@ -1,12 +1,20 @@
package io.metersphere.service; package io.metersphere.service;
import io.metersphere.base.domain.Role; import io.metersphere.base.domain.Role;
import io.metersphere.base.domain.UserRole;
import io.metersphere.base.domain.UserRoleExample;
import io.metersphere.base.mapper.UserRoleMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper; import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -14,6 +22,8 @@ public class UserRoleService {
@Resource @Resource
private ExtUserRoleMapper extUserRoleMapper; private ExtUserRoleMapper extUserRoleMapper;
@Resource
private UserRoleMapper userRoleMapper;
public List<Role> getOrganizationMemberRoles(String orgId, String userId) { public List<Role> getOrganizationMemberRoles(String orgId, String userId) {
return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId); return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId);
@ -23,4 +33,28 @@ public class UserRoleService {
return extUserRoleMapper.getWorkspaceMemberRoles(workspaceId, userId); return extUserRoleMapper.getWorkspaceMemberRoles(workspaceId, userId);
} }
public List<Map<String,Object>> getUserRole(String userId) {
List<Map<String,Object>> list = new ArrayList<>();
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userId);
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
List<String> collect = userRoles.stream()
.map(userRole -> userRole.getRoleId())
.distinct()
.collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
Map<String, Object> map = new HashMap<>(2);
map.put("id", collect.get(i));
map.put("Ids", new ArrayList<>());
for (int j = 0; j < userRoles.size(); j++) {
String role = userRoles.get(j).getRoleId();
if (StringUtils.equals(role, collect.get(i))) {
List ids = (List) map.get("Ids");
ids.add(userRoles.get(j).getSourceId());
}
}
list.add(map);
}
return list;
}
} }

View File

@ -4,12 +4,13 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtUserMapper; import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper; import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.CodingUtil; import io.metersphere.commons.utils.CodingUtil;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest; import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.UserRequest;
import io.metersphere.controller.request.member.EditPassWordRequest; import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest; import io.metersphere.controller.request.organization.AddOrgMemberRequest;
@ -23,8 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.*;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -46,7 +46,7 @@ public class UserService {
@Resource @Resource
private ExtUserMapper extUserMapper; private ExtUserMapper extUserMapper;
public UserDTO insert(User user) { public UserDTO insert(UserRequest user) {
checkUserParam(user); checkUserParam(user);
// //
String id = user.getId(); String id = user.getId();
@ -56,9 +56,44 @@ public class UserService {
} else { } else {
createUser(user); createUser(user);
} }
List<Map<String, Object>> roles = user.getRoles();
if (!roles.isEmpty()) {
insertUserRole(roles, user.getId());
}
return getUserDTO(user.getId()); return getUserDTO(user.getId());
} }
private void insertUserRole(List<Map<String, Object>> roles, String userId) {
for (int i = 0; i < roles.size(); i++) {
Map<String, Object> map = roles.get(i);
String role = (String) map.get("id");
if (StringUtils.equals(role, RoleConstants.ADMIN)) {
UserRole userRole = new UserRole();
userRole.setId(UUID.randomUUID().toString());
userRole.setUserId(userId);
userRole.setUpdateTime(System.currentTimeMillis());
userRole.setCreateTime(System.currentTimeMillis());
userRole.setRoleId(role);
// TODO 修改
userRole.setSourceId("adminSourceId");
userRoleMapper.insertSelective(userRole);
} else {
List<String> list = (List<String>) map.get("Ids");
for (int j = 0; j < list.size(); j++) {
UserRole userRole1 = new UserRole();
userRole1.setId(UUID.randomUUID().toString());
userRole1.setUserId(userId);
userRole1.setRoleId(role);
userRole1.setUpdateTime(System.currentTimeMillis());
userRole1.setCreateTime(System.currentTimeMillis());
userRole1.setSourceId(list.get(j));
// TODO 防止重复插入
userRoleMapper.insertSelective(userRole1);
}
}
}
}
private void checkUserParam(User user) { private void checkUserParam(User user) {
if (StringUtils.isBlank(user.getName())) { if (StringUtils.isBlank(user.getName())) {
@ -132,7 +167,7 @@ public class UserService {
return userMapper.selectByExample(null); return userMapper.selectByExample(null);
} }
public List<User> getUserListWithRequest(UserRequest request) { public List<User> getUserListWithRequest(io.metersphere.controller.request.UserRequest request) {
return extUserMapper.getUserList(request); return extUserMapper.getUserList(request);
} }
@ -144,6 +179,19 @@ public class UserService {
userMapper.deleteByPrimaryKey(userId); userMapper.deleteByPrimaryKey(userId);
} }
public void updateUserRole(UserRequest user) {
String userId = user.getId();
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userId);
userRoleMapper.deleteByExample(userRoleExample);
List<Map<String, Object>> roles = user.getRoles();
if (!roles.isEmpty()) {
insertUserRole(roles, user.getId());
}
user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user);
}
public void updateUser(User user) { public void updateUser(User user) {
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
@ -268,7 +316,7 @@ public class UserService {
public void setLanguage(String lang) { public void setLanguage(String lang) {
if (SessionUtils.getUser() != null) { if (SessionUtils.getUser() != null) {
User user = new User(); UserRequest user = new UserRequest();
user.setId(SessionUtils.getUser().getId()); user.setId(SessionUtils.getUser().getId());
user.setLanguage(lang); user.setLanguage(lang);
updateUser(user); updateUser(user);

View File

@ -221,8 +221,8 @@ public class TestCaseService {
public void testCaseTemplateExport(HttpServletResponse response) { public void testCaseTemplateExport(HttpServletResponse response) {
EasyExcelExporter easyExcelExporter = null; EasyExcelExporter easyExcelExporter = null;
try { try {
easyExcelExporter = new EasyExcelExporter(); easyExcelExporter = new EasyExcelExporter(TestCaseExcelData.class);
easyExcelExporter.export(response, TestCaseExcelData.class, generateExportTemplate(), easyExcelExporter.export(response, generateExportTemplate(),
Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet")); Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"));
} catch (Exception e) { } catch (Exception e) {
MSException.throwException(e); MSException.throwException(e);

View File

@ -162,7 +162,7 @@ public class TestPlanService {
QueryTestPlanRequest request = new QueryTestPlanRequest(); QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setPrincipal(user.getId()); request.setPrincipal(user.getId());
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId())); request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId()); List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId());
@ -205,9 +205,9 @@ public class TestPlanService {
} }
private double getPercentWithTwoDecimals(double value) { private double getPercentWithTwoDecimals(double value) {
return new BigDecimal(value) return new BigDecimal(value * 100)
.setScale(4, BigDecimal.ROUND_HALF_UP) .setScale(2, BigDecimal.ROUND_HALF_UP)
.doubleValue() * 100; .doubleValue();
} }
public List<TestPlanCaseDTO> listTestCaseByPlanId(String planId) { public List<TestPlanCaseDTO> listTestCaseByPlanId(String planId) {
@ -329,7 +329,7 @@ public class TestPlanService {
} }
} }
public List<TestPlan> getTestPlanByTestIds(List<String> planIds) { public List<TestPlan> getTestPlanByIds(List<String> planIds) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria().andIdIn(planIds); example.createCriteria().andIdIn(planIds);
return testPlanMapper.selectByExample(example); return testPlanMapper.selectByExample(example);

View File

@ -80,10 +80,15 @@ public class TestPlanTestCaseService {
if (request.getPlanIds().isEmpty()) { if (request.getPlanIds().isEmpty()) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<TestPlanCaseDTO> recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request); List<TestPlanCaseDTO> recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request);
List<String> planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList()); List<String> planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList());
Map<String, String> testPlanMap = testPlanService.getTestPlanByTestIds(planIds).stream() if (planIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, String> testPlanMap = testPlanService.getTestPlanByIds(planIds).stream()
.collect(Collectors.toMap(TestPlan::getId, TestPlan::getName)); .collect(Collectors.toMap(TestPlan::getId, TestPlan::getName));
recentTestedTestCase.forEach(testCase -> { recentTestedTestCase.forEach(testCase -> {
@ -102,7 +107,7 @@ public class TestPlanTestCaseService {
public void buildQueryRequest(QueryTestPlanCaseRequest request, int count) { public void buildQueryRequest(QueryTestPlanCaseRequest request, int count) {
SessionUser user = SessionUtils.getUser(); SessionUser user = SessionUtils.getUser();
List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId()); List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId());
PageHelper.startPage(1, count, true); PageHelper.startPage(1, count, true);
request.setPlanIds(relateTestPlanIds); request.setPlanIds(relateTestPlanIds);
request.setExecutor(user.getId()); request.setExecutor(user.getId());

View File

@ -51,7 +51,6 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
`test_id` varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to', `test_id` varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to',
`name` varchar(64) NOT NULL COMMENT 'Test report name', `name` varchar(64) NOT NULL COMMENT 'Test report name',
`description` varchar(255) DEFAULT NULL COMMENT 'Test report name', `description` varchar(255) DEFAULT NULL COMMENT 'Test report name',
`content` longtext,
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`status` varchar(64) NOT NULL COMMENT 'Status of this test run', `status` varchar(64) NOT NULL COMMENT 'Status of this test run',
@ -64,20 +63,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
CREATE TABLE IF NOT EXISTS `load_test_report_detail` ( CREATE TABLE IF NOT EXISTS `load_test_report_detail` (
`report_id` varchar(50) NOT NULL, `report_id` varchar(50) NOT NULL,
`content` longtext, `content` longtext,
PRIMARY KEY (`report_id`) `part` bigint(11) NOT NULL,
) PRIMARY KEY (`report_id`,`part`)
ENGINE=InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `load_test_report_log` ( CREATE TABLE IF NOT EXISTS `load_test_report_log` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,
`report_id` varchar(50) NOT NULL, `report_id` varchar(50) NOT NULL,
`resource_id` varchar(50) DEFAULT NULL, `resource_id` varchar(50) DEFAULT NULL,
`content` longtext , `content` longtext ,
`part` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`) KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`,`part`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;
CREATE TABLE IF NOT EXISTS `load_test_report_result` ( CREATE TABLE IF NOT EXISTS `load_test_report_result` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,

View File

@ -59,7 +59,7 @@
<!--要生成的数据库表 --> <!--要生成的数据库表 -->
<table tableName="test_plan_test_case"/> <table tableName="load_test_report"/>
</context> </context>
</generatorConfiguration> </generatorConfiguration>

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<span class="title">{{$t('api_test.title')}}</span> <span class="title">{{$t('commons.test')}}</span>
</template> </template>
<el-table :data="tableData" class="table-content"> <el-table :data="tableData" class="table-content">
<el-table-column :label="$t('commons.name')" width="150" show-overflow-tooltip> <el-table-column :label="$t('commons.name')" width="150" show-overflow-tooltip>

View File

@ -3,7 +3,7 @@
<ms-main-container> <ms-main-container>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" :title="$t('api_test.title')" <ms-table-header :condition.sync="condition" @search="search" :title="$t('commons.test')"
@create="create" :createTip="$t('load_test.create')"/> @create="create" :createTip="$t('load_test.create')"/>
</template> </template>
<el-table :data="tableData" class="table-content"> <el-table :data="tableData" class="table-content">

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<span class="title">{{$t('api_test.title')}}</span> <span class="title">{{$t('commons.test')}}</span>
</template> </template>
<el-table :data="tableData" class="table-content"> <el-table :data="tableData" class="table-content">
<el-table-column :label="$t('commons.name')" width="150" show-overflow-tooltip> <el-table-column :label="$t('commons.name')" width="150" show-overflow-tooltip>

View File

@ -1,7 +1,7 @@
<template> <template>
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-tabs type="border-card" :stretch="true"> <el-tabs type="border-card" :stretch="true">
<el-tab-pane v-for="item in logContent" :key="item.id" :label="item.resourceName" class="logging-content"> <el-tab-pane v-for="item in logContent" :key="item.resourceId" :label="item.resourceName" class="logging-content">
{{item.content}}... {{item.content}}...
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link> <el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
</el-tab-pane> </el-tab-pane>
@ -27,7 +27,7 @@
}, },
downloadLogFile(item) { downloadLogFile(item) {
let config = { let config = {
url: '/performance/report/log/download/' + item.id, url: '/performance/report/log/download/' + this.id + '/' + item.resourceId,
method: 'get', method: 'get',
responseType: 'blob' responseType: 'blob'
}; };

View File

@ -12,7 +12,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host"> <el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host">
</el-form-item> </el-form-item>
<el-input v-model="formInline.host" :placeholder="$t('system_parameter_setting.SMTP_host')" <el-input v-model="formInline.host" :placeholder="$t('system_parameter_setting.SMTP_host')"
v-on:input="host"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -20,7 +20,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port"> <el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port">
</el-form-item> </el-form-item>
<el-input v-model="formInline.port" :placeholder="$t('system_parameter_setting.SMTP_port')" <el-input v-model="formInline.port" :placeholder="$t('system_parameter_setting.SMTP_port')"
v-on:input="port"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -28,7 +28,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account"> <el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account">
</el-form-item> </el-form-item>
<el-input v-model="formInline.account" :placeholder="$t('system_parameter_setting.SMTP_account')" <el-input v-model="formInline.account" :placeholder="$t('system_parameter_setting.SMTP_account')"
v-on:input="account"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -42,13 +42,13 @@
<!----> <!---->
<div style="border: 0px;margin-bottom: 20px;margin-top: 20px"> <div style="border: 0px;margin-bottom: 20px;margin-top: 20px">
<el-checkbox v-model="SSL" label="开启SSL(如果SMTP端口是465通常需要启用SSL)"></el-checkbox> <el-checkbox v-model="SSL" :label="$t('system_parameter_setting.SSL')"></el-checkbox>
</div> </div>
<div style="border: 0px;margin-bottom: 20px"> <div style="border: 0px;margin-bottom: 20px">
<el-checkbox v-model="TLS" label="开启TLS(如果SMTP端口是587通常需要启用TLS)"></el-checkbox> <el-checkbox v-model="TLS" :label="$t('system_parameter_setting.TLS')"></el-checkbox>
</div> </div>
<div style="border: 0px;margin-bottom: 20px"> <div style="border: 0px;margin-bottom: 20px">
<el-checkbox v-model="SMTP" label="是否匿名 SMTP"></el-checkbox> <el-checkbox v-model="SMTP" :label="$t('system_parameter_setting.SMTP')"></el-checkbox>
</div> </div>
<template v-slot:footer> <template v-slot:footer>
</template> </template>
@ -94,7 +94,7 @@
host: [ host: [
{ {
required: true, required: true,
message: this.$t('commons.host_cannot_be_empty') message: ''
}, },
], ],
port: [ port: [
@ -111,32 +111,11 @@
} }
} }
}, },
methods: { methods: {
host() { change() {
if (!this.formInline.host || !this.formInline.port || !this.formInline.account) {
let host = this.formInline.host;
if (!host) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
port() {
let port = this.formInline.port;
if (!port) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
account() {
let account = this.formInline.account;
if (!account) {
this.disabledConnection = true; this.disabledConnection = true;
this.disabledSave = true; this.disabledSave = true;
} else { } else {

View File

@ -16,7 +16,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="email" :label="$t('commons.email')"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="status" :label="$t('commons.status')"> <el-table-column prop="status" :label="$t('commons.status')" width="120">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-switch v-model="scope.row.status" <el-switch v-model="scope.row.status"
active-color="#13ce66" active-color="#13ce66"
@ -49,9 +49,9 @@
</el-card> </el-card>
<!--Create user--> <!--Create user-->
<el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="30%" @closed="handleClose" <el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="35%" @closed="handleClose"
:destroy-on-close="true"> :destroy-on-close="true">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="createUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off"/> <el-input v-model="form.id" autocomplete="off"/>
</el-form-item> </el-form-item>
@ -67,6 +67,74 @@
<el-form-item :label="$t('commons.password')" prop="password"> <el-form-item :label="$t('commons.password')" prop="password">
<el-input v-model="form.password" autocomplete="off" show-password/> <el-input v-model="form.password" autocomplete="off" show-password/>
</el-form-item> </el-form-item>
<div v-for="(role, index) in form.roles" :key="index">
<el-form-item :label="'角色'+index" :required="true">
<el-select v-model="role.id" placeholder="选择角色类型">
<el-option
v-for="item in userRole"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">删除
</el-button>
</el-form-item>
<div v-if="role.id === 'org_admin'">
<el-form-item label="选择组织" :required="true">
<el-select v-model="role.Ids" placeholder="选择组织" multiple>
<el-option
v-for="item in form.orgList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id === 'test_manager'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_user'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_viewer'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<template>
<el-button type="success" style="width: 100%;" @click="addRole()">添加角色</el-button>
</template>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@ -78,7 +146,7 @@
<!--Modify user information in system settings--> <!--Modify user information in system settings-->
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" <el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true"
@close="handleClose"> @close="handleClose">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
@ -91,6 +159,73 @@
<el-form-item :label="$t('commons.phone')" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<div v-for="(role, index) in form.roles" :key="index">
<el-form-item :label="'角色'+index" :required="true">
<el-select v-model="role.id" placeholder="选择角色类型">
<el-option
v-for="item in userRole"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">删除
</el-button>
</el-form-item>
<div v-if="role.id === 'org_admin'">
<el-form-item label="选择组织" :required="true">
<el-select v-model="role.Ids" placeholder="选择组织" multiple>
<el-option
v-for="item in form.orgList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id === 'test_manager'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_user'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
<div v-if="role.id ==='test_viewer'">
<el-form-item label="选择工作空间" :required="true">
<el-select v-model="role.Ids" placeholder="选择工作空间" multiple>
<el-option
v-for="item in form.wsList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<template>
<el-button type="success" style="width: 100%;" @click="addRole()">添加角色</el-button>
</template>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@ -152,12 +287,15 @@
updateVisible: false, updateVisible: false,
editPasswordVisible: false, editPasswordVisible: false,
multipleSelection: [], multipleSelection: [],
userRole: [],
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
condition: {}, condition: {},
tableData: [], tableData: [],
form: {}, form: {
roles: [{}]
},
checkPasswordForm: {}, checkPasswordForm: {},
ruleForm: {}, ruleForm: {},
setAdminParam: {}, setAdminParam: {},
@ -216,14 +354,27 @@
}, },
created() { created() {
this.search(); this.search();
this.getAllRole();
}, },
methods: { methods: {
create() { create() {
this.createVisible = true; this.createVisible = true;
this.getOrgList();
this.getWsList();
}, },
edit(row) { edit(row) {
this.updateVisible = true; this.updateVisible = true;
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
this.$get("/organization/list", response => {
this.$set(this.form, "orgList", response.data);
});
this.$get("/workspace/list", response => {
this.$set(this.form, "wsList", response.data);
});
this.$get('/userrole/all/' + row.id, response => {
let data = response.data;
this.$set(this.form, "roles", data);
});
}, },
editPassword(row) { editPassword(row) {
this.editPasswordVisible = true; this.editPasswordVisible = true;
@ -295,12 +446,12 @@
let roles = data.roles; let roles = data.roles;
// let userRoles = result.userRoles; // let userRoles = result.userRoles;
this.$set(this.tableData[i], "roles", roles); this.$set(this.tableData[i], "roles", roles);
}) });
} }
}) })
}, },
handleClose() { handleClose() {
this.form = {}; this.form = {roles: [{value: ''}]};
}, },
changeSwitch(row) { changeSwitch(row) {
this.$post(this.updatePath, row, () => { this.$post(this.updatePath, row, () => {
@ -312,7 +463,32 @@
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
} },
getOrgList() {
this.$get("/organization/list", response => {
this.$set(this.form, "orgList", response.data);
})
},
getWsList() {
this.$get("/workspace/list", response => {
this.$set(this.form, "wsList", response.data);
})
},
getAllRole() {
this.$get("/role/all", response => {
this.userRole = response.data;
})
},
addRole() {
let roles = this.form.roles;
roles.push({});
},
removeRole(item) {
let index = this.form.roles.indexOf(item)
if (index !== -1) {
this.form.roles.splice(index, 1)
}
},
} }
} }
</script> </script>

View File

@ -99,6 +99,7 @@
<el-row style="margin-bottom: 10px"> <el-row style="margin-bottom: 10px">
<el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col> <el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col>
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="20"> <el-col :span="20">
<el-table <el-table
@ -162,7 +163,7 @@
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="20"> <el-col :span="20">
<el-form-item> <el-form-item prop="remark">
<el-input v-model="form.remark" <el-input v-model="form.remark"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4}"
type="textarea" type="textarea"
@ -177,7 +178,7 @@
<template v-slot:footer> <template v-slot:footer>
<el-switch <el-switch
v-model="isCreateContinue" v-model="isCreateContinue"
active-text="保存并继续创建"> :active-text="$t('test_track.case.save_create_continue')">
</el-switch> </el-switch>
<ms-dialog-footer v-if="!readOnly" <ms-dialog-footer v-if="!readOnly"
@cancel="dialogFormVisible = false" @cancel="dialogFormVisible = false"
@ -231,7 +232,8 @@
maintainer :[{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], maintainer :[{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
priority :[{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}], priority :[{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
type :[{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}], type :[{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
method :[{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}] method :[{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
remark :[{ max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
}, },
formLabelWidth: "120px", formLabelWidth: "120px",
operationType: '', operationType: '',
@ -296,7 +298,7 @@
step.num ++; step.num ++;
} }
}); });
this.form.steps.push(step); this.form.steps.splice(index + 1, 0, step);
}, },
handleDeleteStep(index, data) { handleDeleteStep(index, data) {
this.form.steps.splice(index, 1); this.form.steps.splice(index, 1);
@ -311,6 +313,16 @@
if (valid) { if (valid) {
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
for (let i = 0; i < param.steps.length; i++){
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
(param.steps[i].result && param.steps[i].result.length > 300)) {
this.$warning(this.$t('test_track.case.step_desc') + ","
+ this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300');
return;
}
}
param.steps = JSON.stringify(this.form.steps); param.steps = JSON.stringify(this.form.steps);
param.nodeId = this.form.module; param.nodeId = this.form.module;
this.moduleOptions.forEach(item => { this.moduleOptions.forEach(item => {

View File

@ -141,7 +141,8 @@
priorityFilters: [ priorityFilters: [
{text: 'P0', value: 'P0'}, {text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'}, {text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'} {text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
], ],
methodFilters: [ methodFilters: [
{text: this.$t('test_track.case.manual'), value: 'manual'}, {text: this.$t('test_track.case.manual'), value: 'manual'},

View File

@ -222,12 +222,19 @@
param.id = this.testCase.id; param.id = this.testCase.id;
param.status = this.testCase.status; param.status = this.testCase.status;
param.results = []; param.results = [];
this.testCase.steptResults.forEach(item => {
for (let i = 0; i < this.testCase.steptResults.length; i++){
let result = {}; let result = {};
result.actualResult = item.actualResult; result.actualResult = this.testCase.steptResults[i].actualResult;
result.executeResult = item.executeResult; result.executeResult = this.testCase.steptResults[i].executeResult;
if (result.actualResult && result.actualResult.length > 300) {
this.$warning(this.$t('test_track.plan_view.actual_result')
+ this.$t('test_track.length_less_than') + '300');
return;
}
param.results.push(result); param.results.push(result);
}); }
param.results = JSON.stringify(param.results); param.results = JSON.stringify(param.results);
param.issues = JSON.stringify(this.testCase.issues); param.issues = JSON.stringify(this.testCase.issues);
this.$post('/test/plan/case/edit', param, () => { this.$post('/test/plan/case/edit', param, () => {

View File

@ -375,6 +375,7 @@ export default {
input_prerequisite: "Please select prerequisite", input_prerequisite: "Please select prerequisite",
delete_confirm: "Confirm delete test case", delete_confirm: "Confirm delete test case",
delete: "Delete case", delete: "Delete case",
save_create_continue: "Save and create continue",
import: { import: {
import: "Import test case", import: "Import test case",
case_import: "Import test case", case_import: "Import test case",
@ -500,6 +501,10 @@ export default {
'SMTP_port': 'SMTP port', 'SMTP_port': 'SMTP port',
'SMTP_account': 'SMTP account', 'SMTP_account': 'SMTP account',
'SMTP_password': 'SMTP password', 'SMTP_password': 'SMTP password',
'SSL': 'Turn on SSL (if the SMTP port is 465, you usually need to enable SSL)',
'TLS': 'Turn on TLS (if the SMTP port is 587, you usually need to enable TLS)',
'SMTP': 'Anonymous SMTP or not',
}, },
i18n: { i18n: {
'home': 'Home' 'home': 'Home'

View File

@ -372,6 +372,7 @@ export default {
input_prerequisite: "请输入前置条件", input_prerequisite: "请输入前置条件",
delete_confirm: "确认删除测试用例", delete_confirm: "确认删除测试用例",
delete: "删除用例", delete: "删除用例",
save_create_continue: "保存并继续创建",
import: { import: {
import: "导入用例", import: "导入用例",
case_import: "导入测试用例", case_import: "导入测试用例",
@ -497,6 +498,9 @@ export default {
'SMTP_port': 'SMTP端口', 'SMTP_port': 'SMTP端口',
'SMTP_account': 'SMTP账户', 'SMTP_account': 'SMTP账户',
'SMTP_password': 'SMTP密码', 'SMTP_password': 'SMTP密码',
'SSL': '开启SSL(如果SMTP端口是465通常需要启用SSL)',
'TLS': '开启TLS(如果SMTP端口是587通常需要启用TLS)',
'SMTP': '是否匿名 SMTP',
}, },
i18n: { i18n: {
'home': '首页' 'home': '首页'

View File

@ -366,6 +366,7 @@ export default {
input_prerequisite: "請輸入前置條件", input_prerequisite: "請輸入前置條件",
delete_confirm: "確認刪除測試用例: ", delete_confirm: "確認刪除測試用例: ",
delete: "删除用例", delete: "删除用例",
save_create_continue: "保存並繼續創建",
import: { import: {
import: "導入用例", import: "導入用例",
case_import: "導入測試用例", case_import: "導入測試用例",