feat(测试跟踪): 完成测试跟踪下所有模块的操作日志

This commit is contained in:
fit2-zhao 2021-05-18 18:43:51 +08:00 committed by fit2-zhao
parent b7a5282bb1
commit 2f8f24c08a
66 changed files with 1520 additions and 230 deletions

View File

@ -210,6 +210,7 @@ public class ApiAutomationController {
}
@PostMapping("/relevance")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#request)", msClass = ApiAutomationService.class)
public void testPlanRelevance(@RequestBody ApiCaseRelevanceRequest request) {
apiAutomationService.relevance(request);
}

View File

@ -273,6 +273,7 @@ public class ApiDefinitionController {
}
@PostMapping("/relevance")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#request)", msClass = ApiDefinitionService.class)
public void testPlanRelevance(@RequestBody ApiCaseRelevanceRequest request) {
apiDefinitionService.testPlanRelevance(request);
}

View File

@ -119,6 +119,8 @@ public class ApiAutomationService {
private ApiScenarioReportService apiScenarioReportService;
@Resource
private ProjectMapper projectMapper;
@Resource
private TestPlanMapper testPlanMapper;
public ApiScenarioWithBLOBs getDto(String id) {
return apiScenarioMapper.selectByPrimaryKey(id);
@ -1374,6 +1376,7 @@ public class ApiAutomationService {
}
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
testPlanApiScenario.setId(UUID.randomUUID().toString());
testPlanApiScenario.setCreateUser(SessionUtils.getUserId());
testPlanApiScenario.setApiScenarioId(id);
testPlanApiScenario.setTestPlanId(request.getPlanId());
testPlanApiScenario.setCreateTime(System.currentTimeMillis());
@ -1901,4 +1904,19 @@ public class ApiAutomationService {
}
return null;
}
public String getLogDetails(ApiCaseRelevanceRequest request) {
Map<String, List<String>> mapping = request.getMapping();
Set<String> set = mapping.keySet();
if (CollectionUtils.isNotEmpty(set)) {
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(new ArrayList<>(set));
List<ApiScenario> scenarios = apiScenarioMapper.selectByExample(example);
List<String> names = scenarios.stream().map(ApiScenario::getName).collect(Collectors.toList());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getSelectIds()), testPlan.getProjectId(), String.join(",", names), testPlan.getCreator(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -99,9 +99,11 @@ public class ApiDefinitionService {
@Resource
private EsbApiParamService esbApiParamService;
@Resource
ApiModuleMapper apiModuleMapper;
private ApiModuleMapper apiModuleMapper;
@Resource
private SystemParameterService systemParameterService;
@Resource
private TestPlanMapper testPlanMapper;
private static Cache cache = Cache.newHardMemoryCache(0, 3600 * 24);
@ -1129,4 +1131,17 @@ public class ApiDefinitionService {
return null;
}
public String getLogDetails(ApiCaseRelevanceRequest request) {
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andApiDefinitionIdIn(request.getSelectIds());
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(apiTestCases)) {
List<String> names = apiTestCases.stream().map(ApiTestCase::getName).collect(Collectors.toList());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getSelectIds()), testPlan.getProjectId(), String.join(",", names), testPlan.getCreator(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -407,6 +407,7 @@ public class ApiTestCaseService {
apiTestCases.forEach(apiTestCase -> {
TestPlanApiCase testPlanApiCase = new TestPlanApiCase();
testPlanApiCase.setId(UUID.randomUUID().toString());
testPlanApiCase.setCreateUser(SessionUtils.getUserId());
testPlanApiCase.setApiCaseId(apiTestCase.getId());
testPlanApiCase.setTestPlanId(request.getPlanId());
testPlanApiCase.setEnvironmentId(request.getEnvironmentId());

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestCaseReport implements Serializable {
private String id;
@ -13,6 +14,8 @@ public class TestCaseReport implements Serializable {
private Long endTime;
private String createUser;
private String content;
private static final long serialVersionUID = 1L;

View File

@ -175,72 +175,72 @@ public class TestCaseReportExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
@ -363,6 +363,76 @@ public class TestCaseReportExample {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestCaseReview implements Serializable {
private String id;
@ -23,6 +24,8 @@ public class TestCaseReview implements Serializable {
private String tags;
private String createUser;
private String description;
private static final long serialVersionUID = 1L;

View File

@ -703,6 +703,76 @@ public class TestCaseReviewExample {
addCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -21,5 +21,7 @@ public class TestCaseReviewTestCase implements Serializable {
private Long updateTime;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -643,6 +643,76 @@ public class TestCaseReviewTestCaseExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -19,5 +19,7 @@ public class TestPlanApiCase implements Serializable {
private Long updateTime;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -573,6 +573,76 @@ public class TestPlanApiCaseExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -23,6 +23,8 @@ public class TestPlanApiScenario implements Serializable {
private String reportId;
private String createUser;
private String environment;
private static final long serialVersionUID = 1L;

View File

@ -713,6 +713,76 @@ public class TestPlanApiScenarioExample {
addCriterion("report_id not between", value1, value2, "reportId");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestPlanLoadCase implements Serializable {
private String id;
@ -19,5 +20,7 @@ public class TestPlanLoadCase implements Serializable {
private Long updateTime;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -573,6 +573,76 @@ public class TestPlanLoadCaseExample {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -1,8 +1,9 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestPlanTestCase implements Serializable {
private String id;
@ -23,5 +24,7 @@ public class TestPlanTestCase implements Serializable {
private String reportId;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -713,6 +713,76 @@ public class TestPlanTestCaseExample {
addCriterion("report_id not between", value1, value2, "reportId");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
}
public Criteria andCreateUserIsNotNull() {
addCriterion("create_user is not null");
return (Criteria) this;
}
public Criteria andCreateUserEqualTo(String value) {
addCriterion("create_user =", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotEqualTo(String value) {
addCriterion("create_user <>", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThan(String value) {
addCriterion("create_user >", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserGreaterThanOrEqualTo(String value) {
addCriterion("create_user >=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThan(String value) {
addCriterion("create_user <", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLessThanOrEqualTo(String value) {
addCriterion("create_user <=", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserLike(String value) {
addCriterion("create_user like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotLike(String value) {
addCriterion("create_user not like", value, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserIn(List<String> values) {
addCriterion("create_user in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotIn(List<String> values) {
addCriterion("create_user not in", values, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserBetween(String value1, String value2) {
addCriterion("create_user between", value1, value2, "createUser");
return (Criteria) this;
}
public Criteria andCreateUserNotBetween(String value1, String value2) {
addCriterion("create_user not between", value1, value2, "createUser");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -6,6 +6,7 @@
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReport">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -69,7 +70,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, start_time, end_time
id, `name`, start_time, end_time, create_user
</sql>
<sql id="Blob_Column_List">
content
@ -123,10 +124,12 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReport">
insert into test_case_report (id, name, start_time,
end_time, content)
insert into test_case_report (id, `name`, start_time,
end_time, create_user, content
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
#{endTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReport">
insert into test_case_report
@ -135,7 +138,7 @@
id,
</if>
<if test="name != null">
name,
`name`,
</if>
<if test="startTime != null">
start_time,
@ -143,6 +146,9 @@
<if test="endTime != null">
end_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="content != null">
content,
</if>
@ -160,6 +166,9 @@
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
@ -178,7 +187,7 @@
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=BIGINT},
@ -186,6 +195,9 @@
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
@ -197,9 +209,10 @@
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_case_report
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -208,9 +221,10 @@
<update id="updateByExample" parameterType="map">
update test_case_report
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT}
end_time = #{record.endTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -219,7 +233,7 @@
update test_case_report
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
@ -227,6 +241,9 @@
<if test="endTime != null">
end_time = #{endTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
@ -235,17 +252,19 @@
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseReport">
update test_case_report
set name = #{name,jdbcType=VARCHAR},
set `name` = #{name,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReport">
update test_case_report
set name = #{name,jdbcType=VARCHAR},
set `name` = #{name,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT}
end_time = #{endTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -11,6 +11,7 @@
<result column="end_time" jdbcType="BIGINT" property="endTime" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReview">
<result column="description" jdbcType="LONGVARCHAR" property="description" />
@ -74,7 +75,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, creator, `status`, create_time, update_time, end_time, project_id, tags
id, `name`, creator, `status`, create_time, update_time, end_time, project_id, tags,
create_user
</sql>
<sql id="Blob_Column_List">
description
@ -131,11 +133,11 @@
insert into test_case_review (id, `name`, creator,
`status`, create_time, update_time,
end_time, project_id, tags,
description)
create_user, description)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{description,jdbcType=LONGVARCHAR})
#{createUser,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReview">
insert into test_case_review
@ -167,6 +169,9 @@
<if test="tags != null">
tags,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="description != null">
description,
</if>
@ -199,6 +204,9 @@
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
@ -240,6 +248,9 @@
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
@ -259,6 +270,7 @@
end_time = #{record.endTime,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -274,7 +286,8 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR}
tags = #{record.tags,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -306,6 +319,9 @@
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
@ -322,6 +338,7 @@
end_time = #{endTime,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -334,7 +351,8 @@
update_time = #{updateTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR}
tags = #{tags,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -10,6 +10,7 @@
<result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -70,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, review_id, case_id, `status`, `result`, reviewer, create_time, update_time
id, review_id, case_id, `status`, `result`, reviewer, create_time, update_time, create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultMap="BaseResultMap">
select
@ -105,10 +106,12 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase">
insert into test_case_review_test_case (id, review_id, case_id,
`status`, `result`, reviewer,
create_time, update_time)
create_time, update_time, create_user
)
values (#{id,jdbcType=VARCHAR}, #{reviewId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{reviewer,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase">
insert into test_case_review_test_case
@ -137,6 +140,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -163,6 +169,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultType="java.lang.Long">
@ -198,6 +207,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -212,7 +224,8 @@
`result` = #{record.result,jdbcType=VARCHAR},
reviewer = #{record.reviewer,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -241,6 +254,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -252,7 +268,8 @@
`result` = #{result,jdbcType=VARCHAR},
reviewer = #{reviewer,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,6 +9,7 @@
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -69,7 +70,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, test_plan_id, api_case_id, `status`, environment_id, create_time, update_time
id, test_plan_id, api_case_id, `status`, environment_id, create_time, update_time,
create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestPlanApiCaseExample" resultMap="BaseResultMap">
select
@ -104,10 +106,10 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanApiCase">
insert into test_plan_api_case (id, test_plan_id, api_case_id,
`status`, environment_id, create_time,
update_time)
update_time, create_user)
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT})
#{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanApiCase">
insert into test_plan_api_case
@ -133,6 +135,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -156,6 +161,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanApiCaseExample" resultType="java.lang.Long">
@ -188,6 +196,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -201,7 +212,8 @@
`status` = #{record.status,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -227,6 +239,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -237,7 +252,8 @@
`status` = #{status,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -11,6 +11,7 @@
<result column="pass_rate" jdbcType="VARCHAR" property="passRate" />
<result column="last_result" jdbcType="VARCHAR" property="lastResult" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanApiScenario">
<result column="environment" jdbcType="LONGVARCHAR" property="environment" />
@ -75,7 +76,7 @@
</sql>
<sql id="Base_Column_List">
id, test_plan_id, api_scenario_id, `status`, create_time, update_time, pass_rate,
last_result, report_id
last_result, report_id, create_user
</sql>
<sql id="Blob_Column_List">
environment
@ -132,11 +133,11 @@
insert into test_plan_api_scenario (id, test_plan_id, api_scenario_id,
`status`, create_time, update_time,
pass_rate, last_result, report_id,
environment)
create_user, environment)
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{environment,jdbcType=LONGVARCHAR})
#{createUser,jdbcType=VARCHAR}, #{environment,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
insert into test_plan_api_scenario
@ -168,6 +169,9 @@
<if test="reportId != null">
report_id,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="environment != null">
environment,
</if>
@ -200,6 +204,9 @@
<if test="reportId != null">
#{reportId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="environment != null">
#{environment,jdbcType=LONGVARCHAR},
</if>
@ -241,6 +248,9 @@
<if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.environment != null">
environment = #{record.environment,jdbcType=LONGVARCHAR},
</if>
@ -260,6 +270,7 @@
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
environment = #{record.environment,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -275,7 +286,8 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}
report_id = #{record.reportId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -307,6 +319,9 @@
<if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="environment != null">
environment = #{environment,jdbcType=LONGVARCHAR},
</if>
@ -323,6 +338,7 @@
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
environment = #{environment,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -335,7 +351,8 @@
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}
report_id = #{reportId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,6 +9,7 @@
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -69,7 +70,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, test_plan_id, load_case_id, load_report_id, `status`, create_time, update_time
id, test_plan_id, load_case_id, load_report_id, `status`, create_time, update_time,
create_user
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestPlanLoadCaseExample" resultMap="BaseResultMap">
select
@ -104,10 +106,10 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
insert into test_plan_load_case (id, test_plan_id, load_case_id,
load_report_id, `status`, create_time,
update_time)
update_time, create_user)
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{loadCaseId,jdbcType=VARCHAR},
#{loadReportId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT})
#{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanLoadCase">
insert into test_plan_load_case
@ -133,6 +135,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -156,6 +161,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanLoadCaseExample" resultType="java.lang.Long">
@ -188,6 +196,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -201,7 +212,8 @@
load_report_id = #{record.loadReportId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -227,6 +239,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -237,7 +252,8 @@
load_report_id = #{loadReportId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -20,7 +20,7 @@
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="execution_times" jdbcType="INTEGER" property="executionTimes"/>
<result column="execution_times" jdbcType="INTEGER" property="executionTimes" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlan">
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
@ -140,20 +140,20 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
actual_end_time, planned_start_time, planned_end_time,
actual_start_time, creator, project_id,
execution_times, tags)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR})
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
actual_end_time, planned_start_time, planned_end_time,
actual_start_time, creator, project_id,
execution_times, tags)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan
@ -357,8 +357,8 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -378,13 +378,13 @@
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -403,7 +403,7 @@
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER}
<if test="_parameter != null">
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
@ -471,48 +471,48 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlan">
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
tags = #{tags,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
tags = #{tags,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlan">
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -11,6 +11,7 @@
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
<result column="results" jdbcType="LONGVARCHAR" property="results" />
@ -76,7 +77,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, plan_id, case_id, executor, `status`, remark, create_time, update_time, report_id
id, plan_id, case_id, executor, `status`, remark, create_time, update_time, report_id,
create_user
</sql>
<sql id="Blob_Column_List">
results, issues, actual_result
@ -133,13 +135,13 @@
insert into test_plan_test_case (id, plan_id, case_id,
executor, `status`, remark,
create_time, update_time, report_id,
results, issues, actual_result
)
create_user, results, issues,
actual_result)
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{reportId,jdbcType=VARCHAR},
#{results,jdbcType=LONGVARCHAR}, #{issues,jdbcType=LONGVARCHAR}, #{actualResult,jdbcType=LONGVARCHAR}
)
#{createUser,jdbcType=VARCHAR}, #{results,jdbcType=LONGVARCHAR}, #{issues,jdbcType=LONGVARCHAR},
#{actualResult,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
insert into test_plan_test_case
@ -171,6 +173,9 @@
<if test="reportId != null">
report_id,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="results != null">
results,
</if>
@ -209,6 +214,9 @@
<if test="reportId != null">
#{reportId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="results != null">
#{results,jdbcType=LONGVARCHAR},
</if>
@ -256,6 +264,9 @@
<if test="record.reportId != null">
report_id = #{record.reportId,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.results != null">
results = #{record.results,jdbcType=LONGVARCHAR},
</if>
@ -281,6 +292,7 @@
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
report_id = #{record.reportId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
results = #{record.results,jdbcType=LONGVARCHAR},
issues = #{record.issues,jdbcType=LONGVARCHAR},
actual_result = #{record.actualResult,jdbcType=LONGVARCHAR}
@ -298,7 +310,8 @@
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
report_id = #{record.reportId,jdbcType=VARCHAR}
report_id = #{record.reportId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -330,6 +343,9 @@
<if test="reportId != null">
report_id = #{reportId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="results != null">
results = #{results,jdbcType=LONGVARCHAR},
</if>
@ -352,6 +368,7 @@
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
report_id = #{reportId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
results = #{results,jdbcType=LONGVARCHAR},
issues = #{issues,jdbcType=LONGVARCHAR},
actual_result = #{actualResult,jdbcType=LONGVARCHAR}
@ -366,7 +383,8 @@
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
report_id = #{reportId,jdbcType=VARCHAR}
report_id = #{reportId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum OperLogConstants {
CREATE, DELETE, GC, RESTORE, DEBUG, UPDATE, BATCH_DEL, BATCH_UPDATE, BATCH_ADD, BATCH_RESTORE, BATCH_GC, IMPORT, EXPORT, ASSOCIATE_CASE, REVIEW, COPY, EXECUTE, SHARE, LOGIN, CREATE_PRE_TEST, OTHER
CREATE, DELETE, GC, RESTORE, DEBUG, UPDATE, BATCH_DEL, BATCH_UPDATE, BATCH_ADD, BATCH_RESTORE, BATCH_GC, IMPORT, EXPORT, ASSOCIATE_CASE, UN_ASSOCIATE_CASE, REVIEW, COPY, EXECUTE, SHARE, LOGIN, CREATE_PRE_TEST, OTHER
}

View File

@ -12,6 +12,7 @@ import io.metersphere.log.utils.dff.JsonDiff;
import io.metersphere.log.utils.dff.Operation;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.StatusReference;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
@ -49,12 +50,18 @@ public class ReflexObjectUtil {
try {
if (columns.containsKey(f.getName())) {
Object val = f.get(obj);
if (val != null && StatusReference.statusMap.containsKey(val.toString())) {
val = StatusReference.statusMap.get(val.toString());
}
DetailColumn column = new DetailColumn(columns.get(f.getName()), f.getName(), val, "");
if (dffColumns.contains(f.getName())) {
column.setDepthDff(true);
if (val != null) {
JSONObject object = JSONObject.parseObject(val.toString());
String pretty = JSON.toJSONString(object, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat);
String pretty = JSON.toJSONString(object,
SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat);
column.setOriginalValue(pretty);
}
}
@ -65,8 +72,6 @@ public class ReflexObjectUtil {
}
}
}
List<String> keys = columns.keySet().stream().collect(Collectors.toList());
ReflexObjectUtil.order(keys, columnList);
return columnList;

View File

@ -0,0 +1,27 @@
package io.metersphere.log.vo;
import java.util.LinkedHashMap;
import java.util.Map;
public class StatusReference {
public static Map<String, String> statusMap = new LinkedHashMap<>();
static {
statusMap.clear();
statusMap.put("Prepare", "未开始");
statusMap.put("Underway", "进行中");
statusMap.put("Completed", "已完成");
statusMap.put("Finished", "已结束");
statusMap.put("Saved", "已保存");
statusMap.put("Starting", "已开始");
statusMap.put("Running", "运行中");
statusMap.put("Error", "异常");
statusMap.put("Pass", "通过");
statusMap.put("UnPass", "未通过");
statusMap.put("smoke", "冒烟测试");
statusMap.put("system", "系统测试");
statusMap.put("regression", "回归测试");
}
}

View File

@ -12,7 +12,6 @@ public class TestCaseReference {
testCaseColumns.put("createUser", "创建人");
testCaseColumns.put("nodePath", "用例模块");
testCaseColumns.put("type", "用例类型");
testCaseColumns.put("maintainer", "责任人");
testCaseColumns.put("principal", "责任人");
testCaseColumns.put("priority", "用例等级");
testCaseColumns.put("method", "请求类型");

View File

@ -0,0 +1,22 @@
package io.metersphere.log.vo.track;
import java.util.LinkedHashMap;
import java.util.Map;
public class TestCaseReviewReference {
public static Map<String, String> testCaseReviewColumns = new LinkedHashMap<>();
public static Map<String, String> commentReviewColumns = new LinkedHashMap<>();
static {
testCaseReviewColumns.clear();
commentReviewColumns.clear();
testCaseReviewColumns.put("name", "用例名称");
testCaseReviewColumns.put("createUser", "创建人");
testCaseReviewColumns.put("status", "状态");
testCaseReviewColumns.put("tags", "标签");
testCaseReviewColumns.put("description", "描述");
commentReviewColumns.put("author","评论人");
commentReviewColumns.put("description","评论内容");
}
}

View File

@ -0,0 +1,41 @@
package io.metersphere.log.vo.track;
import java.util.LinkedHashMap;
import java.util.Map;
public class TestPlanReference {
public static Map<String, String> testPlanColumns = new LinkedHashMap<>();
public static Map<String, String> reportColumns = new LinkedHashMap<>();
public static Map<String, String> issuesColumns = new LinkedHashMap<>();
static {
testPlanColumns.clear();
reportColumns.clear();
issuesColumns.clear();
testPlanColumns.put("name", "用例名称");
testPlanColumns.put("creator", "创建人");
testPlanColumns.put("principal", "责任人");
testPlanColumns.put("status", "状态");
testPlanColumns.put("stage", "测试阶段");
testPlanColumns.put("tags", "标签");
testPlanColumns.put("plannedStartTime", "计划开始时间");
testPlanColumns.put("plannedEndTime", "计划结束时间");
testPlanColumns.put("description", "描述");
reportColumns.put("name", "名称");
reportColumns.put("startTime", "开始时间");
reportColumns.put("endTime", "结束时间");
// 缺陷管理
issuesColumns.put("title","缺陷标题");
issuesColumns.put("status","缺陷状态");
issuesColumns.put("platform","平台");
issuesColumns.put("creator","创建人");
issuesColumns.put("reporter","处理人");
issuesColumns.put("custom_fields","自定义字段");
// 深度处理字段
issuesColumns.put("ms-dff-col", "custom_fields");
}
}

View File

@ -5,8 +5,10 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.Issues;
import io.metersphere.base.domain.IssuesDao;
import io.metersphere.base.domain.IssuesWithBLOBs;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.issue.domain.PlatformUser;
import io.metersphere.track.issue.domain.ZentaoBuild;
import io.metersphere.track.request.testcase.IssuesRequest;
@ -31,11 +33,13 @@ public class IssuesController {
}
@PostMapping("/add")
@MsAuditLog(module = "track_bug", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#issuesRequest)", msClass = IssuesService.class)
public void addIssues(@RequestBody IssuesUpdateRequest issuesRequest) {
issuesService.addIssues(issuesRequest);
}
@PostMapping("/update")
@MsAuditLog(module = "track_bug", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#issuesRequest.id)", content = "#msClass.getLogDetails(#issuesRequest.id)", msClass = IssuesService.class)
public void updateIssues(@RequestBody IssuesUpdateRequest issuesRequest) {
issuesService.updateIssues(issuesRequest);
}
@ -56,11 +60,13 @@ public class IssuesController {
}
@PostMapping("/delete")
@MsAuditLog(module = "track_bug", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = IssuesService.class)
public void deleteIssue(@RequestBody IssuesRequest request) {
issuesService.deleteIssue(request);
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "track_bug", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssuesService.class)
public void delete(@PathVariable String id) {
issuesService.delete(id);
}

View File

@ -1,12 +1,18 @@
package io.metersphere.track.controller;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.TestCaseCommentDTO;
import io.metersphere.track.request.testreview.SaveCommentRequest;
import io.metersphere.track.service.TestCaseCommentService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@RequestMapping("/test/case/comment")
@RestController
@ -16,7 +22,9 @@ public class TestCaseCommentController {
private TestCaseCommentService testCaseCommentService;
@PostMapping("/save")
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseCommentService.class)
public void saveComment(@RequestBody SaveCommentRequest request) {
request.setId(UUID.randomUUID().toString());
testCaseCommentService.saveComment(request);
}
@ -26,11 +34,14 @@ public class TestCaseCommentController {
}
@GetMapping("/delete/{commentId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#commentId)", msClass = TestCaseCommentService.class)
public void deleteComment(@PathVariable String commentId) {
testCaseCommentService.delete(commentId);
}
@PostMapping("/edit")
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseCommentService.class)
public void editComment(@RequestBody SaveCommentRequest request) {
testCaseCommentService.edit(request);
}

View File

@ -1,7 +1,9 @@
package io.metersphere.track.controller;
import io.metersphere.base.domain.TestCaseReport;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.request.testCaseReport.CreateReportRequest;
import io.metersphere.track.service.TestCaseReportService;
import org.apache.shiro.authz.annotation.Logical;
@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@RequestMapping("/case/report")
@RestController
@ -30,18 +33,22 @@ public class TestCaseReportController {
@PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseReportService.class)
public String addByTemplateId(@RequestBody CreateReportRequest request) {
request.setId(UUID.randomUUID().toString());
return testCaseReportService.addTestCaseReportByTemplateId(request);
}
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#TestCaseReport.id)", content = "#msClass.getLogDetails(#TestCaseReport.id)", msClass = TestCaseReportService.class)
public void edit(@RequestBody TestCaseReport TestCaseReport) {
testCaseReportService.editTestCaseReport(TestCaseReport);
}
@PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportService.class)
public int delete(@PathVariable String id) {
return testCaseReportService.deleteTestCaseReport(id);
}

View File

@ -5,10 +5,12 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.TestCaseReview;
import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric;
@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@RequestMapping("/test/case/review")
@RestController
@ -45,7 +48,9 @@ public class TestCaseReviewController {
@PostMapping("/save")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.CREATE, title = "#reviewRequest.name", content = "#msClass.getLogDetails(#reviewRequest.id)", msClass = TestCaseReviewService.class)
public String saveCaseReview(@RequestBody SaveTestCaseReviewRequest reviewRequest) {
reviewRequest.setId(UUID.randomUUID().toString());
return testCaseReviewService.saveTestCaseReview(reviewRequest);
}
@ -68,12 +73,14 @@ public class TestCaseReviewController {
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testCaseReview.id)", title = "#testCaseReview.name", content = "#msClass.getLogDetails(#testCaseReview.id)", msClass = TestCaseReviewService.class)
public String editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) {
return testCaseReviewService.editCaseReview(testCaseReview);
}
@GetMapping("/delete/{reviewId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#reviewId)", msClass = TestCaseReviewService.class)
public void deleteCaseReview(@PathVariable String reviewId) {
checkPermissionService.checkTestReviewOwner(reviewId);
testCaseReviewService.deleteCaseReview(reviewId);
@ -85,6 +92,7 @@ public class TestCaseReviewController {
}
@PostMapping("/relevance")
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#request)", msClass = TestCaseReviewService.class)
public void testReviewRelevance(@RequestBody ReviewRelevanceRequest request) {
testCaseReviewService.testReviewRelevance(request);
}

View File

@ -5,9 +5,11 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import io.metersphere.track.service.TestPlanApiCaseService;
import org.apache.shiro.authz.annotation.Logical;
@ -43,18 +45,21 @@ public class TestPlanApiCaseController {
@GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanApiCaseService.class)
public int deleteTestCase(@PathVariable String id) {
return testPlanApiCaseService.delete(id);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class)
public void deleteApiCaseBath(@RequestBody TestPlanApiCaseBatchRequest request) {
testPlanApiCaseService.deleteApiCaseBath(request);
}
@PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanApiCaseService.class)
public void batchUpdateEnv(@RequestBody TestPlanApiCaseBatchRequest request) {
testPlanApiCaseService.batchUpdateEnv(request);
}

View File

@ -4,10 +4,12 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.TestPlan;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.track.dto.TestCaseReportMetricDTO;
import io.metersphere.track.dto.TestPlanDTO;
@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@RequestMapping("/test/plan")
@RestController
@ -84,19 +87,23 @@ public class TestPlanController {
@PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.CREATE, title = "#testPlan.name", content = "#msClass.getLogDetails(#testPlan.id)", msClass = TestPlanService.class)
public String addTestPlan(@RequestBody AddTestPlanRequest testPlan) {
testPlan.setId(UUID.randomUUID().toString());
return testPlanService.addTestPlan(testPlan);
}
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testPlanDTO.id)", content = "#msClass.getLogDetails(#testPlanDTO.id)", msClass = TestPlanService.class)
public String editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
return testPlanService.editTestPlan(testPlanDTO, true);
}
@PostMapping("/edit/status/{planId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#planId)", content = "#msClass.getLogDetails(#planId)", msClass = TestPlanService.class)
public void editTestPlanStatus(@PathVariable String planId) {
checkPermissionService.checkTestPlanOwner(planId);
testPlanService.editTestPlanStatus(planId);
@ -104,12 +111,14 @@ public class TestPlanController {
@PostMapping("/delete/{testPlanId}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class)
public int deleteTestPlan(@PathVariable String testPlanId) {
checkPermissionService.checkTestPlanOwner(testPlanId);
return testPlanService.deleteTestPlan(testPlanId);
}
@PostMapping("/relevance")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#request)", msClass = TestPlanService.class)
public void testPlanRelevance(@RequestBody PlanCaseRelevanceRequest request) {
testPlanService.testPlanRelevance(request);
}

View File

@ -4,8 +4,10 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.LoadTest;
import io.metersphere.base.domain.TestPlanLoadCase;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
import io.metersphere.track.request.testplan.LoadCaseReportBatchRequest;
@ -32,6 +34,7 @@ public class TestPlanLoadCaseController {
}
@PostMapping("/relevance")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#request.caseIds,#request.testPlanId)", msClass = TestPlanLoadCaseService.class)
public void relevanceCase(@RequestBody LoadCaseRequest request) {
testPlanLoadCaseService.relevanceCase(request);
}
@ -48,16 +51,19 @@ public class TestPlanLoadCaseController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanLoadCaseService.class)
public void delete(@PathVariable String id) {
testPlanLoadCaseService.delete(id);
}
@PostMapping("/run")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanLoadId)", msClass = TestPlanLoadCaseService.class)
public String run(@RequestBody RunTestPlanRequest request) {
return testPlanLoadCaseService.run(request);
}
@PostMapping("/run/batch")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.EXECUTE, content = "#msClass.getRunLogDetails(#request.requests)", msClass = TestPlanLoadCaseService.class)
public void runBatch(@RequestBody RunBatchTestPlanRequest request) {
testPlanLoadCaseService.runBatch(request);
}
@ -68,16 +74,19 @@ public class TestPlanLoadCaseController {
}
@PostMapping("/batch/delete")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanLoadCaseService.class)
public void batchDelete(@RequestBody LoadCaseReportBatchRequest request) {
testPlanLoadCaseService.batchDelete(request);
}
@PostMapping("/update")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#testPlanLoadCase.id)", msClass = TestPlanLoadCaseService.class)
public void update(@RequestBody TestPlanLoadCase testPlanLoadCase) {
testPlanLoadCaseService.update(testPlanLoadCase);
}
@PostMapping("/update/api")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#testPlanLoadCase.id)", msClass = TestPlanLoadCaseService.class)
public void updateByApi(@RequestBody TestPlanLoadCase testPlanLoadCase) {
testPlanLoadCaseService.updateByApi(testPlanLoadCase);
}

View File

@ -3,10 +3,12 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestPlanReport;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.ReportTriggerMode;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.TestPlanReportDTO;
import io.metersphere.track.request.report.QueryTestPlanReportRequest;
import io.metersphere.track.request.report.TestPlanReportSaveRequest;
@ -48,6 +50,7 @@ public class TestPlanReportController {
}
@PostMapping("/delete")
@MsAuditLog(module = "track_report", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanReportIdList)", msClass = TestPlanReportService.class)
public void delete(@RequestBody List<String> testPlanReportIdList) {
testPlanReportService.delete(testPlanReportIdList);
}

View File

@ -4,10 +4,12 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.automation.*;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.RelevanceScenarioRequest;
import io.metersphere.track.request.testcase.TestPlanScenarioCaseBatchRequest;
import io.metersphere.track.service.TestPlanScenarioCaseService;
@ -45,23 +47,27 @@ public class TestPlanScenarioCaseController {
@GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanScenarioCaseService.class)
public int deleteTestCase(@PathVariable String id) {
return testPlanScenarioCaseService.delete(id);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class)
public void deleteApiCaseBath(@RequestBody TestPlanScenarioCaseBatchRequest request) {
testPlanScenarioCaseService.deleteApiCaseBath(request);
}
@PostMapping(value = "/run")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.planCaseIds)", msClass = TestPlanScenarioCaseService.class)
public String run(@RequestBody RunTestPlanScenarioRequest request) {
request.setExecuteType(ExecuteType.Completed.name());
return testPlanScenarioCaseService.run(request);
}
@PostMapping(value = "/jenkins/run")
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class)
public String runByRun(@RequestBody RunTestPlanScenarioRequest request) {
request.setExecuteType(ExecuteType.Saved.name());
request.setTriggerMode(ApiRunMode.API.name());
@ -71,6 +77,7 @@ public class TestPlanScenarioCaseController {
@PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanScenarioCaseService.class)
public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) {
testPlanScenarioCaseService.batchUpdateEnv(request);
}

View File

@ -3,9 +3,11 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
@ -31,7 +33,8 @@ public class TestPlanTestCaseController {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
}
/*jenkins测试计划下全部用例*/
/*jenkins测试计划下全部用例*/
@GetMapping("/list/{planId}")
public List<TestPlanCaseDTO> getTestPlanCaseByPlanId(@PathVariable String planId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
@ -104,30 +107,35 @@ public class TestPlanTestCaseController {
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#testPlanTestCase.id)", msClass = TestPlanTestCaseService.class)
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
testPlanTestCaseService.editTestCase(testPlanTestCase);
}
@PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getCaseLogDetails(#testPlanTestCases)", msClass = TestPlanTestCaseService.class)
public void editTestCaseForMinder(@RequestBody List<TestPlanTestCaseWithBLOBs> testPlanTestCases) {
testPlanTestCaseService.editTestCaseForMinder(testPlanTestCases);
}
@PostMapping("/batch/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class)
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.editTestCaseBath(request);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = TestPlanTestCaseService.class)
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
testPlanTestCaseService.deleteTestCaseBath(request);
}
@PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanTestCaseService.class)
public int deleteTestCase(@PathVariable String id) {
return testPlanTestCaseService.deleteTestCase(id);
}

View File

@ -3,9 +3,11 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestCaseReviewTestCase;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
@ -33,24 +35,28 @@ public class TestReviewTestCaseController {
@PostMapping("/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public int deleteTestCase(@RequestBody DeleteRelevanceRequest request) {
return testReviewTestCaseService.deleteTestCase(request);
}
@PostMapping("/batch/delete")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public void deleteTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.deleteTestCaseBatch(request);
}
@PostMapping("/batch/edit/status")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.batchLogDetails(#request)", content = "#msClass.getLogDetails(#request)", msClass = TestReviewTestCaseService.class)
public void editTestCaseBatch(@RequestBody TestReviewCaseBatchRequest request) {
testReviewTestCaseService.editTestCaseBatchStatus(request);
}
@PostMapping("/minder/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.ASSOCIATE_CASE, content = "#msClass.getLogDetails(#testCases)", msClass = TestReviewTestCaseService.class)
public void editTestCaseForMinder(@RequestBody List<TestCaseReviewTestCase> testCases) {
testReviewTestCaseService.editTestCaseForMinder(testCases);
}
@ -62,6 +68,7 @@ public class TestReviewTestCaseController {
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "track_test_case_review", type = OperLogConstants.REVIEW, content = "#msClass.getLogDetails(#testCaseReviewTestCase)", msClass = TestReviewTestCaseService.class)
public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) {
testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
}

View File

@ -10,6 +10,7 @@ import java.util.Map;
@Setter
public class RelevanceScenarioRequest {
private List<String> ids;
/**
* 环境和项目对应关系
*/

View File

@ -6,6 +6,7 @@ import lombok.Setter;
@Getter
@Setter
public class CreateReportRequest {
private String id;
String planId;
String templateId;
}

View File

@ -17,6 +17,10 @@ import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.IntegrationRequest;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestPlanReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.IntegrationService;
@ -34,7 +38,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@ -130,6 +137,7 @@ public class IssuesService {
Project project = getProjectByCaseId(caseId);
return getIssuesByProject(issueRequest, project);
}
public List<IssuesDao> getIssuesByProject(IssuesRequest issueRequest, Project project) {
List<IssuesDao> list = new ArrayList<>();
List<String> platforms = getPlatforms(project);
@ -395,4 +403,24 @@ public class IssuesService {
ServiceIntegration integration = integrationService.get(request);
return integration.getConfiguration();
}
public String getLogDetails(String id) {
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(id);
if (issuesWithBLOBs != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(issuesWithBLOBs, TestPlanReference.issuesColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(issuesWithBLOBs.getId()), issuesWithBLOBs.getProjectId(), issuesWithBLOBs.getTitle(), issuesWithBLOBs.getCreator(), columns);
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(IssuesUpdateRequest issuesRequest) {
if (issuesRequest != null) {
issuesRequest.setCreator(SessionUtils.getUserId());
List<DetailColumn> columns = ReflexObjectUtil.getColumns(issuesRequest, TestPlanReference.issuesColumns);
OperatingLogDetails details = new OperatingLogDetails(null, issuesRequest.getProjectId(), issuesRequest.getTitle(), issuesRequest.getCreator(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,11 +1,10 @@
package io.metersphere.track.service;
import io.metersphere.base.domain.TestCaseComment;
import io.metersphere.base.domain.TestCaseCommentExample;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.domain.User;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.TestCaseCommentMapper;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper;
import io.metersphere.commons.constants.NoticeConstants;
@ -13,6 +12,10 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestCaseReviewReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService;
@ -29,7 +32,8 @@ import java.util.*;
@Service
@Transactional(rollbackFor = Exception.class)
public class TestCaseCommentService {
@Resource
TestCaseReviewMapper testCaseReviewMapper;
@Resource
private TestCaseCommentMapper testCaseCommentMapper;
@Resource
@ -45,7 +49,7 @@ public class TestCaseCommentService {
public void saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment();
testCaseComment.setId(UUID.randomUUID().toString());
testCaseComment.setId(request.getId());
testCaseComment.setAuthor(SessionUtils.getUser().getId());
testCaseComment.setCaseId(request.getCaseId());
testCaseComment.setCreateTime(System.currentTimeMillis());
@ -119,4 +123,14 @@ public class TestCaseCommentService {
}
}
public String getLogDetails(String id) {
TestCaseComment caseComment = testCaseCommentMapper.selectByPrimaryKey(id);
if (caseComment != null) {
TestCase review = testCaseMapper.selectByPrimaryKey(caseComment.getCaseId());
List<DetailColumn> columns = ReflexObjectUtil.getColumns(caseComment, TestCaseReviewReference.commentReviewColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(caseComment.getId()), review.getProjectId(), caseComment.getDescription(), caseComment.getAuthor(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.TestCaseReport;
import io.metersphere.base.domain.TestCaseReportExample;
import io.metersphere.base.domain.TestCaseReportTemplate;
@ -9,6 +10,11 @@ import io.metersphere.base.mapper.TestCaseReportTemplateMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestPlanReference;
import io.metersphere.track.request.testCaseReport.CreateReportRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -65,10 +71,21 @@ public class TestCaseReportService {
BeanUtils.copyBean(report, template);
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
report.setName(testPlan.getName());
report.setId(UUID.randomUUID().toString());
report.setId(request.getId());
report.setCreateUser(SessionUtils.getUserId());
testCaseReportMapper.insert(report);
testPlan.setReportId(report.getId());
testPlanMapper.updateByPrimaryKeySelective(testPlan);
return report.getId();
}
public String getLogDetails(String id) {
TestCaseReport report = testCaseReportMapper.selectByPrimaryKey(id);
if (report != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(report, TestPlanReference.reportColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(report.getId()), null, report.getName(), report.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,12 +1,16 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.LogUtil;
@ -15,6 +19,10 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestCaseReviewReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService;
@ -27,13 +35,13 @@ import io.metersphere.track.request.testreview.QueryTestReviewRequest;
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
@ -90,7 +98,7 @@ public class TestCaseReviewService {
public String saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
checkCaseReviewExist(reviewRequest);
String reviewId = UUID.randomUUID().toString();
String reviewId = reviewRequest.getId();
List<String> userIds = reviewRequest.getUserIds();//执行人
userIds.forEach(userId -> {
@ -101,6 +109,7 @@ public class TestCaseReviewService {
});
reviewRequest.setId(reviewId);
reviewRequest.setCreateUser(SessionUtils.getUserId());
reviewRequest.setCreateTime(System.currentTimeMillis());
reviewRequest.setUpdateTime(System.currentTimeMillis());
reviewRequest.setCreator(SessionUtils.getUser().getId());//创建人
@ -352,6 +361,7 @@ public class TestCaseReviewService {
TestCaseReviewTestCase caseReview = new TestCaseReviewTestCase();
caseReview.setId(UUID.randomUUID().toString());
caseReview.setReviewer(SessionUtils.getUser().getId());
caseReview.setCreateUser(SessionUtils.getUserId());
caseReview.setCaseId(caseId);
caseReview.setCreateTime(System.currentTimeMillis());
caseReview.setUpdateTime(System.currentTimeMillis());
@ -609,5 +619,40 @@ public class TestCaseReviewService {
return context;
}
public String getLogDetails(String id) {
TestCaseReview review = testCaseReviewMapper.selectByPrimaryKey(id);
if (review != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(review, TestCaseReviewReference.testCaseReviewColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), review.getProjectId(), review.getName(), review.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(ReviewRelevanceRequest request) {
List<String> testCaseIds = request.getTestCaseIds();
List<String> names = new ArrayList<>();
if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) {
names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
} else {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(testCaseIds);
List<TestCase> cases = testCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(cases)) {
names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
}
}
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
if (caseReview != null) {
List<DetailColumn> columns = new LinkedList<>();
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(testCaseIds), caseReview.getProjectId(), String.join(",", names) + " 关联到 " + "" + caseReview.getName() + "", caseReview.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,21 +1,23 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
import io.metersphere.api.service.ApiDefinitionExecResultService;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.api.service.ApiTestCaseService;
import io.metersphere.base.domain.TestPlanApiCase;
import io.metersphere.base.domain.TestPlanApiCaseExample;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiTestCaseMapper;
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -23,10 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
@ -38,11 +38,13 @@ public class TestPlanApiCaseService {
ApiTestCaseService apiTestCaseService;
@Resource
ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
@Resource
ApiDefinitionService apiDefinitionService;
@Lazy
@Resource
ApiDefinitionExecResultService apiDefinitionExecResultService;
@Resource
private TestPlanMapper testPlanMapper;
@Resource
ApiTestCaseMapper apiTestCaseMapper;
public TestPlanApiCase getInfo(String caseId, String testPlanId) {
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
@ -103,7 +105,7 @@ public class TestPlanApiCaseService {
public void deleteApiCaseBath(TestPlanApiCaseBatchRequest request) {
List<String> deleteIds = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
deleteIds = this.selectIds(request.getCondition());
if (request.getCondition() != null && request.getCondition().getUnSelectIds() != null) {
deleteIds.removeAll(request.getCondition().getUnSelectIds());
@ -131,7 +133,7 @@ public class TestPlanApiCaseService {
return testPlanApiCaseMapper.selectByPrimaryKey(id);
}
public void setExecResult(String id, String status,Long time) {
public void setExecResult(String id, String status, Long time) {
TestPlanApiCase apiCase = new TestPlanApiCase();
apiCase.setId(id);
apiCase.setStatus(status);
@ -154,6 +156,7 @@ public class TestPlanApiCaseService {
// 批量修改用例环境
Map<String, String> rows = request.getSelectRows();
Set<String> ids = rows.keySet();
request.setIds(new ArrayList<>(ids));
Map<String, String> env = request.getProjectEnvMap();
if (env != null && !env.isEmpty()) {
ids.forEach(id -> {
@ -188,4 +191,32 @@ public class TestPlanApiCaseService {
List<TestPlanApiCaseDTO> returnList = extTestPlanApiCaseMapper.list(selectReq);
return returnList;
}
public String getLogDetails(String id) {
TestPlanApiCase testPlanApiCase = testPlanApiCaseMapper.selectByPrimaryKey(id);
if (testPlanApiCase != null) {
ApiTestCaseWithBLOBs testCase = apiTestCaseService.get(testPlanApiCase.getApiCaseId());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(testPlanApiCase.getTestPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), testCase.getProjectId(), testCase.getName(), testPlanApiCase.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(List<String> ids) {
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
example.createCriteria().andIdIn(ids);
List<TestPlanApiCase> nodes = testPlanApiCaseMapper.selectByExample(example);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(nodes)) {
ApiTestCaseExample testCaseExample = new ApiTestCaseExample();
testCaseExample.createCriteria().andIdIn(nodes.stream().map(TestPlanApiCase::getApiCaseId).collect(Collectors.toList()));
List<ApiTestCase> testCases = apiTestCaseMapper.selectByExample(testCaseExample);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(testCases)) {
List<String> names = testCases.stream().map(ApiTestCase::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), testCases.get(0).getProjectId(), String.join(",", names), nodes.get(0).getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.LoadTestReportMapper;
@ -9,7 +10,9 @@ import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
import io.metersphere.commons.constants.RunModeConstants;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.performance.request.RunTestPlanRequest;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.track.dto.TestPlanLoadCaseDTO;
@ -19,16 +22,17 @@ import io.metersphere.track.request.testplan.LoadCaseRequest;
import io.metersphere.track.request.testplan.RunBatchTestPlanRequest;
import io.metersphere.track.service.utils.ParallelExecTask;
import io.metersphere.track.service.utils.SerialExecTask;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
@ -97,6 +101,7 @@ public class TestPlanLoadCaseService {
caseIds.forEach(id -> {
TestPlanLoadCase t = new TestPlanLoadCase();
t.setId(UUID.randomUUID().toString());
t.setCreateUser(SessionUtils.getUserId());
t.setTestPlanId(planId);
t.setLoadCaseId(id);
t.setCreateTime(System.currentTimeMillis());
@ -261,4 +266,64 @@ public class TestPlanLoadCaseService {
List<TestPlanLoadCaseDTO> list = extTestPlanLoadCaseMapper.selectByIdIn(tableReq);
return list;
}
public String getLogDetails(String id) {
TestPlanLoadCase bloBs = testPlanLoadCaseMapper.selectByPrimaryKey(id);
if (bloBs != null) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(bloBs.getTestPlanId());
LoadTest test = loadTestMapper.selectByPrimaryKey(bloBs.getLoadCaseId());
if (test != null && testPlan != null) {
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), testPlan.getProjectId(), test.getName(), bloBs.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
}
return null;
}
public String getLogDetails(List<String> ids) {
TestPlanLoadCaseExample caseExample = new TestPlanLoadCaseExample();
caseExample.createCriteria().andIdIn(ids);
List<TestPlanLoadCase> cases = testPlanLoadCaseMapper.selectByExample(caseExample);
if (CollectionUtils.isNotEmpty(cases)) {
LoadTestExample example = new LoadTestExample();
example.createCriteria().andIdIn(cases.stream().map(TestPlanLoadCase::getLoadCaseId).collect(Collectors.toList()));
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
List<String> names = loadTests.stream().map(LoadTest::getName).collect(Collectors.toList());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(cases.get(0).getTestPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), testPlan.getProjectId(), String.join(",", names), testPlan.getCreator(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(List<String> ids, String planId) {
TestPlanLoadCaseExample caseExample = new TestPlanLoadCaseExample();
caseExample.createCriteria().andLoadCaseIdIn(ids).andTestPlanIdEqualTo(planId);
List<TestPlanLoadCase> cases = testPlanLoadCaseMapper.selectByExample(caseExample);
if (CollectionUtils.isNotEmpty(cases)) {
LoadTestExample example = new LoadTestExample();
example.createCriteria().andIdIn(cases.stream().map(TestPlanLoadCase::getLoadCaseId).collect(Collectors.toList()));
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(loadTests)) {
List<String> names = loadTests.stream().map(LoadTest::getName).collect(Collectors.toList());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(cases.get(0).getTestPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), testPlan.getProjectId(), String.join(",", names), testPlan.getCreator(), new LinkedList<>());
return JSON.toJSONString(details);
}
}
return null;
}
public String getRunLogDetails(List<RunTestPlanRequest> requests) {
LoadTestExample example = new LoadTestExample();
example.createCriteria().andIdIn(requests.stream().map(RunTestPlanRequest::getId).collect(Collectors.toList()));
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(loadTests)) {
List<String> ids = loadTests.stream().map(LoadTest::getId).collect(Collectors.toList());
List<String> names = loadTests.stream().map(LoadTest::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), loadTests.get(0).getProjectId(), String.join(",", names), null, new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*;
@ -11,6 +12,7 @@ import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.*;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService;
@ -21,6 +23,7 @@ import io.metersphere.track.request.report.QueryTestPlanReportRequest;
import io.metersphere.track.request.report.TestPlanReportSaveRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import io.metersphere.track.request.testplan.LoadCaseRequest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -553,4 +556,16 @@ public class TestPlanReportService {
}
return ids;
}
public String getLogDetails(List<String> ids) {
TestPlanReportExample example = new TestPlanReportExample();
example.createCriteria().andIdIn(ids);
List<TestPlanReport> nodes = testPlanReportMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(nodes)) {
List<String> names = nodes.stream().map(TestPlanReport::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), null, String.join(",", names), null, new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -4,17 +4,19 @@ import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.automation.*;
import io.metersphere.api.service.ApiAutomationService;
import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.base.domain.TestPlanApiScenario;
import io.metersphere.base.domain.TestPlanApiScenarioExample;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.track.dto.RelevanceScenarioRequest;
import io.metersphere.track.request.testcase.TestPlanScenarioCaseBatchRequest;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
@ -33,6 +35,10 @@ public class TestPlanScenarioCaseService {
ExtTestPlanScenarioCaseMapper extTestPlanScenarioCaseMapper;
@Resource
ApiScenarioReportService apiScenarioReportService;
@Resource
ApiScenarioMapper apiScenarioMapper;
@Resource
private TestPlanMapper testPlanMapper;
public List<ApiScenarioDTO> list(TestPlanScenarioRequest request) {
request.setProjectId(null);
@ -72,7 +78,7 @@ public class TestPlanScenarioCaseService {
public void deleteApiCaseBath(TestPlanScenarioCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
ids = this.selectIds(request.getCondition());
if (request.getCondition() != null && request.getCondition().getUnSelectIds() != null) {
ids.removeAll(request.getCondition().getUnSelectIds());
@ -164,7 +170,10 @@ public class TestPlanScenarioCaseService {
Map<String, String> envMap = request.getEnvMap();
Map<String, List<String>> mapping = request.getMapping();
Set<String> set = mapping.keySet();
if (set.isEmpty()) { return; }
if (set.isEmpty()) {
return;
}
request.setIds(new ArrayList<>(set));
set.forEach(id -> {
Map<String, String> newEnvMap = new HashMap<>(16);
if (envMap != null && !envMap.isEmpty()) {
@ -199,4 +208,32 @@ public class TestPlanScenarioCaseService {
tableRequest.setIds(ids);
return extTestPlanScenarioCaseMapper.list(tableRequest);
}
public String getLogDetails(String id) {
TestPlanApiScenario scenario = testPlanApiScenarioMapper.selectByPrimaryKey(id);
if (scenario != null) {
ApiScenarioWithBLOBs testCase = apiScenarioMapper.selectByPrimaryKey(scenario.getApiScenarioId());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(scenario.getTestPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), testPlan.getProjectId(), testCase.getName(), scenario.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(List<String> ids) {
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
example.createCriteria().andIdIn(ids);
List<TestPlanApiScenario> nodes = testPlanApiScenarioMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(nodes)) {
ApiScenarioExample scenarioExample = new ApiScenarioExample();
scenarioExample.createCriteria().andIdIn(nodes.stream().map(TestPlanApiScenario::getApiScenarioId).collect(Collectors.toList()));
List<ApiScenario> scenarios = apiScenarioMapper.selectByExample(scenarioExample);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(scenarios)) {
List<String> names = scenarios.stream().map(ApiScenario::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), scenarios.get(0).getProjectId(), String.join(",", names), nodes.get(0).getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
}
return null;
}
}

View File

@ -24,6 +24,10 @@ import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*;
import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.track.TestPlanReference;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.performance.request.RunTestPlanRequest;
@ -118,9 +122,9 @@ public class TestPlanService {
@Resource
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
@Resource
private ApiTestCaseMapper apiTestCaseMapper;
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private TestPlanApiCaseMapper testPlanApiCaseMapper;
@Resource
@ -141,9 +145,6 @@ public class TestPlanService {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
}
String testPlanId = UUID.randomUUID().toString();
testPlan.setId(testPlanId);
testPlan.setStatus(TestPlanStatus.Prepare.name());
testPlan.setCreateTime(System.currentTimeMillis());
testPlan.setUpdateTime(System.currentTimeMillis());
@ -212,10 +213,9 @@ public class TestPlanService {
userIds.add(testPlan.getPrincipal());
AddTestPlanRequest testPlans = new AddTestPlanRequest();
int i;
if(testPlan.getName() == null) {// 若是点击该测试计划则仅更新了updateTime其它字段全为null使用updateByPrimaryKeySelective
if (testPlan.getName() == null) {// 若是点击该测试计划则仅更新了updateTime其它字段全为null使用updateByPrimaryKeySelective
i = testPlanMapper.updateByPrimaryKeySelective(testPlan);
}
else { // 有修改字段的调用为保证将某些时间置null的情况使用updateByPrimaryKey
} else { // 有修改字段的调用为保证将某些时间置null的情况使用updateByPrimaryKey
extScheduleMapper.updateNameByResourceID(testPlan.getId(), testPlan.getName());// 同步更新该测试的定时任务的name
i = testPlanMapper.updateByPrimaryKeyWithBLOBs(testPlan); // 更新
}
@ -408,14 +408,14 @@ public class TestPlanService {
// Prepare, Pass, Failure, Blocking, Skip, Underway
TestPlanDTO testPlanDTO = new TestPlanDTO();
testPlanDTO.setId(testPlanId);
if(statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
if (statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
testPlanDTO.setStatus(TestPlanStatus.Prepare.name());
editTestPlan(testPlanDTO, false);
return;
}
int passNum = 0, prepareNum = 0, failNum = 0;
for(String res : statusList) {
if(StringUtils.equals(res, TestPlanTestCaseStatus.Pass.name())
for (String res : statusList) {
if (StringUtils.equals(res, TestPlanTestCaseStatus.Pass.name())
|| StringUtils.equals(res, "success")
|| StringUtils.equals(res, ScenarioStatus.Success.name())) {
passNum++;
@ -425,13 +425,13 @@ public class TestPlanService {
failNum++;
}
}
if(passNum == statusList.size()) { // 全部通过
if (passNum == statusList.size()) { // 全部通过
testPlanDTO.setStatus(TestPlanStatus.Completed.name());
this.editTestPlan(testPlanDTO, false);
} else if(prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
testPlanDTO.setStatus(TestPlanStatus.Finished.name());
editTestPlan(testPlanDTO, false);
} else if(prepareNum != 0) { // 进行中
} else if (prepareNum != 0) { // 进行中
testPlanDTO.setStatus(TestPlanStatus.Underway.name());
editTestPlan(testPlanDTO, false);
}
@ -473,6 +473,7 @@ public class TestPlanService {
TestCaseWithBLOBs testCase = testCaseMap.get(caseId);
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setCreateUser(SessionUtils.getUserId());
testPlanTestCase.setExecutor(SessionUtils.getUser().getId());
testPlanTestCase.setCaseId(caseId);
testPlanTestCase.setCreateTime(System.currentTimeMillis());
@ -486,31 +487,31 @@ public class TestPlanService {
sqlSession.flushStatements();
//同步添加关联的接口和测试用例
if(request.getChecked()){
if (request.getChecked()) {
if (!testCaseIds.isEmpty()) {
testCaseIds.forEach(caseId -> {
List<TestCaseTest> list=new ArrayList<>();
TestCaseTestExample examp=new TestCaseTestExample();
List<TestCaseTest> list = new ArrayList<>();
TestCaseTestExample examp = new TestCaseTestExample();
examp.createCriteria().andTestCaseIdEqualTo(caseId);
if(testCaseTestMapper.countByExample(examp)>0){
list=testCaseTestMapper.selectByExample(examp);
if (testCaseTestMapper.countByExample(examp) > 0) {
list = testCaseTestMapper.selectByExample(examp);
}
list.forEach(l->{
if(StringUtils.equals(l.getTestType(),TestCaseStatus.performance.name())){
list.forEach(l -> {
if (StringUtils.equals(l.getTestType(), TestCaseStatus.performance.name())) {
TestPlanLoadCase t = new TestPlanLoadCase();
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setLoadCaseId(l.getTestId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanLoadCaseExample testPlanLoadCaseExample=new TestPlanLoadCaseExample();
TestPlanLoadCaseExample testPlanLoadCaseExample = new TestPlanLoadCaseExample();
testPlanLoadCaseExample.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andLoadCaseIdEqualTo(t.getLoadCaseId());
if (testPlanLoadCaseMapper.countByExample(testPlanLoadCaseExample) <=0) {
if (testPlanLoadCaseMapper.countByExample(testPlanLoadCaseExample) <= 0) {
testPlanLoadCaseMapper.insert(t);
}
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.testcase.name())){
if (StringUtils.equals(l.getTestType(), TestCaseStatus.testcase.name())) {
TestPlanApiCase t = new TestPlanApiCase();
ApiTestCaseWithBLOBs apitest = apiTestCaseMapper.selectByPrimaryKey(l.getTestId());
if (null != apitest) {
@ -530,9 +531,9 @@ public class TestPlanService {
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.automation.name())){
TestPlanApiScenario t=new TestPlanApiScenario();
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(l.getTestId());
if (StringUtils.equals(l.getTestType(), TestCaseStatus.automation.name())) {
TestPlanApiScenario t = new TestPlanApiScenario();
ApiScenarioWithBLOBs testPlanApiScenario = apiScenarioMapper.selectByPrimaryKey(l.getTestId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiScenarioId(l.getTestId());
@ -542,9 +543,9 @@ public class TestPlanService {
t.setStatus(testPlanApiScenario.getStatus());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiScenarioExample example=new TestPlanApiScenarioExample();
TestPlanApiScenarioExample example = new TestPlanApiScenarioExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiScenarioIdEqualTo(t.getApiScenarioId());
if(testPlanApiScenarioMapper.countByExample(example)<=0){
if (testPlanApiScenarioMapper.countByExample(example) <= 0) {
testPlanApiScenarioMapper.insert(t);
}
@ -936,10 +937,10 @@ public class TestPlanService {
scenarios.add(scenario);
// 创建场景报告
//不同的运行模式第二个参数入参不同
APIScenarioReportResult report = apiAutomationService.createScenarioReport(group.getName(),
APIScenarioReportResult report = apiAutomationService.createScenarioReport(group.getName(),
planScenarioID + ":" + request.getTestPlanReportId(),
item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
request.getExecuteType(), item.getProjectId(), request.getReportUserID(),null);
request.getExecuteType(), item.getProjectId(), request.getReportUserID(), null);
apiScenarioReportMapper.insert(report);
group.setHashTree(scenarios);
testPlan.getHashTree().add(group);
@ -997,9 +998,9 @@ public class TestPlanService {
String performanceCaseIdArray = "";
String planReportId = UUID.randomUUID().toString();
//创建测试报告然后返回的ID重新赋值为resourceID作为后续的参数
TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(planReportId,testPlanID,userId,triggerMode,
apiTestCaseIdMap.size()>0,planScenarioIdMap.size()>0,performanceIdMap.size()>0,
JSONArray.toJSONString(new ArrayList<>(apiTestCaseIdMap.keySet())),JSONArray.toJSONString(new ArrayList<>(planScenarioIdMap.keySet())),JSONArray.toJSONString(new ArrayList<>(performanceIdMap.values())));
TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(planReportId, testPlanID, userId, triggerMode,
apiTestCaseIdMap.size() > 0, planScenarioIdMap.size() > 0, performanceIdMap.size() > 0,
JSONArray.toJSONString(new ArrayList<>(apiTestCaseIdMap.keySet())), JSONArray.toJSONString(new ArrayList<>(planScenarioIdMap.keySet())), JSONArray.toJSONString(new ArrayList<>(performanceIdMap.values())));
TestPlanReport testPlanReport = testPlanReportService.genTestPlanReport(saveRequest);
@ -1032,13 +1033,13 @@ public class TestPlanService {
} catch (Exception e) {
e.printStackTrace();
}
if(StringUtils.isEmpty(reportId)){
if (StringUtils.isEmpty(reportId)) {
performaceIsExcuting = false;
}
}
if(performaceIsExcuting){
performanceCaseIdArray= JSONArray.toJSONString(new ArrayList<>(performanceIdMap.values()));
if (performaceIsExcuting) {
performanceCaseIdArray = JSONArray.toJSONString(new ArrayList<>(performanceIdMap.values()));
}
if (!performaneReportIDList.isEmpty()) {
@ -1056,7 +1057,7 @@ public class TestPlanService {
apiTestCaseService.run(blobs, UUID.randomUUID().toString(), planReportId, testPlanID, ApiRunMode.SCHEDULE_API_PLAN.name());
apiCaseIsExcuting = true;
}
if(apiCaseIsExcuting){
if (apiCaseIsExcuting) {
apiCaseIdArray = JSONArray.toJSONString(new ArrayList<>(apiTestCaseIdMap.keySet()));
}
@ -1077,19 +1078,53 @@ public class TestPlanService {
scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name());
scenarioRequest.setTestPlanReportId(planReportId);
String scenarioReportID = this.runScenarioCase(scenarioRequest);
if(StringUtils.isNotEmpty(scenarioReportID)){
if (StringUtils.isNotEmpty(scenarioReportID)) {
scenarioIsExcuting = true;
scenarioCaseIdArray= JSONArray.toJSONString(new ArrayList<>(planScenarioIdMap.keySet()));
scenarioCaseIdArray = JSONArray.toJSONString(new ArrayList<>(planScenarioIdMap.keySet()));
}
}
//如果report参数和预期不对某些原因执行失败则更新report
if(saveRequest.isApiCaseIsExecuting() != apiCaseIsExcuting ||saveRequest.isScenarioIsExecuting()!=scenarioIsExcuting ||saveRequest.isPerformanceIsExecuting() != performaceIsExcuting){
if (saveRequest.isApiCaseIsExecuting() != apiCaseIsExcuting || saveRequest.isScenarioIsExecuting() != scenarioIsExcuting || saveRequest.isPerformanceIsExecuting() != performaceIsExcuting) {
testPlanReport.setIsApiCaseExecuting(apiCaseIsExcuting);
testPlanReport.setIsScenarioExecuting(scenarioIsExcuting);
testPlanReport.setIsPerformanceExecuting(performaceIsExcuting);
testPlanReportService.update(testPlanReport);
}
}
public String getLogDetails(String id) {
TestPlan plan = testPlanMapper.selectByPrimaryKey(id);
if (plan != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(plan, TestPlanReference.testPlanColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), plan.getProjectId(), plan.getName(), plan.getCreator(), columns);
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(PlanCaseRelevanceRequest request) {
List<String> testCaseIds = request.getTestCaseIds();
List<String> names = null;
if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) {
names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
} else {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(testCaseIds);
List<TestCase> cases = testCaseMapper.selectByExample(example);
names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
}
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId());
if (testPlan != null) {
List<DetailColumn> columns = new LinkedList<>();
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(testCaseIds), testPlan.getProjectId(), String.join(",", names) + " 关联到 " + "" + testPlan.getName() + "", testPlan.getCreator(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
@ -10,6 +11,8 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
@ -17,12 +20,14 @@ import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseBatchRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -50,6 +55,10 @@ public class TestPlanTestCaseService {
private ApiTestCaseMapper apiTestCaseMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
private TestCaseMapper testCaseMapper;
@Resource
private TestPlanMapper testPlanMapper;
public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -63,6 +72,7 @@ public class TestPlanTestCaseService {
});
return list;
}
public List<TestPlanCaseDTO> listByPlanId(QueryTestPlanCaseRequest request) {
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.listByPlanId(request);
return list;
@ -93,9 +103,9 @@ public class TestPlanTestCaseService {
public void editTestCaseBath(TestPlanCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
ids = extTestPlanTestCaseMapper.selectIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
if (request.getCondition().getUnSelectIds() != null) {
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
@ -213,13 +223,58 @@ public class TestPlanTestCaseService {
public List<String> idList(TestPlanFuncCaseBatchRequest request) {
List<String> returnIdList = new ArrayList<>();
TestPlanFuncCaseConditions conditions = request.getCondition();
if(conditions!= null && conditions.isSelectAll()){
if (conditions != null && conditions.isSelectAll()) {
conditions.setOrders(ServiceUtils.getDefaultOrder(conditions.getOrders()));
returnIdList = extTestPlanTestCaseMapper.selectIds(conditions);
if(conditions.getUnSelectIds()!=null){
if (conditions.getUnSelectIds() != null) {
returnIdList.removeAll(conditions.getUnSelectIds());
}
}
return returnIdList;
}
public String getLogDetails(String id) {
TestPlanTestCaseWithBLOBs planTestCaseWithBLOBs = testPlanTestCaseMapper.selectByPrimaryKey(id);
if (planTestCaseWithBLOBs != null) {
TestCase testCase = testCaseMapper.selectByPrimaryKey(planTestCaseWithBLOBs.getCaseId());
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(planTestCaseWithBLOBs.getPlanId());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), testCase.getProjectId(), testCase.getName(), planTestCaseWithBLOBs.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(List<String> ids) {
TestPlanTestCaseExample example = new TestPlanTestCaseExample();
example.createCriteria().andIdIn(ids);
List<TestPlanTestCase> nodes = testPlanTestCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(nodes)) {
TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andIdIn(nodes.stream().map(TestPlanTestCase::getCaseId).collect(Collectors.toList()));
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
if (CollectionUtils.isNotEmpty(testCases)) {
List<String> names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), testCases.get(0).getProjectId(), String.join(",", names), nodes.get(0).getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
}
return null;
}
public String getCaseLogDetails(List<TestPlanTestCaseWithBLOBs> testCases) {
// 更新状态
if (CollectionUtils.isNotEmpty(testCases)) {
List<DetailColumn> columns = new LinkedList<>();
TestCaseExample example = new TestCaseExample();
List<String> ids = testCases.stream().map(TestPlanTestCaseWithBLOBs::getCaseId).collect(Collectors.toList());
example.createCriteria().andIdIn(ids);
List<TestCase> cases = testCaseMapper.selectByExample(example);
if (cases != null && cases.size() > 0) {
List<String> names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), cases.get(0).getProjectId(), String.join(",", names), cases.get(0).getCreateUser(), columns);
return JSON.toJSONString(details);
}
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
@ -8,19 +9,23 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.StatusReference;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testplancase.TestReviewCaseBatchRequest;
import io.metersphere.track.request.testreview.DeleteRelevanceRequest;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -115,9 +120,9 @@ public class TestReviewTestCaseService {
public void deleteTestCaseBatch(TestReviewCaseBatchRequest request) {
checkReviewer(request.getReviewId());
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
ids = this.selectIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
if (request.getCondition().getUnSelectIds() != null) {
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
@ -149,7 +154,7 @@ public class TestReviewTestCaseService {
}
public TestReviewCaseDTO get(String reviewId) {
TestReviewCaseDTO testReviewCaseDTO=extTestReviewCaseMapper.get(reviewId);
TestReviewCaseDTO testReviewCaseDTO = extTestReviewCaseMapper.get(reviewId);
List<TestCaseTestDTO> testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testReviewCaseDTO.getCaseId());
testCaseTestDTOS.forEach(dto -> {
setTestName(dto);
@ -187,9 +192,9 @@ public class TestReviewTestCaseService {
public void editTestCaseBatchStatus(TestReviewCaseBatchRequest request) {
List<String> ids = request.getIds();
if(request.getCondition()!=null && request.getCondition().isSelectAll()){
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
ids = extTestReviewCaseMapper.selectTestCaseIds(request.getCondition());
if(request.getCondition().getUnSelectIds()!=null){
if (request.getCondition().getUnSelectIds() != null) {
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
@ -239,4 +244,99 @@ public class TestReviewTestCaseService {
testCaseList.forEach(testCaseMapper::updateByPrimaryKeySelective);
}
}
public String getLogDetails(DeleteRelevanceRequest request) {
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
TestCaseReviewTestCase testCaseReviewTestCase = testCaseReviewTestCaseMapper.selectByPrimaryKey(request.getId());
StringBuilder titleBuilder = new StringBuilder();
if (testCaseReviewTestCase != null) {
TestCaseWithBLOBs bloBs = testCaseMapper.selectByPrimaryKey(testCaseReviewTestCase.getCaseId());
if (bloBs != null) {
titleBuilder.append(bloBs.getName()).append("");
}
}
if (caseReview != null) {
titleBuilder.append(caseReview.getName());
}
if (StringUtils.isNotEmpty(titleBuilder.toString())) {
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getId()), caseReview.getProjectId(), titleBuilder.toString(), caseReview.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(TestReviewCaseBatchRequest request) {
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
example.createCriteria().andIdIn(request.getIds());
List<TestCaseReviewTestCase> testCaseReviewTestCases = testCaseReviewTestCaseMapper.selectByExample(example);
StringBuilder titleBuilder = new StringBuilder();
if (CollectionUtils.isNotEmpty(testCaseReviewTestCases)) {
testCaseReviewTestCases.forEach(item -> {
TestCaseWithBLOBs bloBs = testCaseMapper.selectByPrimaryKey(item.getCaseId());
if (bloBs != null) {
titleBuilder.append(bloBs.getName()).append(",");
}
});
titleBuilder.append("");
}
if (caseReview != null) {
titleBuilder.append(caseReview.getName());
}
if (StringUtils.isNotEmpty(titleBuilder.toString())) {
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getId()), caseReview.getProjectId(), titleBuilder.toString(), caseReview.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
public String batchLogDetails(TestReviewCaseBatchRequest request) {
List<String> ids = request.getIds();
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
ids = extTestReviewCaseMapper.selectTestCaseIds(request.getCondition());
if (request.getCondition().getUnSelectIds() != null) {
ids.removeAll(request.getCondition().getUnSelectIds());
}
}
// 更新状态
if (StringUtils.isNotBlank(request.getStatus())) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(ids);
List<TestCase> cases = testCaseMapper.selectByExample(example);
List<DetailColumn> columns = new LinkedList<>();
List<String> names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), cases.get(0).getProjectId(), String.join(",", names) + "评审结果更改为:" + "" + StatusReference.statusMap.get(request.getStatus()) + "", cases.get(0).getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
public String getLogDetails(List<TestCaseReviewTestCase> testCases) {
// 更新状态
if (CollectionUtils.isNotEmpty(testCases)) {
List<DetailColumn> columns = new LinkedList<>();
TestCaseExample example = new TestCaseExample();
List<String> ids = testCases.stream().map(TestCaseReviewTestCase::getCaseId).collect(Collectors.toList());
example.createCriteria().andIdIn(ids);
List<TestCase> cases = testCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(cases)) {
List<String> names = cases.stream().map(TestCase::getName).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), cases.get(0).getProjectId(), String.join(",", names), cases.get(0).getCreateUser(), columns);
return JSON.toJSONString(details);
}
}
return null;
}
public String getLogDetails(TestCaseReviewTestCase request) {
TestCaseReview caseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
TestCaseWithBLOBs caseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId());
if (caseWithBLOBs != null) {
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getId()), caseReview.getProjectId(), caseWithBLOBs.getName(), caseReview.getCreateUser(), new LinkedList<>());
return JSON.toJSONString(details);
}
return null;
}
}

@ -1 +1 @@
Subproject commit 9a95a444a4f0a477427f94bd107571430d85e766
Subproject commit e435fe1d01a2495481efa58daf3875be07b2ac9b

View File

@ -39,22 +39,6 @@ CREATE TABLE `operating_log` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- add all table create_user
ALTER TABLE api_definition
ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_module
ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario
ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario_module
ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario_report
ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_node
ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case
ADD create_user VARCHAR(100) NULL;
-- system_parameter
UPDATE system_parameter
SET param_key = 'base.prometheus.host'
@ -69,3 +53,19 @@ alter table load_test_report
alter table load_test_report
add test_duration BIGINT(13) null;
-- add all table create_user
ALTER TABLE api_definition ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_module ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario_module ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_scenario_report ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_node ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_review ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_plan_test_case ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_review_test_case ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_plan_api_case ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_plan_api_scenario ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_plan_load_case ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_report ADD create_user VARCHAR(100) NULL;

View File

@ -77,7 +77,7 @@
<table tableName="test_case_review_scenario"/>
<table tableName="test_plan"/>
<table tableName="test_case_test"/>-->
<table tableName="api_environment_running_param"></table>
<table tableName="test_case_report"></table>
<!-- <table tableName="custom_field"></table>-->
<!-- <table tableName="test_case"></table>-->
<!-- <table tableName="test_case"></table>-->

View File

@ -67,6 +67,7 @@
{id: 'BATCH_DEL', label: this.$t('api_test.definition.request.batch_delete')},
{id: 'BATCH_UPDATE', label: this.$t('api_test.definition.request.batch_edit')},
{id: 'BATCH_ADD', label: this.$t('commons.batch_add')},
{id: 'UN_ASSOCIATE_CASE', label: this.$t('test_track.case.unlink')},
{id: 'BATCH_RESTORE', label: "批量恢复"},
{id: 'BATCH_GC', label: "批量回收"}
],
@ -91,6 +92,7 @@
['BATCH_ADD', this.$t('commons.batch_add')],
['BATCH_RESTORE', "批量恢复"],
['BATCH_GC', "批量回收"],
['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')],
])
}
},

View File

@ -115,6 +115,7 @@
{id: 'IMPORT', label: this.$t('api_test.api_import.label')},
{id: 'EXPORT', label: this.$t('commons.export')},
{id: 'ASSOCIATE_CASE', label: this.$t('test_track.review_view.relevance_case')},
{id: 'UN_ASSOCIATE_CASE', label: this.$t('test_track.case.unlink')},
{id: 'REVIEW', label: this.$t('test_track.review_view.start_review')},
{id: 'COPY', label: this.$t('commons.copy')},
{id: 'EXECUTE', label: this.$t('api_test.automation.execute')},
@ -137,6 +138,7 @@
['IMPORT', this.$t('api_test.api_import.label')],
['EXPORT', this.$t('commons.export')],
['ASSOCIATE_CASE', this.$t('test_track.review_view.relevance_case')],
['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')],
['REVIEW', this.$t('test_track.review_view.start_review')],
['COPY', this.$t('commons.copy')],
['EXECUTE', this.$t('api_test.automation.execute')],

@ -1 +1 @@
Subproject commit 097d3a5a00beaa660d34525765d93b35e63f52c0
Subproject commit e50f0463826ac4d7837ea3a237333827774a1b19

View File

@ -1328,6 +1328,7 @@ export default {
batch_move_case: 'Batch move',
batch_delete_case: 'Batch delete',
batch_unlink: 'Batch Unlink',
unlink: 'Unlink',
project_name: "Project",
status: 'Review Status',
status_prepare: 'Not reviewed',

View File

@ -1333,6 +1333,7 @@ export default {
batch_move_case: '批量移动',
batch_delete_case: '批量删除',
batch_unlink: '批量取消关联',
unlink: '取消关联',
project_name: '所属项目',
status: '评审结果',
status_prepare: '未开始',

View File

@ -1333,6 +1333,7 @@ export default {
batch_move_case: '批量移動',
batch_delete_case: '批量刪除',
batch_unlink: '批量取消關聯',
unlink: '取消關聯',
project_name: '所屬項目',
status: '評審結果',
status_prepare: '未開始',