From b87fa51440b404917ff48f6e96bb359f4e88662c Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 29 Apr 2020 16:38:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E5=90=8E?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/domain/TestCaseReport.java | 47 ++ .../base/domain/TestCaseReportExample.java | 400 ++++++++++++++++++ .../base/domain/TestCaseReportTemplate.java | 47 ++ .../domain/TestCaseReportTemplateExample.java | 400 ++++++++++++++++++ .../base/mapper/TestCaseReportMapper.java | 36 ++ .../base/mapper/TestCaseReportMapper.xml | 234 ++++++++++ .../mapper/TestCaseReportTemplateMapper.java | 36 ++ .../mapper/TestCaseReportTemplateMapper.xml | 234 ++++++++++ .../controller/TestCaseReportController.java | 42 ++ .../TestCaseReportTemplateController.java | 42 ++ .../service/TestCaseReportService.java | 46 ++ .../TestCaseReportTemplateService.java | 48 +++ .../db/migration/V2__metersphere_ddl.sql | 2 +- 13 files changed, 1613 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseReport.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseReportExample.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplate.java create mode 100644 backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplateExample.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.xml create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.xml create mode 100644 backend/src/main/java/io/metersphere/controller/TestCaseReportController.java create mode 100644 backend/src/main/java/io/metersphere/controller/TestCaseReportTemplateController.java create mode 100644 backend/src/main/java/io/metersphere/service/TestCaseReportService.java create mode 100644 backend/src/main/java/io/metersphere/service/TestCaseReportTemplateService.java diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReport.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReport.java new file mode 100644 index 000000000..b70e93cbf --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReport.java @@ -0,0 +1,47 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; + +public class TestCaseReport implements Serializable { + private Long id; + + private String name; + + private String planId; + + private String content; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getPlanId() { + return planId; + } + + public void setPlanId(String planId) { + this.planId = planId == null ? null : planId.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReportExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportExample.java new file mode 100644 index 000000000..f43ff0744 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportExample.java @@ -0,0 +1,400 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestCaseReportExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestCaseReportExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andPlanIdIsNull() { + addCriterion("plan_id is null"); + return (Criteria) this; + } + + public Criteria andPlanIdIsNotNull() { + addCriterion("plan_id is not null"); + return (Criteria) this; + } + + public Criteria andPlanIdEqualTo(String value) { + addCriterion("plan_id =", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdNotEqualTo(String value) { + addCriterion("plan_id <>", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdGreaterThan(String value) { + addCriterion("plan_id >", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdGreaterThanOrEqualTo(String value) { + addCriterion("plan_id >=", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdLessThan(String value) { + addCriterion("plan_id <", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdLessThanOrEqualTo(String value) { + addCriterion("plan_id <=", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdLike(String value) { + addCriterion("plan_id like", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdNotLike(String value) { + addCriterion("plan_id not like", value, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdIn(List values) { + addCriterion("plan_id in", values, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdNotIn(List values) { + addCriterion("plan_id not in", values, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdBetween(String value1, String value2) { + addCriterion("plan_id between", value1, value2, "planId"); + return (Criteria) this; + } + + public Criteria andPlanIdNotBetween(String value1, String value2) { + addCriterion("plan_id not between", value1, value2, "planId"); + 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplate.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplate.java new file mode 100644 index 000000000..05220801f --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplate.java @@ -0,0 +1,47 @@ +package io.metersphere.base.domain; + +import java.io.Serializable; + +public class TestCaseReportTemplate implements Serializable { + private Long id; + + private String name; + + private String workspaceId; + + private String content; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId == null ? null : workspaceId.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplateExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplateExample.java new file mode 100644 index 000000000..a0c5b96a6 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseReportTemplateExample.java @@ -0,0 +1,400 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestCaseReportTemplateExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestCaseReportTemplateExample() { + oredCriteria = new ArrayList(); + } + + 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNull() { + addCriterion("workspace_id is null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIsNotNull() { + addCriterion("workspace_id is not null"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdEqualTo(String value) { + addCriterion("workspace_id =", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotEqualTo(String value) { + addCriterion("workspace_id <>", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThan(String value) { + addCriterion("workspace_id >", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) { + addCriterion("workspace_id >=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThan(String value) { + addCriterion("workspace_id <", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLessThanOrEqualTo(String value) { + addCriterion("workspace_id <=", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdLike(String value) { + addCriterion("workspace_id like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotLike(String value) { + addCriterion("workspace_id not like", value, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdIn(List values) { + addCriterion("workspace_id in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotIn(List values) { + addCriterion("workspace_id not in", values, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdBetween(String value1, String value2) { + addCriterion("workspace_id between", value1, value2, "workspaceId"); + return (Criteria) this; + } + + public Criteria andWorkspaceIdNotBetween(String value1, String value2) { + addCriterion("workspace_id not between", value1, value2, "workspaceId"); + 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); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.java new file mode 100644 index 000000000..76a5e5cb1 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.java @@ -0,0 +1,36 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.TestCaseReport; +import io.metersphere.base.domain.TestCaseReportExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface TestCaseReportMapper { + long countByExample(TestCaseReportExample example); + + int deleteByExample(TestCaseReportExample example); + + int deleteByPrimaryKey(Long id); + + int insert(TestCaseReport record); + + int insertSelective(TestCaseReport record); + + List selectByExampleWithBLOBs(TestCaseReportExample example); + + List selectByExample(TestCaseReportExample example); + + TestCaseReport selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") TestCaseReport record, @Param("example") TestCaseReportExample example); + + int updateByExampleWithBLOBs(@Param("record") TestCaseReport record, @Param("example") TestCaseReportExample example); + + int updateByExample(@Param("record") TestCaseReport record, @Param("example") TestCaseReportExample example); + + int updateByPrimaryKeySelective(TestCaseReport record); + + int updateByPrimaryKeyWithBLOBs(TestCaseReport record); + + int updateByPrimaryKey(TestCaseReport record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.xml new file mode 100644 index 000000000..83b9a9843 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportMapper.xml @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, plan_id + + + content + + + + + + delete from test_case_report + where id = #{id,jdbcType=BIGINT} + + + delete from test_case_report + + + + + + + SELECT LAST_INSERT_ID() + + insert into test_case_report (name, plan_id, content + ) + values (#{name,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into test_case_report + + + name, + + + plan_id, + + + content, + + + + + #{name,jdbcType=VARCHAR}, + + + #{planId,jdbcType=VARCHAR}, + + + #{content,jdbcType=LONGVARCHAR}, + + + + + + update test_case_report + + + id = #{record.id,jdbcType=BIGINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + plan_id = #{record.planId,jdbcType=VARCHAR}, + + + content = #{record.content,jdbcType=LONGVARCHAR}, + + + + + + + + update test_case_report + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + plan_id = #{record.planId,jdbcType=VARCHAR}, + content = #{record.content,jdbcType=LONGVARCHAR} + + + + + + update test_case_report + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + plan_id = #{record.planId,jdbcType=VARCHAR} + + + + + + update test_case_report + + + name = #{name,jdbcType=VARCHAR}, + + + plan_id = #{planId,jdbcType=VARCHAR}, + + + content = #{content,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update test_case_report + set name = #{name,jdbcType=VARCHAR}, + plan_id = #{planId,jdbcType=VARCHAR}, + content = #{content,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update test_case_report + set name = #{name,jdbcType=VARCHAR}, + plan_id = #{planId,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.java new file mode 100644 index 000000000..5c589133a --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.java @@ -0,0 +1,36 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.TestCaseReportTemplate; +import io.metersphere.base.domain.TestCaseReportTemplateExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface TestCaseReportTemplateMapper { + long countByExample(TestCaseReportTemplateExample example); + + int deleteByExample(TestCaseReportTemplateExample example); + + int deleteByPrimaryKey(Long id); + + int insert(TestCaseReportTemplate record); + + int insertSelective(TestCaseReportTemplate record); + + List selectByExampleWithBLOBs(TestCaseReportTemplateExample example); + + List selectByExample(TestCaseReportTemplateExample example); + + TestCaseReportTemplate selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") TestCaseReportTemplate record, @Param("example") TestCaseReportTemplateExample example); + + int updateByExampleWithBLOBs(@Param("record") TestCaseReportTemplate record, @Param("example") TestCaseReportTemplateExample example); + + int updateByExample(@Param("record") TestCaseReportTemplate record, @Param("example") TestCaseReportTemplateExample example); + + int updateByPrimaryKeySelective(TestCaseReportTemplate record); + + int updateByPrimaryKeyWithBLOBs(TestCaseReportTemplate record); + + int updateByPrimaryKey(TestCaseReportTemplate record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.xml new file mode 100644 index 000000000..69175ac67 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReportTemplateMapper.xml @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, workspace_id + + + content + + + + + + delete from test_case_report_template + where id = #{id,jdbcType=BIGINT} + + + delete from test_case_report_template + + + + + + + SELECT LAST_INSERT_ID() + + insert into test_case_report_template (name, workspace_id, content + ) + values (#{name,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into test_case_report_template + + + name, + + + workspace_id, + + + content, + + + + + #{name,jdbcType=VARCHAR}, + + + #{workspaceId,jdbcType=VARCHAR}, + + + #{content,jdbcType=LONGVARCHAR}, + + + + + + update test_case_report_template + + + id = #{record.id,jdbcType=BIGINT}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + + + content = #{record.content,jdbcType=LONGVARCHAR}, + + + + + + + + update test_case_report_template + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, + content = #{record.content,jdbcType=LONGVARCHAR} + + + + + + update test_case_report_template + set id = #{record.id,jdbcType=BIGINT}, + name = #{record.name,jdbcType=VARCHAR}, + workspace_id = #{record.workspaceId,jdbcType=VARCHAR} + + + + + + update test_case_report_template + + + name = #{name,jdbcType=VARCHAR}, + + + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + + + content = #{content,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update test_case_report_template + set name = #{name,jdbcType=VARCHAR}, + workspace_id = #{workspaceId,jdbcType=VARCHAR}, + content = #{content,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update test_case_report_template + set name = #{name,jdbcType=VARCHAR}, + workspace_id = #{workspaceId,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseReportController.java b/backend/src/main/java/io/metersphere/controller/TestCaseReportController.java new file mode 100644 index 000000000..5d527b750 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/TestCaseReportController.java @@ -0,0 +1,42 @@ +package io.metersphere.controller; + +import io.metersphere.base.domain.TestCaseReport; +import io.metersphere.service.TestCaseReportService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RequestMapping("/case/report") +@RestController +public class TestCaseReportController { + + @Resource + TestCaseReportService testCaseReportService; + + @PostMapping("/list") + public List list(@RequestBody TestCaseReport request) { + return testCaseReportService.listTestCaseReport(request); + } + + @GetMapping("/get/{id}") + public TestCaseReport get(@PathVariable Long id){ + return testCaseReportService.getTestCaseReport(id); + } + + @PostMapping("/add") + public void add(@RequestBody TestCaseReport TestCaseReport){ + testCaseReportService.addTestCaseReport(TestCaseReport); + } + + @PostMapping("/edit") + public void edit(@RequestBody TestCaseReport TestCaseReport){ + testCaseReportService.editTestCaseReport(TestCaseReport); + } + + @PostMapping("/delete/{id}") + public int delete(@PathVariable Long id){ + return testCaseReportService.deleteTestCaseReport(id); + } + +} diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseReportTemplateController.java b/backend/src/main/java/io/metersphere/controller/TestCaseReportTemplateController.java new file mode 100644 index 000000000..b090d7f77 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/TestCaseReportTemplateController.java @@ -0,0 +1,42 @@ +package io.metersphere.controller; + +import io.metersphere.base.domain.TestCaseReportTemplate; +import io.metersphere.service.TestCaseReportTemplateService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RequestMapping("/case/report/template") +@RestController +public class TestCaseReportTemplateController { + + @Resource + TestCaseReportTemplateService testCaseReportTemplateService; + + @PostMapping("/list") + public List list(@RequestBody TestCaseReportTemplate request) { + return testCaseReportTemplateService.listTestCaseReportTemplate(request); + } + + @GetMapping("/get/{id}") + public TestCaseReportTemplate get(@PathVariable Long id){ + return testCaseReportTemplateService.getTestCaseReportTemplate(id); + } + + @PostMapping("/add") + public void add(@RequestBody TestCaseReportTemplate testCaseReportTemplate){ + testCaseReportTemplateService.addTestCaseReportTemplate(testCaseReportTemplate); + } + + @PostMapping("/edit") + public void edit(@RequestBody TestCaseReportTemplate testCaseReportTemplate){ + testCaseReportTemplateService.editTestCaseReportTemplate(testCaseReportTemplate); + } + + @PostMapping("/delete/{id}") + public int delete(@PathVariable Long id){ + return testCaseReportTemplateService.deleteTestCaseReportTemplate(id); + } + +} diff --git a/backend/src/main/java/io/metersphere/service/TestCaseReportService.java b/backend/src/main/java/io/metersphere/service/TestCaseReportService.java new file mode 100644 index 000000000..605234c43 --- /dev/null +++ b/backend/src/main/java/io/metersphere/service/TestCaseReportService.java @@ -0,0 +1,46 @@ +package io.metersphere.service; + +import io.metersphere.base.domain.TestCaseReport; +import io.metersphere.base.domain.TestCaseReportExample; +import io.metersphere.base.mapper.TestCaseReportMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class TestCaseReportService { + + @Resource + TestCaseReportMapper testCaseReportMapper; + + public List listTestCaseReport(TestCaseReport request) { + TestCaseReportExample example = new TestCaseReportExample(); + if ( StringUtils.isNotBlank(request.getName()) ) { + example.createCriteria().andNameEqualTo(request.getName()); + } + if ( StringUtils.isNotBlank(request.getPlanId()) ) { + example.createCriteria().andPlanIdEqualTo(request.getPlanId()); + } + return testCaseReportMapper.selectByExample(example); + } + + public TestCaseReport getTestCaseReport(Long id) { + return testCaseReportMapper.selectByPrimaryKey(id); + } + + public void addTestCaseReport(TestCaseReport TestCaseReport) { + testCaseReportMapper.insert(TestCaseReport); + } + + public void editTestCaseReport(TestCaseReport TestCaseReport) { + testCaseReportMapper.updateByPrimaryKeyWithBLOBs(TestCaseReport); + } + + public int deleteTestCaseReport(Long id) { + return testCaseReportMapper.deleteByPrimaryKey(id); + } +} diff --git a/backend/src/main/java/io/metersphere/service/TestCaseReportTemplateService.java b/backend/src/main/java/io/metersphere/service/TestCaseReportTemplateService.java new file mode 100644 index 000000000..3e0fcd556 --- /dev/null +++ b/backend/src/main/java/io/metersphere/service/TestCaseReportTemplateService.java @@ -0,0 +1,48 @@ +package io.metersphere.service; + +import io.metersphere.base.domain.TestCaseReportTemplate; +import io.metersphere.base.domain.TestCaseReportTemplateExample; +import io.metersphere.base.mapper.TestCaseReportMapper; +import io.metersphere.base.mapper.TestCaseReportTemplateMapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class TestCaseReportTemplateService { + + @Resource + TestCaseReportTemplateMapper testCaseReportTemplateMapper; + + public List listTestCaseReportTemplate(TestCaseReportTemplate request) { + TestCaseReportTemplateExample example = new TestCaseReportTemplateExample(); + if ( StringUtils.isNotBlank(request.getName()) ) { + example.createCriteria().andNameEqualTo(request.getName()); + } + if ( StringUtils.isNotBlank(request.getWorkspaceId()) ) { + example.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId()); + } + return testCaseReportTemplateMapper.selectByExample(example); + } + + public TestCaseReportTemplate getTestCaseReportTemplate(Long id) { + return testCaseReportTemplateMapper.selectByPrimaryKey(id); + } + + public void addTestCaseReportTemplate(TestCaseReportTemplate testCaseReportTemplate) { + testCaseReportTemplateMapper.insert(testCaseReportTemplate); + } + + public void editTestCaseReportTemplate(TestCaseReportTemplate testCaseReportTemplate) { + testCaseReportTemplateMapper.updateByPrimaryKeyWithBLOBs(testCaseReportTemplate); + } + + public int deleteTestCaseReportTemplate(Long id) { + return testCaseReportTemplateMapper.deleteByPrimaryKey(id); + } + +} diff --git a/backend/src/main/resources/db/migration/V2__metersphere_ddl.sql b/backend/src/main/resources/db/migration/V2__metersphere_ddl.sql index b7a3f1a2c..45ae18351 100644 --- a/backend/src/main/resources/db/migration/V2__metersphere_ddl.sql +++ b/backend/src/main/resources/db/migration/V2__metersphere_ddl.sql @@ -341,7 +341,7 @@ CREATE TABLE IF NOT EXISTS `test_case_report_template` ( CREATE TABLE IF NOT EXISTS `test_case_report` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL COMMENT 'Test case report name', - `plan_id` bigint(50) DEFAULT NULL COMMENT 'Plan ID relation to', + `plan_id` varchar(50) NOT NULL COMMENT 'Plan ID relation to', `content` longtext COMMENT 'Report content (JSON format)', PRIMARY KEY (`id`) ) -- GitLab