压缩报告

This commit is contained in:
q4speed 2020-05-26 12:14:50 +08:00
parent b6fef27f69
commit 7cba4604da
13 changed files with 730 additions and 125 deletions

View File

@ -13,4 +13,6 @@ public class APIReportResult extends ApiTestReport {
private String projectName; private String projectName;
private String userName; private String userName;
private String content;
} }

View File

@ -5,9 +5,8 @@ import io.metersphere.api.dto.APIReportResult;
import io.metersphere.api.dto.DeleteAPIReportRequest; import io.metersphere.api.dto.DeleteAPIReportRequest;
import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.QueryAPIReportRequest;
import io.metersphere.api.jmeter.TestResult; import io.metersphere.api.jmeter.TestResult;
import io.metersphere.base.domain.ApiTest; import io.metersphere.base.domain.*;
import io.metersphere.base.domain.ApiTestReport; import io.metersphere.base.mapper.ApiTestReportDetailMapper;
import io.metersphere.base.domain.ApiTestReportExample;
import io.metersphere.base.mapper.ApiTestReportMapper; import io.metersphere.base.mapper.ApiTestReportMapper;
import io.metersphere.base.mapper.ext.ExtApiTestReportMapper; import io.metersphere.base.mapper.ext.ExtApiTestReportMapper;
import io.metersphere.commons.constants.APITestStatus; import io.metersphere.commons.constants.APITestStatus;
@ -18,6 +17,7 @@ import io.metersphere.i18n.Translator;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.StandardCharsets;
import java.time.Instant; import java.time.Instant;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.List; import java.util.List;
@ -33,6 +33,8 @@ public class APIReportService {
@Resource @Resource
private ApiTestReportMapper apiTestReportMapper; private ApiTestReportMapper apiTestReportMapper;
@Resource @Resource
private ApiTestReportDetailMapper apiTestReportDetailMapper;
@Resource
private ExtApiTestReportMapper extApiTestReportMapper; private ExtApiTestReportMapper extApiTestReportMapper;
public List<APIReportResult> list(QueryAPIReportRequest request) { public List<APIReportResult> list(QueryAPIReportRequest request) {
@ -44,7 +46,12 @@ public class APIReportService {
} }
public APIReportResult get(String reportId) { public APIReportResult get(String reportId) {
return extApiTestReportMapper.get(reportId); APIReportResult result = extApiTestReportMapper.get(reportId);
ApiTestReportDetail detail = apiTestReportDetailMapper.selectByPrimaryKey(reportId);
if (detail != null) {
result.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
}
return result;
} }
public List<APIReportResult> listByTestId(String testId) { public List<APIReportResult> listByTestId(String testId) {
@ -52,6 +59,7 @@ public class APIReportService {
} }
public void delete(DeleteAPIReportRequest request) { public void delete(DeleteAPIReportRequest request) {
apiTestReportDetailMapper.deleteByPrimaryKey(request.getId());
apiTestReportMapper.deleteByPrimaryKey(request.getId()); apiTestReportMapper.deleteByPrimaryKey(request.getId());
} }
@ -59,6 +67,10 @@ public class APIReportService {
ApiTestReportExample example = new ApiTestReportExample(); ApiTestReportExample example = new ApiTestReportExample();
example.createCriteria().andTestIdEqualTo(testId); example.createCriteria().andTestIdEqualTo(testId);
apiTestReportMapper.deleteByExample(example); apiTestReportMapper.deleteByExample(example);
ApiTestReportDetailExample detailExample = new ApiTestReportDetailExample();
detailExample.createCriteria().andTestIdEqualTo(testId);
apiTestReportDetailMapper.deleteByExample(detailExample);
} }
public void complete(TestResult result) { public void complete(TestResult result) {
@ -66,7 +78,14 @@ public class APIReportService {
if (report == null) { if (report == null) {
MSException.throwException(Translator.get("api_report_is_null")); MSException.throwException(Translator.get("api_report_is_null"));
} }
report.setContent(JSONObject.toJSONString(result)); // report detail
ApiTestReportDetail detail = new ApiTestReportDetail();
detail.setReportId(report.getId());
detail.setTestId(report.getTestId());
detail.setContent(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8));
apiTestReportDetailMapper.insert(detail);
// report
report.setUpdateTime(System.currentTimeMillis()); report.setUpdateTime(System.currentTimeMillis());
report.setStatus(APITestStatus.Completed.name()); report.setStatus(APITestStatus.Completed.name());
apiTestReportMapper.updateByPrimaryKeySelective(report); apiTestReportMapper.updateByPrimaryKeySelective(report);

View File

@ -21,7 +21,5 @@ public class ApiTestReport implements Serializable {
private String userId; private String userId;
private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -0,0 +1,15 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiTestReportDetail implements Serializable {
private String reportId;
private String testId;
private byte[] content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,340 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class ApiTestReportDetailExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public ApiTestReportDetailExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andReportIdIsNull() {
addCriterion("report_id is null");
return (Criteria) this;
}
public Criteria andReportIdIsNotNull() {
addCriterion("report_id is not null");
return (Criteria) this;
}
public Criteria andReportIdEqualTo(String value) {
addCriterion("report_id =", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdNotEqualTo(String value) {
addCriterion("report_id <>", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdGreaterThan(String value) {
addCriterion("report_id >", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdGreaterThanOrEqualTo(String value) {
addCriterion("report_id >=", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdLessThan(String value) {
addCriterion("report_id <", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdLessThanOrEqualTo(String value) {
addCriterion("report_id <=", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdLike(String value) {
addCriterion("report_id like", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdNotLike(String value) {
addCriterion("report_id not like", value, "reportId");
return (Criteria) this;
}
public Criteria andReportIdIn(List<String> values) {
addCriterion("report_id in", values, "reportId");
return (Criteria) this;
}
public Criteria andReportIdNotIn(List<String> values) {
addCriterion("report_id not in", values, "reportId");
return (Criteria) this;
}
public Criteria andReportIdBetween(String value1, String value2) {
addCriterion("report_id between", value1, value2, "reportId");
return (Criteria) this;
}
public Criteria andReportIdNotBetween(String value1, String value2) {
addCriterion("report_id not between", value1, value2, "reportId");
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,36 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTestReportDetail;
import io.metersphere.base.domain.ApiTestReportDetailExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTestReportDetailMapper {
long countByExample(ApiTestReportDetailExample example);
int deleteByExample(ApiTestReportDetailExample example);
int deleteByPrimaryKey(String reportId);
int insert(ApiTestReportDetail record);
int insertSelective(ApiTestReportDetail record);
List<ApiTestReportDetail> selectByExampleWithBLOBs(ApiTestReportDetailExample example);
List<ApiTestReportDetail> selectByExample(ApiTestReportDetailExample example);
ApiTestReportDetail selectByPrimaryKey(String reportId);
int updateByExampleSelective(@Param("record") ApiTestReportDetail record, @Param("example") ApiTestReportDetailExample example);
int updateByExampleWithBLOBs(@Param("record") ApiTestReportDetail record, @Param("example") ApiTestReportDetailExample example);
int updateByExample(@Param("record") ApiTestReportDetail record, @Param("example") ApiTestReportDetailExample example);
int updateByPrimaryKeySelective(ApiTestReportDetail record);
int updateByPrimaryKeyWithBLOBs(ApiTestReportDetail record);
int updateByPrimaryKey(ApiTestReportDetail record);
}

View File

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

View File

@ -16,21 +16,15 @@ public interface ApiTestReportMapper {
int insertSelective(ApiTestReport record); int insertSelective(ApiTestReport record);
List<ApiTestReport> selectByExampleWithBLOBs(ApiTestReportExample example);
List<ApiTestReport> selectByExample(ApiTestReportExample example); List<ApiTestReport> selectByExample(ApiTestReportExample example);
ApiTestReport selectByPrimaryKey(String id); ApiTestReport selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example); int updateByExampleSelective(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByExampleWithBLOBs(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByExample(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example); int updateByExample(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByPrimaryKeySelective(ApiTestReport record); int updateByPrimaryKeySelective(ApiTestReport record);
int updateByPrimaryKeyWithBLOBs(ApiTestReport record);
int updateByPrimaryKey(ApiTestReport record); int updateByPrimaryKey(ApiTestReport record);
} }

View File

@ -11,9 +11,6 @@
<result column="status" jdbcType="VARCHAR" property="status" /> <result column="status" jdbcType="VARCHAR" property="status" />
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestReport">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
@ -75,25 +72,6 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, test_id, name, description, create_time, update_time, status, user_id id, test_id, name, description, create_time, update_time, status, user_id
</sql> </sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_test_report
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
@ -108,11 +86,9 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from api_test_report from api_test_report
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
@ -129,12 +105,10 @@
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestReport"> <insert id="insert" parameterType="io.metersphere.base.domain.ApiTestReport">
insert into api_test_report (id, test_id, name, insert into api_test_report (id, test_id, name,
description, create_time, update_time, description, create_time, update_time,
status, user_id, content status, user_id)
)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR} #{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR})
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestReport"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestReport">
insert into api_test_report insert into api_test_report
@ -163,9 +137,6 @@
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</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">
@ -192,9 +163,6 @@
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
</if> </if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultType="java.lang.Long">
@ -230,29 +198,11 @@
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
</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 api_test_report
set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
status = #{record.status,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update api_test_report update api_test_report
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
@ -291,24 +241,9 @@
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
</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.ApiTestReport">
update api_test_report
set test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
status = #{status,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestReport"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestReport">
update api_test_report update api_test_report
set test_id = #{testId,jdbcType=VARCHAR}, set test_id = #{testId,jdbcType=VARCHAR},

View File

@ -46,7 +46,7 @@
<select id="get" resultMap="BaseResultMap"> <select id="get" resultMap="BaseResultMap">
SELECT r.*, t.name AS test_name, project.name AS project_name, user.name AS user_name SELECT r.*, t.name AS test_name, project.name AS project_name, user.name AS user_name
FROM api_test_report r JOIN api_test t ON r.test_id = t.id FROM api_test_report r JOIN api_test t ON r.test_id = t.id
JOIN project ON project.id = t.project_id LEFT JOIN project ON project.id = t.project_id
LEFT JOIN user ON user.id = r.user_id LEFT JOIN user ON user.id = r.user_id
<where> <where>
r.id = #{id} r.id = #{id}

View File

@ -2,17 +2,15 @@ package io.metersphere.commons.utils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.zip.ZipEntry; import java.util.zip.*;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
public class CompressUtils { public class CompressUtils {
/*** /***
* 压缩Zip * Zip压缩
* *
* @param data * @param data 待压缩数据
* @return * @return 压缩后数据
*/ */
public static Object zip(Object data) { public static Object zip(Object data) {
if (!(data instanceof byte[])) { if (!(data instanceof byte[])) {
@ -40,10 +38,10 @@ public class CompressUtils {
} }
/*** /***
* 解压Zip * Zip解压
* *
* @param data * @param data 待解压数据
* @return * @return 解压后数据
*/ */
public static Object unzip(Object data) { public static Object unzip(Object data) {
if (!(data instanceof byte[])) { if (!(data instanceof byte[])) {
@ -72,4 +70,54 @@ public class CompressUtils {
} }
return b; return b;
} }
/**
* GZip压缩
*
* @param data 待压缩数据
* @return 压缩后数
*/
public static Object compress(Object data) {
if (!(data instanceof byte[])) {
return data;
}
byte[] bytes = (byte[]) data;
try (ByteArrayOutputStream obj = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(obj)) {
gzip.write(bytes);
gzip.flush();
gzip.finish();
return obj.toByteArray();
} catch (Exception e) {
LogUtil.error(e);
return data;
}
}
/**
* GZip解压
*
* @param data 待解压数据
* @return 解压后数据
*/
public static Object decompress(Object data) {
if (!(data instanceof byte[])) {
return data;
}
byte[] bytes = (byte[]) data;
if (bytes.length == 0) {
return bytes;
}
try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
byte[] buffer = new byte[8192];
int len;
while ((len = gis.read(buffer)) > 0) {
baos.write(buffer, 0, len);
}
baos.flush();
return baos.toByteArray();
} catch (Exception e) {
LogUtil.error(e);
return data;
}
}
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.config; package io.metersphere.config;
import com.github.pagehelper.PageInterceptor; import com.github.pagehelper.PageInterceptor;
import io.metersphere.base.domain.ApiTestReportDetail;
import io.metersphere.base.domain.FileContent; import io.metersphere.base.domain.FileContent;
import io.metersphere.base.domain.TestResource; import io.metersphere.base.domain.TestResource;
import io.metersphere.commons.utils.CompressUtils; import io.metersphere.commons.utils.CompressUtils;
@ -41,6 +42,7 @@ public class MybatisConfig {
MybatisInterceptor interceptor = new MybatisInterceptor(); MybatisInterceptor interceptor = new MybatisInterceptor();
List<MybatisInterceptorConfig> configList = new ArrayList<>(); List<MybatisInterceptorConfig> configList = new ArrayList<>();
configList.add(new MybatisInterceptorConfig(FileContent.class, "file", CompressUtils.class, "zip", "unzip")); configList.add(new MybatisInterceptorConfig(FileContent.class, "file", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(ApiTestReportDetail.class, "content", CompressUtils.class, "compress", "decompress"));
configList.add(new MybatisInterceptorConfig(TestResource.class, "configuration")); configList.add(new MybatisInterceptorConfig(TestResource.class, "configuration"));
interceptor.setInterceptorConfigList(configList); interceptor.setInterceptorConfigList(configList);
return interceptor; return interceptor;

View File

@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS `file_content` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `file_metadata` ( CREATE TABLE IF NOT EXISTS `file_metadata` (
`id` varchar(64) NOT NULL COMMENT 'File ID', `id` varchar(64) NOT NULL COMMENT 'File ID',
@ -15,10 +15,7 @@ CREATE TABLE IF NOT EXISTS `file_metadata` (
`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',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin;
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
CREATE TABLE `load_test` ( CREATE TABLE `load_test` (
`id` varchar(50) NOT NULL COMMENT 'Test ID', `id` varchar(50) NOT NULL COMMENT 'Test ID',
@ -34,15 +31,13 @@ CREATE TABLE `load_test` (
`test_resource_pool_id` varchar(50) DEFAULT NULL, `test_resource_pool_id` varchar(50) DEFAULT NULL,
`user_id` varchar(64) DEFAULT NULL, `user_id` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `load_test_file` ( CREATE TABLE IF NOT EXISTS `load_test_file` (
`test_id` varchar(64) DEFAULT NULL, `test_id` varchar(64) DEFAULT NULL,
`file_id` varchar(64) DEFAULT NULL, `file_id` varchar(64) DEFAULT NULL,
UNIQUE KEY `load_test_file_unique_key` (`test_id`, `file_id`) UNIQUE KEY `load_test_file_unique_key` (`test_id`, `file_id`)
) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT ='测试和文件的关联表';
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='测试和文件的关联表';
CREATE TABLE `load_test_report` ( CREATE TABLE `load_test_report` (
`id` varchar(50) NOT NULL COMMENT 'Test report ID', `id` varchar(50) NOT NULL COMMENT 'Test report ID',
@ -54,14 +49,14 @@ CREATE TABLE `load_test_report` (
`status` varchar(64) NOT NULL COMMENT 'Status of this test run', `status` varchar(64) NOT NULL COMMENT 'Status of this test run',
`user_id` varchar(64) DEFAULT NULL, `user_id` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin;
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,
`part` bigint(11) NOT NULL, `part` bigint(11) NOT NULL,
PRIMARY KEY (`report_id`,`part`) PRIMARY KEY (`report_id`,`part`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB 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,
@ -71,7 +66,7 @@ CREATE TABLE IF NOT EXISTS `load_test_report_log` (
`part` bigint(20) DEFAULT NULL, `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`,`part`) KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`,`part`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) 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,
@ -80,7 +75,7 @@ CREATE TABLE IF NOT EXISTS `load_test_report_result` (
`report_value` text , `report_value` text ,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `load_test_report_result_report_id_report_key_index` (`report_id`,`report_key`) KEY `load_test_report_result_report_id_report_key_index` (`report_id`,`report_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `organization` ( CREATE TABLE IF NOT EXISTS `organization` (
@ -93,7 +88,7 @@ CREATE TABLE IF NOT EXISTS `organization` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `project` ( CREATE TABLE IF NOT EXISTS `project` (
`id` varchar(50) NOT NULL COMMENT 'Project ID', `id` varchar(50) NOT NULL COMMENT 'Project ID',
@ -106,7 +101,7 @@ CREATE TABLE IF NOT EXISTS `project` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `role` ( CREATE TABLE IF NOT EXISTS `role` (
`id` varchar(50) NOT NULL COMMENT 'Role ID', `id` varchar(50) NOT NULL COMMENT 'Role ID',
@ -119,7 +114,7 @@ CREATE TABLE IF NOT EXISTS `role` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `system_parameter` ( CREATE TABLE IF NOT EXISTS `system_parameter` (
`param_key` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT 'Parameter name', `param_key` varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT 'Parameter name',
@ -130,7 +125,7 @@ CREATE TABLE IF NOT EXISTS `system_parameter` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_resource` ( CREATE TABLE IF NOT EXISTS `test_resource` (
`id` varchar(50) NOT NULL COMMENT 'Test resource ID', `id` varchar(50) NOT NULL COMMENT 'Test resource ID',
@ -143,7 +138,7 @@ CREATE TABLE IF NOT EXISTS `test_resource` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_resource_pool` ( CREATE TABLE IF NOT EXISTS `test_resource_pool` (
`id` varchar(50) NOT NULL COMMENT 'Test resource pool ID', `id` varchar(50) NOT NULL COMMENT 'Test resource pool ID',
@ -157,7 +152,7 @@ CREATE TABLE IF NOT EXISTS `test_resource_pool` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `user` ( CREATE TABLE IF NOT EXISTS `user` (
`id` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT 'User ID', `id` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT 'User ID',
@ -175,7 +170,7 @@ CREATE TABLE IF NOT EXISTS `user` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `user_role` ( CREATE TABLE IF NOT EXISTS `user_role` (
`id` varchar(50) NOT NULL COMMENT 'ID of user''s role info', `id` varchar(50) NOT NULL COMMENT 'ID of user''s role info',
@ -188,7 +183,7 @@ CREATE TABLE IF NOT EXISTS `user_role` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `workspace` ( CREATE TABLE IF NOT EXISTS `workspace` (
`id` varchar(50) NOT NULL COMMENT 'Workspace ID ', `id` varchar(50) NOT NULL COMMENT 'Workspace ID ',
@ -201,7 +196,7 @@ CREATE TABLE IF NOT EXISTS `workspace` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
-- api start -- api start
@ -217,22 +212,19 @@ CREATE TABLE IF NOT EXISTS `api_test` (
`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',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `api_test_file` ( CREATE TABLE IF NOT EXISTS `api_test_file` (
`test_id` varchar(64) DEFAULT NULL, `test_id` varchar(64) DEFAULT NULL,
`file_id` varchar(64) DEFAULT NULL, `file_id` varchar(64) DEFAULT NULL,
UNIQUE KEY `api_test_file_unique_key` (`test_id`, `file_id`) UNIQUE KEY `api_test_file_unique_key` (`test_id`, `file_id`)
) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin COMMENT ='Api test test file relevance table';
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='Api test test file relevance table';
CREATE TABLE IF NOT EXISTS `api_test_report` ( CREATE TABLE IF NOT EXISTS `api_test_report` (
`id` varchar(50) NOT NULL COMMENT 'Test report ID', `id` varchar(50) NOT NULL COMMENT 'Test report ID',
`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',
@ -241,7 +233,14 @@ CREATE TABLE IF NOT EXISTS `api_test_report` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `api_test_report_detail` (
`report_id` varchar(64) NOT NULL COMMENT 'API Test Report ID',
`test_id` varchar(64) NOT NULL COMMENT 'Test ID',
`content` longblob COMMENT 'Report content',
PRIMARY KEY (`report_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin;
-- api end -- api end
@ -266,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `test_plan` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_case_node` ( CREATE TABLE IF NOT EXISTS `test_case_node` (
@ -281,7 +280,7 @@ CREATE TABLE IF NOT EXISTS `test_case_node` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_case` ( CREATE TABLE IF NOT EXISTS `test_case` (
@ -303,7 +302,7 @@ CREATE TABLE IF NOT EXISTS `test_case` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_plan_test_case` ( CREATE TABLE IF NOT EXISTS `test_plan_test_case` (
@ -321,7 +320,7 @@ CREATE TABLE IF NOT EXISTS `test_plan_test_case` (
) )
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_case_report_template` ( CREATE TABLE IF NOT EXISTS `test_case_report_template` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,
@ -332,7 +331,7 @@ CREATE TABLE IF NOT EXISTS `test_case_report_template` (
) )
ENGINE=InnoDB ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci; COLLATE=utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `test_case_report` ( CREATE TABLE IF NOT EXISTS `test_case_report` (
`id` varchar(50) NOT NULL, `id` varchar(50) NOT NULL,
@ -344,7 +343,7 @@ CREATE TABLE IF NOT EXISTS `test_case_report` (
) )
ENGINE=InnoDB ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci; COLLATE=utf8mb4_bin;
-- track end -- track end