feat(系统设置): 完成系统设置整体操作日志

This commit is contained in:
fit2-zhao 2021-05-20 11:15:47 +08:00 committed by fit2-zhao
parent 5939389678
commit 0e6260021b
41 changed files with 867 additions and 70 deletions

View File

@ -7,10 +7,12 @@ import io.metersphere.api.dto.ssl.KeyStoreEntry;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.api.service.CommandService;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
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.controller.request.EnvironmentRequest;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -70,18 +72,21 @@ public class ApiTestEnvironmentController {
@PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#apiTestEnvironmentWithBLOBs.id)", msClass = ApiTestEnvironmentService.class)
public String create(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironmentWithBLOBs, @RequestPart(value = "files") List<MultipartFile> sslFiles) {
return apiTestEnvironmentService.add(apiTestEnvironmentWithBLOBs, sslFiles);
}
@PostMapping(value = "/update")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#apiTestEnvironment.id)", content = "#msClass.getLogDetails(#apiTestEnvironment.id)", msClass = ApiTestEnvironmentService.class)
public void update(@RequestPart("request") ApiTestEnvironmentDTO apiTestEnvironment, @RequestPart(value = "files") List<MultipartFile> sslFiles) {
apiTestEnvironmentService.update(apiTestEnvironment, sslFiles);
}
@GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_environment_setting", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestEnvironmentService.class)
public void delete(@PathVariable String id) {
apiTestEnvironmentService.delete(id);
}

View File

@ -1,5 +1,6 @@
package io.metersphere.api.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.ApiTestEnvironmentDTO;
@ -8,11 +9,16 @@ import io.metersphere.base.domain.ApiTestEnvironmentExample;
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.EnvironmentRequest;
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.system.SystemReference;
import io.metersphere.service.SystemParameterService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -77,6 +83,7 @@ public class ApiTestEnvironmentService {
public String add(ApiTestEnvironmentDTO request, List<MultipartFile> sslFiles) {
request.setId(UUID.randomUUID().toString());
request.setCreateUser(SessionUtils.getUserId());
checkEnvironmentExist(request);
FileUtils.createFiles(request.getUploadIds(), sslFiles, FileUtils.BODY_FILE_DIR + "/ssl");
apiTestEnvironmentMapper.insert(request);
@ -291,4 +298,14 @@ public class ApiTestEnvironmentService {
}
}
}
public String getLogDetails(String id) {
ApiTestEnvironmentWithBLOBs bloBs = apiTestEnvironmentMapper.selectByPrimaryKey(id);
if (bloBs != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(bloBs, SystemReference.environmentColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(bloBs.getId()), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

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 ApiTestEnvironment implements Serializable {
private String id;
@ -19,5 +20,7 @@ public class ApiTestEnvironment implements Serializable {
private Integer port;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -583,6 +583,76 @@ public class ApiTestEnvironmentExample {
addCriterion("port not between", value1, value2, "port");
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,10 +1,11 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ -17,5 +18,7 @@ public class ApiTestEnvironmentWithBLOBs extends ApiTestEnvironment implements S
private String hosts;
private String customData;
private static final long serialVersionUID = 1L;
}

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 CustomField implements Serializable {
private String id;
@ -25,6 +26,8 @@ public class CustomField implements Serializable {
private Long updateTime;
private String createUser;
private String options;
private static final long serialVersionUID = 1L;

View File

@ -763,6 +763,76 @@ public class CustomFieldExample {
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 IssueTemplate implements Serializable {
private String id;
@ -25,6 +26,8 @@ public class IssueTemplate implements Serializable {
private Long updateTime;
private String createUser;
private String content;
private static final long serialVersionUID = 1L;

View File

@ -763,6 +763,76 @@ public class IssueTemplateExample {
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

@ -11,6 +11,8 @@ public class TestCaseReportTemplate implements Serializable {
private String workspaceId;
private String createUser;
private String content;
private static final long serialVersionUID = 1L;

View File

@ -175,72 +175,72 @@ public class TestCaseReportTemplateExample {
}
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;
}
@ -313,6 +313,76 @@ public class TestCaseReportTemplateExample {
addCriterion("workspace_id not between", value1, value2, "workspaceId");
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 TestCaseTemplate implements Serializable {
private String id;
@ -29,5 +30,7 @@ public class TestCaseTemplate implements Serializable {
private String stepModel;
private String createUser;
private static final long serialVersionUID = 1L;
}

View File

@ -903,6 +903,76 @@ public class TestCaseTemplateExample {
addCriterion("step_model not between", value1, value2, "stepModel");
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

@ -9,12 +9,14 @@
<result column="socket" jdbcType="VARCHAR" property="socket" />
<result column="domain" jdbcType="VARCHAR" property="domain" />
<result column="port" jdbcType="INTEGER" property="port" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
<result column="variables" jdbcType="LONGVARCHAR" property="variables" />
<result column="headers" jdbcType="LONGVARCHAR" property="headers" />
<result column="config" jdbcType="LONGVARCHAR" property="config" />
<result column="hosts" jdbcType="LONGVARCHAR" property="hosts" />
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -75,10 +77,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, project_id, protocol, socket, `domain`, port
id, `name`, project_id, protocol, socket, `domain`, port, create_user
</sql>
<sql id="Blob_Column_List">
`variables`, headers, config, `hosts`
`variables`, headers, config, `hosts`, custom_data
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample" resultMap="ResultMapWithBLOBs">
select
@ -131,12 +133,14 @@
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
insert into api_test_environment (id, `name`, project_id,
protocol, socket, `domain`,
port, `variables`, headers,
config, `hosts`)
port, create_user, `variables`,
headers, config, `hosts`,
custom_data)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{protocol,jdbcType=VARCHAR}, #{socket,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR},
#{port,jdbcType=INTEGER}, #{variables,jdbcType=LONGVARCHAR}, #{headers,jdbcType=LONGVARCHAR},
#{config,jdbcType=LONGVARCHAR}, #{hosts,jdbcType=LONGVARCHAR})
#{port,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{variables,jdbcType=LONGVARCHAR},
#{headers,jdbcType=LONGVARCHAR}, #{config,jdbcType=LONGVARCHAR}, #{hosts,jdbcType=LONGVARCHAR},
#{customData,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs">
insert into api_test_environment
@ -162,6 +166,9 @@
<if test="port != null">
port,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="variables != null">
`variables`,
</if>
@ -174,6 +181,9 @@
<if test="hosts != null">
`hosts`,
</if>
<if test="customData != null">
custom_data,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -197,6 +207,9 @@
<if test="port != null">
#{port,jdbcType=INTEGER},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="variables != null">
#{variables,jdbcType=LONGVARCHAR},
</if>
@ -209,6 +222,9 @@
<if test="hosts != null">
#{hosts,jdbcType=LONGVARCHAR},
</if>
<if test="customData != null">
#{customData,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestEnvironmentExample" resultType="java.lang.Long">
@ -241,6 +257,9 @@
<if test="record.port != null">
port = #{record.port,jdbcType=INTEGER},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.variables != null">
`variables` = #{record.variables,jdbcType=LONGVARCHAR},
</if>
@ -253,6 +272,9 @@
<if test="record.hosts != null">
`hosts` = #{record.hosts,jdbcType=LONGVARCHAR},
</if>
<if test="record.customData != null">
custom_data = #{record.customData,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -267,10 +289,12 @@
socket = #{record.socket,jdbcType=VARCHAR},
`domain` = #{record.domain,jdbcType=VARCHAR},
port = #{record.port,jdbcType=INTEGER},
create_user = #{record.createUser,jdbcType=VARCHAR},
`variables` = #{record.variables,jdbcType=LONGVARCHAR},
headers = #{record.headers,jdbcType=LONGVARCHAR},
config = #{record.config,jdbcType=LONGVARCHAR},
`hosts` = #{record.hosts,jdbcType=LONGVARCHAR}
`hosts` = #{record.hosts,jdbcType=LONGVARCHAR},
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -283,7 +307,8 @@
protocol = #{record.protocol,jdbcType=VARCHAR},
socket = #{record.socket,jdbcType=VARCHAR},
`domain` = #{record.domain,jdbcType=VARCHAR},
port = #{record.port,jdbcType=INTEGER}
port = #{record.port,jdbcType=INTEGER},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -309,6 +334,9 @@
<if test="port != null">
port = #{port,jdbcType=INTEGER},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="variables != null">
`variables` = #{variables,jdbcType=LONGVARCHAR},
</if>
@ -321,6 +349,9 @@
<if test="hosts != null">
`hosts` = #{hosts,jdbcType=LONGVARCHAR},
</if>
<if test="customData != null">
custom_data = #{customData,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -332,10 +363,12 @@
socket = #{socket,jdbcType=VARCHAR},
`domain` = #{domain,jdbcType=VARCHAR},
port = #{port,jdbcType=INTEGER},
create_user = #{createUser,jdbcType=VARCHAR},
`variables` = #{variables,jdbcType=LONGVARCHAR},
headers = #{headers,jdbcType=LONGVARCHAR},
config = #{config,jdbcType=LONGVARCHAR},
`hosts` = #{hosts,jdbcType=LONGVARCHAR}
`hosts` = #{hosts,jdbcType=LONGVARCHAR},
custom_data = #{customData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestEnvironment">
@ -345,7 +378,8 @@
protocol = #{protocol,jdbcType=VARCHAR},
socket = #{socket,jdbcType=VARCHAR},
`domain` = #{domain,jdbcType=VARCHAR},
port = #{port,jdbcType=INTEGER}
port = #{port,jdbcType=INTEGER},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -12,6 +12,7 @@
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<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>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.CustomField">
<result column="options" jdbcType="LONGVARCHAR" property="options" />
@ -76,7 +77,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, scene, `type`, remark, `system`, `global`, workspace_id, create_time,
update_time
update_time, create_user
</sql>
<sql id="Blob_Column_List">
`options`
@ -133,11 +134,11 @@
insert into custom_field (id, `name`, scene,
`type`, remark, `system`, `global`,
workspace_id, create_time, update_time,
`options`)
create_user, `options`)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scene,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{system,jdbcType=BIT}, #{global,jdbcType=BIT},
#{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{options,jdbcType=LONGVARCHAR})
#{createUser,jdbcType=VARCHAR}, #{options,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.CustomField">
insert into custom_field
@ -172,6 +173,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="options != null">
`options`,
</if>
@ -207,6 +211,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="options != null">
#{options,jdbcType=LONGVARCHAR},
</if>
@ -251,6 +258,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>
<if test="record.options != null">
`options` = #{record.options,jdbcType=LONGVARCHAR},
</if>
@ -271,6 +281,7 @@
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
`options` = #{record.options,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -287,7 +298,8 @@
`global` = #{record.global,jdbcType=BIT},
workspace_id = #{record.workspaceId,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>
@ -322,6 +334,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="options != null">
`options` = #{options,jdbcType=LONGVARCHAR},
</if>
@ -339,6 +354,7 @@
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
`options` = #{options,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -352,7 +368,8 @@
`global` = #{global,jdbcType=BIT},
workspace_id = #{workspaceId,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

@ -12,6 +12,7 @@
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<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>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.IssueTemplate">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -76,7 +77,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, platform, description, title, `system`, `global`, workspace_id, create_time,
update_time
update_time, create_user
</sql>
<sql id="Blob_Column_List">
content
@ -133,11 +134,13 @@
insert into issue_template (id, `name`, platform,
description, title, `system`,
`global`, workspace_id, create_time,
update_time, content)
update_time, create_user, content
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{system,jdbcType=BIT},
#{global,jdbcType=BIT}, #{workspaceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
#{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.IssueTemplate">
insert into issue_template
@ -172,6 +175,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="content != null">
content,
</if>
@ -207,6 +213,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
@ -251,6 +260,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>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
@ -271,6 +283,7 @@
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -287,7 +300,8 @@
`global` = #{record.global,jdbcType=BIT},
workspace_id = #{record.workspaceId,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>
@ -322,6 +336,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
@ -339,6 +356,7 @@
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -352,7 +370,8 @@
`global` = #{global,jdbcType=BIT},
workspace_id = #{workspaceId,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

@ -5,6 +5,7 @@
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReportTemplate">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -68,7 +69,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, workspace_id
id, `name`, workspace_id, create_user
</sql>
<sql id="Blob_Column_List">
content
@ -122,10 +123,10 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
insert into test_case_report_template (id, name, workspace_id,
content)
insert into test_case_report_template (id, `name`, workspace_id,
create_user, content)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR})
#{createUser,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
insert into test_case_report_template
@ -134,11 +135,14 @@
id,
</if>
<if test="name != null">
name,
`name`,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="content != null">
content,
</if>
@ -153,6 +157,9 @@
<if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
@ -171,11 +178,14 @@
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.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
@ -187,8 +197,9 @@
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_case_report_template
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -197,8 +208,9 @@
<update id="updateByExample" parameterType="map">
update test_case_report_template
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}
`name` = #{record.name,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -207,11 +219,14 @@
update test_case_report_template
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
@ -220,15 +235,17 @@
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
update test_case_report_template
set name = #{name,jdbcType=VARCHAR},
set `name` = #{name,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
update test_case_report_template
set name = #{name,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR}
set `name` = #{name,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -14,6 +14,7 @@
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="step_model" jdbcType="VARCHAR" property="stepModel" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseTemplateWithBLOBs">
<result column="step_description" jdbcType="LONGVARCHAR" property="stepDescription" />
@ -81,7 +82,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, `type`, description, case_name, `system`, `global`, workspace_id, prerequisite,
create_time, update_time, step_model
create_time, update_time, step_model, create_user
</sql>
<sql id="Blob_Column_List">
step_description, expected_result, actual_result, steps
@ -139,13 +140,13 @@
description, case_name, `system`,
`global`, workspace_id, prerequisite,
create_time, update_time, step_model,
step_description, expected_result,
create_user, step_description, expected_result,
actual_result, steps)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{caseName,jdbcType=VARCHAR}, #{system,jdbcType=BIT},
#{global,jdbcType=BIT}, #{workspaceId,jdbcType=VARCHAR}, #{prerequisite,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{stepModel,jdbcType=VARCHAR},
#{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{createUser,jdbcType=VARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{actualResult,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTemplateWithBLOBs">
@ -187,6 +188,9 @@
<if test="stepModel != null">
step_model,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="stepDescription != null">
step_description,
</if>
@ -237,6 +241,9 @@
<if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="stepDescription != null">
#{stepDescription,jdbcType=LONGVARCHAR},
</if>
@ -296,6 +303,9 @@
<if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.stepDescription != null">
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
</if>
@ -327,6 +337,7 @@
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
step_model = #{record.stepModel,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
actual_result = #{record.actualResult,jdbcType=LONGVARCHAR},
@ -348,7 +359,8 @@
prerequisite = #{record.prerequisite,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
step_model = #{record.stepModel,jdbcType=VARCHAR}
step_model = #{record.stepModel,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -389,6 +401,9 @@
<if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="stepDescription != null">
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
</if>
@ -417,6 +432,7 @@
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
step_model = #{stepModel,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
actual_result = #{actualResult,jdbcType=LONGVARCHAR},
@ -435,7 +451,8 @@
prerequisite = #{prerequisite,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
step_model = #{stepModel,jdbcType=VARCHAR}
step_model = #{stepModel,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -3,10 +3,12 @@ package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.CustomField;
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.controller.request.QueryCustomFieldRequest;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CustomFieldService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -24,6 +26,7 @@ public class CustomFieldController {
private CustomFieldService customFieldService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
public String add(@RequestBody CustomField customField) {
return customFieldService.add(customField);
}
@ -40,11 +43,13 @@ public class CustomFieldController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = CustomFieldService.class)
public void delete(@PathVariable(value = "id") String id) {
customFieldService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#customField.id)", content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
public void update(@RequestBody CustomField customField) {
customFieldService.update(customField);
}

View File

@ -3,12 +3,14 @@ package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.IssueTemplate;
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.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.UpdateIssueTemplateRequest;
import io.metersphere.dto.IssueTemplateDao;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.IssueTemplateService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -25,6 +27,7 @@ public class IssueTemplateController {
private IssueTemplateService issueTemplateService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
public void add(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.add(request);
}
@ -36,11 +39,13 @@ public class IssueTemplateController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssueTemplateService.class)
public void delete(@PathVariable(value = "id") String id) {
issueTemplateService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
public void update(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.update(request);
}

View File

@ -2,11 +2,12 @@ package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.base.domain.JarConfig;
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.service.JarConfigService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -48,18 +49,21 @@ public class JarConfigController {
@PostMapping(value = "/add", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class)
public String add(@RequestPart("request") JarConfig request, @RequestPart(value = "file") MultipartFile file) {
return JarConfigService.add(request, file);
}
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = JarConfigService.class)
public void update(@RequestPart("request") JarConfig request, @RequestPart(value = "file", required = false) MultipartFile file) {
JarConfigService.update(request, file);
}
@GetMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_jar", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = JarConfigService.class)
public void delete(@PathVariable String id) {
JarConfigService.delete(id);
}

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.api.service.ApiTestEnvironmentService;
import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.Project;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
@ -12,6 +13,7 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.AddProjectRequest;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.dto.ProjectDTO;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.CheckPermissionService;
import io.metersphere.service.ProjectService;
import org.apache.shiro.authz.annotation.Logical;
@ -67,6 +69,7 @@ public class ProjectController {
@PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#project.id)", msClass = ProjectService.class)
public Project addProject(@RequestBody AddProjectRequest project, HttpServletRequest request) {
Project returnModel = projectService.addProject(project);
@ -90,6 +93,7 @@ public class ProjectController {
@GetMapping("/delete/{projectId}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#projectId)", msClass = ProjectService.class)
public void deleteProject(@PathVariable(value = "projectId") String projectId) {
checkPermissionService.checkProjectOwner(projectId);
projectService.deleteProject(projectId);
@ -97,21 +101,25 @@ public class ProjectController {
@PostMapping("/update")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER,}, logical = Logical.OR)
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#Project.id)", content = "#msClass.getLogDetails(#Project.id)", msClass = ProjectService.class)
public void updateProject(@RequestBody Project Project) {
projectService.updateProject(Project);
}
@PostMapping(value = "upload/files/{projectId}", consumes = {"multipart/form-data"})
@MsAuditLog(module = "project_file_management", type = OperLogConstants.IMPORT, content = "#msClass.getLogDetails(#projectId)", msClass = ProjectService.class)
public List<FileMetadata> uploadFiles(@PathVariable String projectId, @RequestPart(value = "file") List<MultipartFile> files) {
return projectService.uploadFiles(projectId, files);
}
@PostMapping(value = "/update/file/{fileId}", consumes = {"multipart/form-data"})
@MsAuditLog(module = "project_file_management", type = OperLogConstants.IMPORT, content = "#msClass.getLogDetails(#fileId)", msClass = ProjectService.class)
public FileMetadata updateFile(@PathVariable String fileId, @RequestPart(value = "file") MultipartFile file) {
return projectService.updateFile(fileId, file);
}
@GetMapping(value = "delete/file/{fileId}")
@MsAuditLog(module = "project_project_manager", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#fileId)", msClass = ProjectService.class)
public void deleteFile(@PathVariable String fileId) {
projectService.deleteFile(fileId);
}

View File

@ -4,12 +4,14 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestCaseTemplate;
import io.metersphere.base.domain.TestCaseTemplateWithBLOBs;
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.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.UpdateCaseFieldTemplateRequest;
import io.metersphere.dto.TestCaseTemplateDao;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.TestCaseTemplateService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -27,6 +29,7 @@ public class TestCaseTemplateController {
private TestCaseTemplateService testCaseTemplateService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
public void add(@RequestBody UpdateCaseFieldTemplateRequest request) {
testCaseTemplateService.add(request);
}
@ -39,11 +42,13 @@ public class TestCaseTemplateController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseTemplateService.class)
public void delete(@PathVariable(value = "id") String id) {
testCaseTemplateService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
public void update(@RequestBody UpdateCaseFieldTemplateRequest request) {
testCaseTemplateService.update(request);
}

View File

@ -154,7 +154,7 @@ public class UserController {
}
@PostMapping("/update/current")
@MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
@MsAuditLog(module = "personal_information_personal_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
public UserDTO updateCurrentUser(@RequestBody User user) {
String currentUserId = SessionUtils.getUserId();
if (!StringUtils.equals(currentUserId, user.getId())) {

View File

@ -1,8 +1,10 @@
package io.metersphere.controller;
import io.metersphere.base.domain.UserKey;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.security.ApiKeyHandler;
import io.metersphere.service.UserKeyService;
import org.apache.shiro.authz.annotation.Logical;
@ -37,12 +39,14 @@ public class UserKeysController {
}
@GetMapping("generate")
@MsAuditLog(module = "personal_information_apikeys", type = OperLogConstants.CREATE, title = "API KEY")
public void generateUserKey() {
String userId = SessionUtils.getUser().getId();
userKeyService.generateUserKey(userId);
}
@GetMapping("delete/{id}")
@MsAuditLog(module = "personal_information_apikeys", type = OperLogConstants.DELETE, title = "API KEY")
public void deleteUserKey(@PathVariable String id) {
userKeyService.deleteUserKey(id);
}
@ -53,6 +57,7 @@ public class UserKeysController {
}
@GetMapping("disable/{id}")
@MsAuditLog(module = "personal_information_apikeys", type = OperLogConstants.UPDATE, title = "API KEY")
public void disabledUserKey(@PathVariable String id) {
userKeyService.disableUserKey(id);
}

View File

@ -113,7 +113,7 @@ public class WorkspaceController {
@PostMapping("/member/update")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "system_workspace", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO.id)", content = "#msClass.getLogDetails(#memberDTO.id)", msClass = WorkspaceService.class)
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, title = "#memberDTO.name")
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
workspaceService.updateWorkspaceMember(memberDTO);
}

View File

@ -21,6 +21,30 @@ public class StatusReference {
statusMap.put("smoke", "冒烟测试");
statusMap.put("system", "系统测试");
statusMap.put("regression", "回归测试");
statusMap.put("TEST_CASE", "用例模版");
statusMap.put("ISSUE", "缺陷模版");
statusMap.put("input", "输入框");
statusMap.put("textarea", "文本框");
statusMap.put("select", "单选下拉列表");
statusMap.put("multipleSelect", "多选下拉列表");
statusMap.put("radio", "单选框");
statusMap.put("checkbox", "多选框");
statusMap.put("member", "单选成员");
statusMap.put("multipleMember", "多选成员");
statusMap.put("data", "日期");
statusMap.put("int", "整型");
statusMap.put("float", "浮点型");
statusMap.put("EMAIL", "邮件");
statusMap.put("EXECUTE_SUCCESSFUL", "执行成功");
statusMap.put("EXECUTE_FAILED", "执行失败");
statusMap.put("JENKINS_TASK", "Jenkins接口调用任务通知");
statusMap.put("DEFECT_TASK", "缺陷任务通知");
statusMap.put("CREATE", "创建");
statusMap.put("UPDATE", "修改");
statusMap.put("DELETE", "删除");
statusMap.put("false", "");
statusMap.put("true", "");
}

View File

@ -11,6 +11,12 @@ public class SystemReference {
public static Map<String, String> quotaColumns = new LinkedHashMap<>();
public static Map<String, String> serverColumns = new LinkedHashMap<>();
public static Map<String, String> messageColumns = new LinkedHashMap<>();
public static Map<String, String> fieldColumns = new LinkedHashMap<>();
public static Map<String, String> caseFieldColumns = new LinkedHashMap<>();
public static Map<String, String> issueFieldColumns = new LinkedHashMap<>();
public static Map<String, String> projectColumns = new LinkedHashMap<>();
public static Map<String, String> jarColumns = new LinkedHashMap<>();
public static Map<String, String> environmentColumns = new LinkedHashMap<>();
static {
@ -21,6 +27,12 @@ public class SystemReference {
quotaColumns.clear();
serverColumns.clear();
messageColumns.clear();
fieldColumns.clear();
caseFieldColumns.clear();
issueFieldColumns.clear();
projectColumns.clear();
jarColumns.clear();
environmentColumns.clear();
userColumns.put("name", "用户名称");
userColumns.put("createUser", "创建人");
@ -61,5 +73,38 @@ public class SystemReference {
messageColumns.put("identification", "鉴别");
messageColumns.put("template", "模版");
fieldColumns.put("name", "用户名称");
fieldColumns.put("scene", "使用场景");
fieldColumns.put("type", "属性类型");
fieldColumns.put("system", "系统字段");
fieldColumns.put("remark", "字段备注");
caseFieldColumns.put("name", "用户名称");
caseFieldColumns.put("caseName", "用例名称");
caseFieldColumns.put("type", "用例类型");
caseFieldColumns.put("steps", "步骤");
caseFieldColumns.put("stepDescription", "步骤描述");
caseFieldColumns.put("description", "描述");
issueFieldColumns.put("name", "名称");
issueFieldColumns.put("platform", "缺陷平台");
issueFieldColumns.put("title", "标题");
issueFieldColumns.put("content", "缺陷内容");
issueFieldColumns.put("description", "描述");
projectColumns.put("name", "名称");
projectColumns.put("description", "描述");
jarColumns.put("name", "名称");
jarColumns.put("fileName", "文件名称");
jarColumns.put("description", "描述");
environmentColumns.put("name", "环境名称");
environmentColumns.put("variables", "变量");
environmentColumns.put("config", "配置");
// 深度对比字段
environmentColumns.put("ms-dff-col", "config,variables");
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.CustomField;
@ -9,13 +10,14 @@ import io.metersphere.base.mapper.CustomFieldMapper;
import io.metersphere.base.mapper.ext.ExtCustomFieldMapper;
import io.metersphere.commons.constants.TemplateConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.QueryCustomFieldRequest;
import io.metersphere.dto.CustomFieldDao;
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.system.SystemReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
@ -54,6 +56,7 @@ public class CustomFieldService {
customField.setCreateTime(System.currentTimeMillis());
customField.setUpdateTime(System.currentTimeMillis());
customField.setGlobal(false);
customField.setCreateUser(SessionUtils.getUserId());
customFieldMapper.insert(customField);
return customField.getId();
}
@ -61,6 +64,7 @@ public class CustomFieldService {
/**
* 系统字段默认是查询的 workspace_id null 的系统字段
* 如果创建了对应工作空间的系统字段则过滤掉重复的 workspace_id null 的系统字段
*
* @param request
* @return
*/
@ -190,4 +194,13 @@ public class CustomFieldService {
}
}
public String getLogDetails(String id) {
CustomField customField = customFieldMapper.selectByPrimaryKey(id);
if (customField != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(customField, SystemReference.fieldColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(customField.getId()), null, customField.getName(), customField.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.IssueTemplateMapper;
import io.metersphere.base.mapper.ext.ExtIssueTemplateMapper;
@ -7,11 +8,16 @@ import io.metersphere.commons.constants.TemplateConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.UpdateIssueTemplateRequest;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.IssueTemplateDao;
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.system.SystemReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -48,9 +54,11 @@ public class IssueTemplateService extends TemplateBaseService {
template.setId(UUID.randomUUID().toString());
template.setCreateTime(System.currentTimeMillis());
template.setUpdateTime(System.currentTimeMillis());
template.setCreateUser(SessionUtils.getUserId());
if (template.getSystem() == null) {
template.setSystem(false);
}
request.setId(template.getId());
template.setGlobal(false);
issueTemplateMapper.insert(template);
customFieldTemplateService.create(request.getCustomFields(), template.getId(),
@ -210,4 +218,14 @@ public class IssueTemplateService extends TemplateBaseService {
issueTemplateDao.setCustomFields(result);
return issueTemplateDao;
}
public String getLogDetails(String id) {
IssueTemplate templateWithBLOBs = issueTemplateMapper.selectByPrimaryKey(id);
if (templateWithBLOBs != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.issueFieldColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.jmeter.NewDriverManager;
import io.metersphere.base.domain.JarConfig;
import io.metersphere.base.domain.JarConfigExample;
@ -8,6 +9,10 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.SessionUtils;
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.system.SystemReference;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -121,4 +126,14 @@ public class JarConfigService {
}
}
}
public String getLogDetails(String id) {
JarConfig jarConfig = jarConfigMapper.selectByPrimaryKey(id);
if (jarConfig != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(jarConfig, SystemReference.jarColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(jarConfig.getId()), null, jarConfig.getName(), jarConfig.getCreator(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.DeleteAPITestRequest;
import io.metersphere.api.dto.QueryAPITestRequest;
import io.metersphere.api.service.APITestService;
@ -13,6 +14,10 @@ import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.dto.ProjectDTO;
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.system.SystemReference;
import io.metersphere.performance.request.DeleteTestPlanRequest;
import io.metersphere.performance.request.QueryProjectFileRequest;
import io.metersphere.performance.service.PerformanceReportService;
@ -283,4 +288,20 @@ public class ProjectService {
fileService.deleteFileById(fileId);
}
public String getLogDetails(String id) {
Project project = projectMapper.selectByPrimaryKey(id);
if (project != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(project, SystemReference.projectColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(project.getId()), null, project.getName(), project.getCreateUser(), columns);
return JSON.toJSONString(details);
} else {
FileMetadata fileMetadata = fileService.getFileMetadataById(id);
if (fileMetadata != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(fileMetadata, SystemReference.projectColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(fileMetadata.getId()), null, fileMetadata.getName(), null, columns);
return JSON.toJSONString(details);
}
}
return null;
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.TestCaseTemplateMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseTemplateMapper;
@ -7,11 +8,16 @@ import io.metersphere.commons.constants.TemplateConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.UpdateCaseFieldTemplateRequest;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.TestCaseTemplateDao;
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.system.SystemReference;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -48,9 +54,11 @@ public class TestCaseTemplateService extends TemplateBaseService {
testCaseTemplate.setCreateTime(System.currentTimeMillis());
testCaseTemplate.setUpdateTime(System.currentTimeMillis());
testCaseTemplate.setGlobal(false);
testCaseTemplate.setCreateUser(SessionUtils.getUserId());
if (testCaseTemplate.getSystem() == null) {
testCaseTemplate.setSystem(false);
}
request.setId(testCaseTemplate.getId());
testCaseTemplateMapper.insert(testCaseTemplate);
customFieldTemplateService.create(request.getCustomFields(), testCaseTemplate.getId(),
TemplateConstants.FieldTemplateScene.TEST_CASE.name());
@ -189,4 +197,14 @@ public class TestCaseTemplateService extends TemplateBaseService {
caseTemplateDao.setCustomFields(result);
return caseTemplateDao;
}
public String getLogDetails(String id) {
TestCaseTemplateWithBLOBs templateWithBLOBs = testCaseTemplateMapper.selectByPrimaryKey(id);
if (templateWithBLOBs != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.caseFieldColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -1,7 +1,9 @@
package io.metersphere.track.controller;
import io.metersphere.base.domain.TestCaseReportTemplate;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.track.request.testCaseReport.QueryTemplateRequest;
import io.metersphere.track.service.TestCaseReportTemplateService;
import org.apache.shiro.authz.annotation.Logical;
@ -30,18 +32,21 @@ public class TestCaseReportTemplateController {
@PostMapping("/add")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id")
public void add(@RequestBody TestCaseReportTemplate testCaseReportTemplate) {
testCaseReportTemplateService.addTestCaseReportTemplate(testCaseReportTemplate);
}
@PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, title = "#testCaseReportTemplate.name",sourceId = "#testCaseReportTemplate.id")
public void edit(@RequestBody TestCaseReportTemplate testCaseReportTemplate) {
testCaseReportTemplateService.editTestCaseReportTemplate(testCaseReportTemplate);
}
@PostMapping("/delete/{id}")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseReportTemplateService.class)
public int delete(@PathVariable String id) {
return testCaseReportTemplateService.deleteTestCaseReportTemplate(id);
}

View File

@ -1,11 +1,16 @@
package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.TestCaseReportTemplate;
import io.metersphere.base.domain.TestCaseReportTemplateExample;
import io.metersphere.base.mapper.TestCaseReportTemplateMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.SessionUtils;
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.system.SystemReference;
import io.metersphere.track.request.testCaseReport.QueryTemplateRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -70,4 +75,13 @@ public class TestCaseReportTemplateService {
return testCaseReportTemplateMapper.deleteByPrimaryKey(id);
}
public String getLogDetails(String id) {
TestCaseReportTemplate templateWithBLOBs = testCaseReportTemplateMapper.selectByPrimaryKey(id);
if (templateWithBLOBs != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(templateWithBLOBs, SystemReference.issueFieldColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(templateWithBLOBs.getId()), null, templateWithBLOBs.getName(), templateWithBLOBs.getCreateUser(), columns);
return JSON.toJSONString(details);
}
return null;
}
}

View File

@ -323,7 +323,8 @@ public class TestReviewTestCaseService {
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);
List<TestCase> collect = cases.stream().filter(u -> StringUtils.isNotEmpty(u.getProjectId())).collect(Collectors.toList());
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(ids), CollectionUtils.isNotEmpty(collect) ? collect.get(0).getProjectId() : null, String.join(",", names), cases.get(0).getCreateUser(), columns);
return JSON.toJSONString(details);
}
}

View File

@ -0,0 +1,95 @@
-- load_test_report
ALTER TABLE load_test_report
ADD project_id VARCHAR(50) NULL;
ALTER TABLE load_test_report
ADD test_name VARCHAR(64) NULL;
ALTER TABLE load_test_report
ADD jmx_content LONGTEXT NULL;
ALTER TABLE load_test_report
ADD advanced_configuration LONGTEXT NULL;
alter table load_test_report
add test_resource_pool_id VARCHAR(50) null;
UPDATE load_test_report JOIN load_test ON load_test.id = load_test_report.test_id
SET load_test_report.project_id = load_test.project_id;
UPDATE load_test_report JOIN load_test ON load_test.id = load_test_report.test_id
SET load_test_report.test_name = load_test.name;
UPDATE load_test_report JOIN load_test ON load_test.id = test_id
SET load_test_report.advanced_configuration = load_test.advanced_configuration;
UPDATE load_test_report JOIN load_test ON load_test.id = test_id
SET load_test_report.test_resource_pool_id = load_test.test_resource_pool_id;
-- schedule
alter table schedule
add config VARCHAR(500) null;
-- 自动清理调试用的body文件
-- INSERT INTO schedule (id,`key`,`type`,value,`group`,job,enable,resource_id,user_id,workspace_id,create_time,update_time,project_id,name)
-- VALUES ('f7f99f50-850b-41b2-8cb9-edee70669c4b','f7f99f50-850b-41b2-8cb9-edee70669c4b','CRON','0 0 4 * * ?','CLEAR_JOB','io.metersphere.job.sechedule.ClearJob',1,'system','admin','system',unix_timestamp() * 1000,unix_timestamp() * 1000,'system','ClearJob');
CREATE TABLE `operating_log` (
`id` varchar(50) NOT NULL COMMENT 'ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID',
`oper_method` varchar(500) DEFAULT NULL COMMENT 'operating method',
`create_user` varchar(100) DEFAULT NULL COMMENT 'source create u',
`oper_user` varchar(50) DEFAULT NULL COMMENT 'operating user id',
`source_id` varchar(6000) DEFAULT NULL COMMENT 'operating source id',
`oper_type` varchar(100) DEFAULT NULL COMMENT 'operating type',
`oper_module` varchar(64) DEFAULT NULL COMMENT 'operating module',
`oper_title` varchar(6000) DEFAULT NULL COMMENT 'operating title',
`oper_path` varchar(500) DEFAULT NULL COMMENT 'operating path',
`oper_content` longtext COMMENT 'operating content',
`oper_params` longtext COMMENT 'operating params',
`oper_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- system_parameter
UPDATE system_parameter
SET param_key = 'base.prometheus.host'
WHERE param_key = 'prometheus.host';
-- load_test_report
alter table load_test_report
add test_start_time BIGINT(13) null;
alter table load_test_report
add test_end_time BIGINT(13) null;
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;
ALTER TABLE project ADD create_user VARCHAR(100) NULL;
ALTER TABLE load_test ADD create_user VARCHAR(100) NULL;
ALTER TABLE user ADD create_user VARCHAR(100) NULL;
ALTER TABLE organization ADD create_user VARCHAR(100) NULL;
ALTER TABLE workspace ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_resource_pool ADD create_user VARCHAR(100) NULL;
ALTER TABLE custom_field ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_template ADD create_user VARCHAR(100) NULL;
ALTER TABLE issue_template ADD create_user VARCHAR(100) NULL;
ALTER TABLE test_case_report_template ADD create_user VARCHAR(100) NULL;
ALTER TABLE api_test_environment 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="workspace"></table>
<table tableName="api_test_environment"></table>
<!-- <table tableName="custom_field"></table>-->
<!-- <table tableName="test_case"></table>-->
<!-- <table tableName="test_case"></table>-->

View File

@ -235,7 +235,7 @@ performance_test=Performance test
performance_test_report=Performance test report
system_user=System user
system_organization=System organization
system_workspace=System workspace
system_workspace=workspace
system_test_resource=System test resource
system_parameter_setting=System parameter setting
system_quota_management=System Quota management
@ -247,6 +247,7 @@ organization_message_settings=Organization message settings
workspace_member=Workspace member
workspace_template_settings=Workspace template settings
project_project_manager=Project project manager
project_project_jar=Project project jar
project_environment_setting=Project environment setting
project_file_management=Project file management
personal_information_personal_settings=Personal information personal settings

View File

@ -234,7 +234,7 @@ performance_test=性能测试
performance_test_report=性能测试报告
system_user=系统-用户
system_organization=系统-组织
system_workspace=系统-工作空间
system_workspace=工作空间
system_test_resource=系统-测试资源池
system_parameter_setting=系统-系统参数设置
system_quota_management=系统-配额管理
@ -246,6 +246,7 @@ organization_message_settings=组织-消息设置
workspace_member=工作空间-成员
workspace_template_settings=工作空间-模版设置
project_project_manager=项目-项目管理
project_project_jar=項目-JAR包管理
project_environment_setting=项目-环境设置
project_file_management=项目-文件管理
personal_information_personal_settings=个人信息-个人设置

View File

@ -236,7 +236,7 @@ performance_test_report=性能測試報告
system_user=系统-用户
system_organization=系統-組織
system_workspace=系统-工作空间
system_test_resource=系統-工作空間
system_test_resource=工作空間
system_parameter_setting=系统-系統參數設置
system_quota_management=系统-配額管理
system_authorization_management=系统-授權管理
@ -247,6 +247,7 @@ organization_message_settings=組織-消息設置
workspace_member=工作空間-成員
workspace_template_settings=工作空間-模版設置
project_project_manager=項目-項目管理
project_project_jar=項目-JAR包管理
project_environment_setting=項目-環境設置
project_file_management=項目-文件管理
personal_information_personal_settings=個人信息-個人設置