feat: 系统操作日志切面

This commit is contained in:
fit2-zhao 2023-06-12 15:14:14 +08:00 committed by fit2-zhao
parent 3177886653
commit c0b6847fd9
21 changed files with 1046 additions and 1424 deletions

View File

@ -1,56 +0,0 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import lombok.Data;
@Data
public class OperatingLog implements Serializable {
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operating_log.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{operating_log.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operating_log.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{operating_log.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@Schema(title = "operating method")
private String operMethod;
@Schema(title = "创建人")
private String createUser;
@Schema(title = "操作人")
private String operUser;
@Schema(title = "资源ID")
private String sourceId;
@Schema(title = "操作类型")
private String operType;
@Schema(title = "操作模块")
private String operModule;
@Schema(title = "操作标题")
private String operTitle;
@Schema(title = "操作路径")
private String operPath;
@Schema(title = "操作时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{operating_log.oper_time.not_blank}", groups = {Created.class})
private Long operTime;
@Schema(title = "操作内容")
private byte[] operContent;
@Schema(title = "操作参数")
private byte[] operParams;
private static final long serialVersionUID = 1L;
}

View File

@ -1,27 +0,0 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import lombok.Data;
@Data
public class OperatingLogResource implements Serializable {
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operating_log_resource.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{operating_log_resource.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "Operating log ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operating_log_resource.operating_log_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{operating_log_resource.operating_log_id.length_range}", groups = {Created.class, Updated.class})
private String operatingLogId;
@Schema(title = "operating source id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operating_log_resource.source_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{operating_log_resource.source_id.length_range}", groups = {Created.class, Updated.class})
private String sourceId;
private static final long serialVersionUID = 1L;
}

View File

@ -1,410 +0,0 @@
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class OperatingLogResourceExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OperatingLogResourceExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andOperatingLogIdIsNull() {
addCriterion("operating_log_id is null");
return (Criteria) this;
}
public Criteria andOperatingLogIdIsNotNull() {
addCriterion("operating_log_id is not null");
return (Criteria) this;
}
public Criteria andOperatingLogIdEqualTo(String value) {
addCriterion("operating_log_id =", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdNotEqualTo(String value) {
addCriterion("operating_log_id <>", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdGreaterThan(String value) {
addCriterion("operating_log_id >", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdGreaterThanOrEqualTo(String value) {
addCriterion("operating_log_id >=", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdLessThan(String value) {
addCriterion("operating_log_id <", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdLessThanOrEqualTo(String value) {
addCriterion("operating_log_id <=", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdLike(String value) {
addCriterion("operating_log_id like", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdNotLike(String value) {
addCriterion("operating_log_id not like", value, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdIn(List<String> values) {
addCriterion("operating_log_id in", values, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdNotIn(List<String> values) {
addCriterion("operating_log_id not in", values, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdBetween(String value1, String value2) {
addCriterion("operating_log_id between", value1, value2, "operatingLogId");
return (Criteria) this;
}
public Criteria andOperatingLogIdNotBetween(String value1, String value2) {
addCriterion("operating_log_id not between", value1, value2, "operatingLogId");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
}
public Criteria andSourceIdIsNotNull() {
addCriterion("source_id is not null");
return (Criteria) this;
}
public Criteria andSourceIdEqualTo(String value) {
addCriterion("source_id =", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotEqualTo(String value) {
addCriterion("source_id <>", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThan(String value) {
addCriterion("source_id >", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
addCriterion("source_id >=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThan(String value) {
addCriterion("source_id <", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLessThanOrEqualTo(String value) {
addCriterion("source_id <=", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdLike(String value) {
addCriterion("source_id like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotLike(String value) {
addCriterion("source_id not like", value, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdIn(List<String> values) {
addCriterion("source_id in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotIn(List<String> values) {
addCriterion("source_id not in", values, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdBetween(String value1, String value2) {
addCriterion("source_id between", value1, value2, "sourceId");
return (Criteria) this;
}
public Criteria andSourceIdNotBetween(String value1, String value2) {
addCriterion("source_id not between", value1, value2, "sourceId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,53 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
@Data
public class OperationLog implements Serializable {
@Schema(title = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operation_log.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{operation_log.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operation_log.project_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{operation_log.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@Schema(title = "操作时间")
private Long createTime;
@Schema(title = "操作人")
private String createUser;
@Schema(title = "资源id")
private String sourceId;
@Schema(title = "操作方法", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operation_log.method.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{operation_log.method.length_range}", groups = {Created.class, Updated.class})
private String method;
@Schema(title = "操作类型/add/update/delete", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{operation_log.type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 20, message = "{operation_log.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(title = "操作模块/api/case/scenario/ui")
private String module;
@Schema(title = "操作详情")
private String details;
@Schema(title = "操作路径")
private String path;
private static final long serialVersionUID = 1L;
}

View File

@ -3,14 +3,14 @@ package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class OperatingLogExample {
public class OperationLogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OperatingLogExample() {
public OperationLogExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -244,73 +244,63 @@ public class OperatingLogExample {
return (Criteria) this;
}
public Criteria andOperMethodIsNull() {
addCriterion("oper_method is null");
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andOperMethodIsNotNull() {
addCriterion("oper_method is not null");
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andOperMethodEqualTo(String value) {
addCriterion("oper_method =", value, "operMethod");
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodNotEqualTo(String value) {
addCriterion("oper_method <>", value, "operMethod");
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodGreaterThan(String value) {
addCriterion("oper_method >", value, "operMethod");
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodGreaterThanOrEqualTo(String value) {
addCriterion("oper_method >=", value, "operMethod");
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodLessThan(String value) {
addCriterion("oper_method <", value, "operMethod");
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodLessThanOrEqualTo(String value) {
addCriterion("oper_method <=", value, "operMethod");
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodLike(String value) {
addCriterion("oper_method like", value, "operMethod");
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodNotLike(String value) {
addCriterion("oper_method not like", value, "operMethod");
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodIn(List<String> values) {
addCriterion("oper_method in", values, "operMethod");
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andOperMethodNotIn(List<String> values) {
addCriterion("oper_method not in", values, "operMethod");
return (Criteria) this;
}
public Criteria andOperMethodBetween(String value1, String value2) {
addCriterion("oper_method between", value1, value2, "operMethod");
return (Criteria) this;
}
public Criteria andOperMethodNotBetween(String value1, String value2) {
addCriterion("oper_method not between", value1, value2, "operMethod");
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
@ -384,76 +374,6 @@ public class OperatingLogExample {
return (Criteria) this;
}
public Criteria andOperUserIsNull() {
addCriterion("oper_user is null");
return (Criteria) this;
}
public Criteria andOperUserIsNotNull() {
addCriterion("oper_user is not null");
return (Criteria) this;
}
public Criteria andOperUserEqualTo(String value) {
addCriterion("oper_user =", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserNotEqualTo(String value) {
addCriterion("oper_user <>", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserGreaterThan(String value) {
addCriterion("oper_user >", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserGreaterThanOrEqualTo(String value) {
addCriterion("oper_user >=", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserLessThan(String value) {
addCriterion("oper_user <", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserLessThanOrEqualTo(String value) {
addCriterion("oper_user <=", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserLike(String value) {
addCriterion("oper_user like", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserNotLike(String value) {
addCriterion("oper_user not like", value, "operUser");
return (Criteria) this;
}
public Criteria andOperUserIn(List<String> values) {
addCriterion("oper_user in", values, "operUser");
return (Criteria) this;
}
public Criteria andOperUserNotIn(List<String> values) {
addCriterion("oper_user not in", values, "operUser");
return (Criteria) this;
}
public Criteria andOperUserBetween(String value1, String value2) {
addCriterion("oper_user between", value1, value2, "operUser");
return (Criteria) this;
}
public Criteria andOperUserNotBetween(String value1, String value2) {
addCriterion("oper_user not between", value1, value2, "operUser");
return (Criteria) this;
}
public Criteria andSourceIdIsNull() {
addCriterion("source_id is null");
return (Criteria) this;
@ -524,343 +444,353 @@ public class OperatingLogExample {
return (Criteria) this;
}
public Criteria andOperTypeIsNull() {
addCriterion("oper_type is null");
public Criteria andMethodIsNull() {
addCriterion("`method` is null");
return (Criteria) this;
}
public Criteria andOperTypeIsNotNull() {
addCriterion("oper_type is not null");
public Criteria andMethodIsNotNull() {
addCriterion("`method` is not null");
return (Criteria) this;
}
public Criteria andOperTypeEqualTo(String value) {
addCriterion("oper_type =", value, "operType");
public Criteria andMethodEqualTo(String value) {
addCriterion("`method` =", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeNotEqualTo(String value) {
addCriterion("oper_type <>", value, "operType");
public Criteria andMethodNotEqualTo(String value) {
addCriterion("`method` <>", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeGreaterThan(String value) {
addCriterion("oper_type >", value, "operType");
public Criteria andMethodGreaterThan(String value) {
addCriterion("`method` >", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeGreaterThanOrEqualTo(String value) {
addCriterion("oper_type >=", value, "operType");
public Criteria andMethodGreaterThanOrEqualTo(String value) {
addCriterion("`method` >=", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeLessThan(String value) {
addCriterion("oper_type <", value, "operType");
public Criteria andMethodLessThan(String value) {
addCriterion("`method` <", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeLessThanOrEqualTo(String value) {
addCriterion("oper_type <=", value, "operType");
public Criteria andMethodLessThanOrEqualTo(String value) {
addCriterion("`method` <=", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeLike(String value) {
addCriterion("oper_type like", value, "operType");
public Criteria andMethodLike(String value) {
addCriterion("`method` like", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeNotLike(String value) {
addCriterion("oper_type not like", value, "operType");
public Criteria andMethodNotLike(String value) {
addCriterion("`method` not like", value, "method");
return (Criteria) this;
}
public Criteria andOperTypeIn(List<String> values) {
addCriterion("oper_type in", values, "operType");
public Criteria andMethodIn(List<String> values) {
addCriterion("`method` in", values, "method");
return (Criteria) this;
}
public Criteria andOperTypeNotIn(List<String> values) {
addCriterion("oper_type not in", values, "operType");
public Criteria andMethodNotIn(List<String> values) {
addCriterion("`method` not in", values, "method");
return (Criteria) this;
}
public Criteria andOperTypeBetween(String value1, String value2) {
addCriterion("oper_type between", value1, value2, "operType");
public Criteria andMethodBetween(String value1, String value2) {
addCriterion("`method` between", value1, value2, "method");
return (Criteria) this;
}
public Criteria andOperTypeNotBetween(String value1, String value2) {
addCriterion("oper_type not between", value1, value2, "operType");
public Criteria andMethodNotBetween(String value1, String value2) {
addCriterion("`method` not between", value1, value2, "method");
return (Criteria) this;
}
public Criteria andOperModuleIsNull() {
addCriterion("oper_module is null");
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andOperModuleIsNotNull() {
addCriterion("oper_module is not null");
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andOperModuleEqualTo(String value) {
addCriterion("oper_module =", value, "operModule");
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleNotEqualTo(String value) {
addCriterion("oper_module <>", value, "operModule");
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleGreaterThan(String value) {
addCriterion("oper_module >", value, "operModule");
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleGreaterThanOrEqualTo(String value) {
addCriterion("oper_module >=", value, "operModule");
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleLessThan(String value) {
addCriterion("oper_module <", value, "operModule");
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleLessThanOrEqualTo(String value) {
addCriterion("oper_module <=", value, "operModule");
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleLike(String value) {
addCriterion("oper_module like", value, "operModule");
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleNotLike(String value) {
addCriterion("oper_module not like", value, "operModule");
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andOperModuleIn(List<String> values) {
addCriterion("oper_module in", values, "operModule");
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andOperModuleNotIn(List<String> values) {
addCriterion("oper_module not in", values, "operModule");
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andOperModuleBetween(String value1, String value2) {
addCriterion("oper_module between", value1, value2, "operModule");
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andOperModuleNotBetween(String value1, String value2) {
addCriterion("oper_module not between", value1, value2, "operModule");
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andOperTitleIsNull() {
addCriterion("oper_title is null");
public Criteria andModuleIsNull() {
addCriterion("`module` is null");
return (Criteria) this;
}
public Criteria andOperTitleIsNotNull() {
addCriterion("oper_title is not null");
public Criteria andModuleIsNotNull() {
addCriterion("`module` is not null");
return (Criteria) this;
}
public Criteria andOperTitleEqualTo(String value) {
addCriterion("oper_title =", value, "operTitle");
public Criteria andModuleEqualTo(String value) {
addCriterion("`module` =", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleNotEqualTo(String value) {
addCriterion("oper_title <>", value, "operTitle");
public Criteria andModuleNotEqualTo(String value) {
addCriterion("`module` <>", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleGreaterThan(String value) {
addCriterion("oper_title >", value, "operTitle");
public Criteria andModuleGreaterThan(String value) {
addCriterion("`module` >", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleGreaterThanOrEqualTo(String value) {
addCriterion("oper_title >=", value, "operTitle");
public Criteria andModuleGreaterThanOrEqualTo(String value) {
addCriterion("`module` >=", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleLessThan(String value) {
addCriterion("oper_title <", value, "operTitle");
public Criteria andModuleLessThan(String value) {
addCriterion("`module` <", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleLessThanOrEqualTo(String value) {
addCriterion("oper_title <=", value, "operTitle");
public Criteria andModuleLessThanOrEqualTo(String value) {
addCriterion("`module` <=", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleLike(String value) {
addCriterion("oper_title like", value, "operTitle");
public Criteria andModuleLike(String value) {
addCriterion("`module` like", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleNotLike(String value) {
addCriterion("oper_title not like", value, "operTitle");
public Criteria andModuleNotLike(String value) {
addCriterion("`module` not like", value, "module");
return (Criteria) this;
}
public Criteria andOperTitleIn(List<String> values) {
addCriterion("oper_title in", values, "operTitle");
public Criteria andModuleIn(List<String> values) {
addCriterion("`module` in", values, "module");
return (Criteria) this;
}
public Criteria andOperTitleNotIn(List<String> values) {
addCriterion("oper_title not in", values, "operTitle");
public Criteria andModuleNotIn(List<String> values) {
addCriterion("`module` not in", values, "module");
return (Criteria) this;
}
public Criteria andOperTitleBetween(String value1, String value2) {
addCriterion("oper_title between", value1, value2, "operTitle");
public Criteria andModuleBetween(String value1, String value2) {
addCriterion("`module` between", value1, value2, "module");
return (Criteria) this;
}
public Criteria andOperTitleNotBetween(String value1, String value2) {
addCriterion("oper_title not between", value1, value2, "operTitle");
public Criteria andModuleNotBetween(String value1, String value2) {
addCriterion("`module` not between", value1, value2, "module");
return (Criteria) this;
}
public Criteria andOperPathIsNull() {
addCriterion("oper_path is null");
public Criteria andDetailsIsNull() {
addCriterion("details is null");
return (Criteria) this;
}
public Criteria andOperPathIsNotNull() {
addCriterion("oper_path is not null");
public Criteria andDetailsIsNotNull() {
addCriterion("details is not null");
return (Criteria) this;
}
public Criteria andOperPathEqualTo(String value) {
addCriterion("oper_path =", value, "operPath");
public Criteria andDetailsEqualTo(String value) {
addCriterion("details =", value, "details");
return (Criteria) this;
}
public Criteria andOperPathNotEqualTo(String value) {
addCriterion("oper_path <>", value, "operPath");
public Criteria andDetailsNotEqualTo(String value) {
addCriterion("details <>", value, "details");
return (Criteria) this;
}
public Criteria andOperPathGreaterThan(String value) {
addCriterion("oper_path >", value, "operPath");
public Criteria andDetailsGreaterThan(String value) {
addCriterion("details >", value, "details");
return (Criteria) this;
}
public Criteria andOperPathGreaterThanOrEqualTo(String value) {
addCriterion("oper_path >=", value, "operPath");
public Criteria andDetailsGreaterThanOrEqualTo(String value) {
addCriterion("details >=", value, "details");
return (Criteria) this;
}
public Criteria andOperPathLessThan(String value) {
addCriterion("oper_path <", value, "operPath");
public Criteria andDetailsLessThan(String value) {
addCriterion("details <", value, "details");
return (Criteria) this;
}
public Criteria andOperPathLessThanOrEqualTo(String value) {
addCriterion("oper_path <=", value, "operPath");
public Criteria andDetailsLessThanOrEqualTo(String value) {
addCriterion("details <=", value, "details");
return (Criteria) this;
}
public Criteria andOperPathLike(String value) {
addCriterion("oper_path like", value, "operPath");
public Criteria andDetailsLike(String value) {
addCriterion("details like", value, "details");
return (Criteria) this;
}
public Criteria andOperPathNotLike(String value) {
addCriterion("oper_path not like", value, "operPath");
public Criteria andDetailsNotLike(String value) {
addCriterion("details not like", value, "details");
return (Criteria) this;
}
public Criteria andOperPathIn(List<String> values) {
addCriterion("oper_path in", values, "operPath");
public Criteria andDetailsIn(List<String> values) {
addCriterion("details in", values, "details");
return (Criteria) this;
}
public Criteria andOperPathNotIn(List<String> values) {
addCriterion("oper_path not in", values, "operPath");
public Criteria andDetailsNotIn(List<String> values) {
addCriterion("details not in", values, "details");
return (Criteria) this;
}
public Criteria andOperPathBetween(String value1, String value2) {
addCriterion("oper_path between", value1, value2, "operPath");
public Criteria andDetailsBetween(String value1, String value2) {
addCriterion("details between", value1, value2, "details");
return (Criteria) this;
}
public Criteria andOperPathNotBetween(String value1, String value2) {
addCriterion("oper_path not between", value1, value2, "operPath");
public Criteria andDetailsNotBetween(String value1, String value2) {
addCriterion("details not between", value1, value2, "details");
return (Criteria) this;
}
public Criteria andOperTimeIsNull() {
addCriterion("oper_time is null");
public Criteria andPathIsNull() {
addCriterion("`path` is null");
return (Criteria) this;
}
public Criteria andOperTimeIsNotNull() {
addCriterion("oper_time is not null");
public Criteria andPathIsNotNull() {
addCriterion("`path` is not null");
return (Criteria) this;
}
public Criteria andOperTimeEqualTo(Long value) {
addCriterion("oper_time =", value, "operTime");
public Criteria andPathEqualTo(String value) {
addCriterion("`path` =", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeNotEqualTo(Long value) {
addCriterion("oper_time <>", value, "operTime");
public Criteria andPathNotEqualTo(String value) {
addCriterion("`path` <>", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeGreaterThan(Long value) {
addCriterion("oper_time >", value, "operTime");
public Criteria andPathGreaterThan(String value) {
addCriterion("`path` >", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeGreaterThanOrEqualTo(Long value) {
addCriterion("oper_time >=", value, "operTime");
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("`path` >=", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeLessThan(Long value) {
addCriterion("oper_time <", value, "operTime");
public Criteria andPathLessThan(String value) {
addCriterion("`path` <", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeLessThanOrEqualTo(Long value) {
addCriterion("oper_time <=", value, "operTime");
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("`path` <=", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeIn(List<Long> values) {
addCriterion("oper_time in", values, "operTime");
public Criteria andPathLike(String value) {
addCriterion("`path` like", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeNotIn(List<Long> values) {
addCriterion("oper_time not in", values, "operTime");
public Criteria andPathNotLike(String value) {
addCriterion("`path` not like", value, "path");
return (Criteria) this;
}
public Criteria andOperTimeBetween(Long value1, Long value2) {
addCriterion("oper_time between", value1, value2, "operTime");
public Criteria andPathIn(List<String> values) {
addCriterion("`path` in", values, "path");
return (Criteria) this;
}
public Criteria andOperTimeNotBetween(Long value1, Long value2) {
addCriterion("oper_time not between", value1, value2, "operTime");
public Criteria andPathNotIn(List<String> values) {
addCriterion("`path` not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("`path` between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("`path` not between", value1, value2, "path");
return (Criteria) this;
}
}

View File

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

View File

@ -1,392 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.system.mapper.OperatingLogMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperatingLog">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="oper_method" jdbcType="VARCHAR" property="operMethod" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="oper_user" jdbcType="VARCHAR" property="operUser" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="oper_type" jdbcType="VARCHAR" property="operType" />
<result column="oper_module" jdbcType="VARCHAR" property="operModule" />
<result column="oper_title" jdbcType="VARCHAR" property="operTitle" />
<result column="oper_path" jdbcType="VARCHAR" property="operPath" />
<result column="oper_time" jdbcType="BIGINT" property="operTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.OperatingLog">
<result column="oper_content" jdbcType="LONGVARBINARY" property="operContent" />
<result column="oper_params" jdbcType="LONGVARBINARY" property="operParams" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, oper_method, create_user, oper_user, source_id, oper_type, oper_module,
oper_title, oper_path, oper_time
</sql>
<sql id="Blob_Column_List">
oper_content, oper_params
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.OperatingLogExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from operating_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperatingLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from operating_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from operating_log
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from operating_log
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperatingLogExample">
delete from operating_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.OperatingLog">
insert into operating_log (id, project_id, oper_method,
create_user, oper_user, source_id,
oper_type, oper_module, oper_title,
oper_path, oper_time, oper_content,
oper_params)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{operMethod,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{operUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR},
#{operType,jdbcType=VARCHAR}, #{operModule,jdbcType=VARCHAR}, #{operTitle,jdbcType=VARCHAR},
#{operPath,jdbcType=VARCHAR}, #{operTime,jdbcType=BIGINT}, #{operContent,jdbcType=LONGVARBINARY},
#{operParams,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperatingLog">
insert into operating_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="operMethod != null">
oper_method,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="operUser != null">
oper_user,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="operType != null">
oper_type,
</if>
<if test="operModule != null">
oper_module,
</if>
<if test="operTitle != null">
oper_title,
</if>
<if test="operPath != null">
oper_path,
</if>
<if test="operTime != null">
oper_time,
</if>
<if test="operContent != null">
oper_content,
</if>
<if test="operParams != null">
oper_params,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="operMethod != null">
#{operMethod,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="operUser != null">
#{operUser,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="operType != null">
#{operType,jdbcType=VARCHAR},
</if>
<if test="operModule != null">
#{operModule,jdbcType=VARCHAR},
</if>
<if test="operTitle != null">
#{operTitle,jdbcType=VARCHAR},
</if>
<if test="operPath != null">
#{operPath,jdbcType=VARCHAR},
</if>
<if test="operTime != null">
#{operTime,jdbcType=BIGINT},
</if>
<if test="operContent != null">
#{operContent,jdbcType=LONGVARBINARY},
</if>
<if test="operParams != null">
#{operParams,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.OperatingLogExample" resultType="java.lang.Long">
select count(*) from operating_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update operating_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.operMethod != null">
oper_method = #{record.operMethod,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.operUser != null">
oper_user = #{record.operUser,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.operType != null">
oper_type = #{record.operType,jdbcType=VARCHAR},
</if>
<if test="record.operModule != null">
oper_module = #{record.operModule,jdbcType=VARCHAR},
</if>
<if test="record.operTitle != null">
oper_title = #{record.operTitle,jdbcType=VARCHAR},
</if>
<if test="record.operPath != null">
oper_path = #{record.operPath,jdbcType=VARCHAR},
</if>
<if test="record.operTime != null">
oper_time = #{record.operTime,jdbcType=BIGINT},
</if>
<if test="record.operContent != null">
oper_content = #{record.operContent,jdbcType=LONGVARBINARY},
</if>
<if test="record.operParams != null">
oper_params = #{record.operParams,jdbcType=LONGVARBINARY},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update operating_log
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
oper_method = #{record.operMethod,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
oper_user = #{record.operUser,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
oper_type = #{record.operType,jdbcType=VARCHAR},
oper_module = #{record.operModule,jdbcType=VARCHAR},
oper_title = #{record.operTitle,jdbcType=VARCHAR},
oper_path = #{record.operPath,jdbcType=VARCHAR},
oper_time = #{record.operTime,jdbcType=BIGINT},
oper_content = #{record.operContent,jdbcType=LONGVARBINARY},
oper_params = #{record.operParams,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update operating_log
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
oper_method = #{record.operMethod,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
oper_user = #{record.operUser,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
oper_type = #{record.operType,jdbcType=VARCHAR},
oper_module = #{record.operModule,jdbcType=VARCHAR},
oper_title = #{record.operTitle,jdbcType=VARCHAR},
oper_path = #{record.operPath,jdbcType=VARCHAR},
oper_time = #{record.operTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperatingLog">
update operating_log
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="operMethod != null">
oper_method = #{operMethod,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="operUser != null">
oper_user = #{operUser,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="operType != null">
oper_type = #{operType,jdbcType=VARCHAR},
</if>
<if test="operModule != null">
oper_module = #{operModule,jdbcType=VARCHAR},
</if>
<if test="operTitle != null">
oper_title = #{operTitle,jdbcType=VARCHAR},
</if>
<if test="operPath != null">
oper_path = #{operPath,jdbcType=VARCHAR},
</if>
<if test="operTime != null">
oper_time = #{operTime,jdbcType=BIGINT},
</if>
<if test="operContent != null">
oper_content = #{operContent,jdbcType=LONGVARBINARY},
</if>
<if test="operParams != null">
oper_params = #{operParams,jdbcType=LONGVARBINARY},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.OperatingLog">
update operating_log
set project_id = #{projectId,jdbcType=VARCHAR},
oper_method = #{operMethod,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
oper_user = #{operUser,jdbcType=VARCHAR},
source_id = #{sourceId,jdbcType=VARCHAR},
oper_type = #{operType,jdbcType=VARCHAR},
oper_module = #{operModule,jdbcType=VARCHAR},
oper_title = #{operTitle,jdbcType=VARCHAR},
oper_path = #{operPath,jdbcType=VARCHAR},
oper_time = #{operTime,jdbcType=BIGINT},
oper_content = #{operContent,jdbcType=LONGVARBINARY},
oper_params = #{operParams,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperatingLog">
update operating_log
set project_id = #{projectId,jdbcType=VARCHAR},
oper_method = #{operMethod,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
oper_user = #{operUser,jdbcType=VARCHAR},
source_id = #{sourceId,jdbcType=VARCHAR},
oper_type = #{operType,jdbcType=VARCHAR},
oper_module = #{operModule,jdbcType=VARCHAR},
oper_title = #{operTitle,jdbcType=VARCHAR},
oper_path = #{operPath,jdbcType=VARCHAR},
oper_time = #{operTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -1,30 +0,0 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.OperatingLogResource;
import io.metersphere.system.domain.OperatingLogResourceExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface OperatingLogResourceMapper {
long countByExample(OperatingLogResourceExample example);
int deleteByExample(OperatingLogResourceExample example);
int deleteByPrimaryKey(String id);
int insert(OperatingLogResource record);
int insertSelective(OperatingLogResource record);
List<OperatingLogResource> selectByExample(OperatingLogResourceExample example);
OperatingLogResource selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") OperatingLogResource record, @Param("example") OperatingLogResourceExample example);
int updateByExample(@Param("record") OperatingLogResource record, @Param("example") OperatingLogResourceExample example);
int updateByPrimaryKeySelective(OperatingLogResource record);
int updateByPrimaryKey(OperatingLogResource record);
}

View File

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

View File

@ -0,0 +1,30 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.OperationLog;
import io.metersphere.system.domain.OperationLogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface OperationLogMapper {
long countByExample(OperationLogExample example);
int deleteByExample(OperationLogExample example);
int deleteByPrimaryKey(String id);
int insert(OperationLog record);
int insertSelective(OperationLog record);
List<OperationLog> selectByExample(OperationLogExample example);
OperationLog selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") OperationLog record, @Param("example") OperationLogExample example);
int updateByExample(@Param("record") OperationLog record, @Param("example") OperationLogExample example);
int updateByPrimaryKeySelective(OperationLog record);
int updateByPrimaryKey(OperationLog record);
}

View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.system.mapper.OperationLogMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperationLog">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="module" jdbcType="VARCHAR" property="module" />
<result column="details" jdbcType="VARCHAR" property="details" />
<result column="path" jdbcType="VARCHAR" property="path" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, create_time, create_user, source_id, `method`, `type`, `module`,
details, `path`
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperationLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from operation_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from operation_log
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from operation_log
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperationLogExample">
delete from operation_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.OperationLog">
insert into operation_log (id, project_id, create_time,
create_user, source_id, `method`,
`type`, `module`, details,
`path`)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{module,jdbcType=VARCHAR}, #{details,jdbcType=VARCHAR},
#{path,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperationLog">
insert into operation_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="sourceId != null">
source_id,
</if>
<if test="method != null">
`method`,
</if>
<if test="type != null">
`type`,
</if>
<if test="module != null">
`module`,
</if>
<if test="details != null">
details,
</if>
<if test="path != null">
`path`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="projectId != null">
#{projectId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
#{sourceId,jdbcType=VARCHAR},
</if>
<if test="method != null">
#{method,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="module != null">
#{module,jdbcType=VARCHAR},
</if>
<if test="details != null">
#{details,jdbcType=VARCHAR},
</if>
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.OperationLogExample" resultType="java.lang.Long">
select count(*) from operation_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update operation_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null">
project_id = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.sourceId != null">
source_id = #{record.sourceId,jdbcType=VARCHAR},
</if>
<if test="record.method != null">
`method` = #{record.method,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.module != null">
`module` = #{record.module,jdbcType=VARCHAR},
</if>
<if test="record.details != null">
details = #{record.details,jdbcType=VARCHAR},
</if>
<if test="record.path != null">
`path` = #{record.path,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update operation_log
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
source_id = #{record.sourceId,jdbcType=VARCHAR},
`method` = #{record.method,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`module` = #{record.module,jdbcType=VARCHAR},
details = #{record.details,jdbcType=VARCHAR},
`path` = #{record.path,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperationLog">
update operation_log
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="sourceId != null">
source_id = #{sourceId,jdbcType=VARCHAR},
</if>
<if test="method != null">
`method` = #{method,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="module != null">
`module` = #{module,jdbcType=VARCHAR},
</if>
<if test="details != null">
details = #{details,jdbcType=VARCHAR},
</if>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperationLog">
update operation_log
set project_id = #{projectId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
source_id = #{sourceId,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`module` = #{module,jdbcType=VARCHAR},
details = #{details,jdbcType=VARCHAR},
`path` = #{path,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -120,46 +120,29 @@ CREATE TABLE novice_statistics
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '新手村';
DROP TABLE IF EXISTS operating_log;
CREATE TABLE operating_log
(
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
`project_id` VARCHAR(50) NOT NULL COMMENT '项目ID',
`oper_method` VARCHAR(500) COMMENT 'operating method',
`create_user` VARCHAR(100) COMMENT '创建人',
`oper_user` VARCHAR(50) COMMENT '操作人',
`source_id` VARCHAR(6000) COMMENT '资源ID',
`oper_type` VARCHAR(100) COMMENT '操作类型',
`oper_module` VARCHAR(100) COMMENT '操作模块',
`oper_title` VARCHAR(6000) COMMENT '操作标题',
`oper_path` VARCHAR(500) COMMENT '操作路径',
`oper_content` LONGBLOB COMMENT '操作内容',
`oper_params` LONGBLOB COMMENT '操作参数',
`oper_time` BIGINT NOT NULL COMMENT '操作时间',
DROP TABLE IF EXISTS operation_log;
CREATE TABLE operation_log(
`id` VARCHAR(50) NOT NULL COMMENT '主键' ,
`project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id' ,
`create_time` BIGINT NOT NULL COMMENT '操作时间' ,
`create_user` VARCHAR(50) COMMENT '操作人' ,
`source_id` VARCHAR(50) COMMENT '资源id' ,
`method` VARCHAR(255) NOT NULL COMMENT '操作方法' ,
`type` VARCHAR(20) NOT NULL COMMENT '操作类型/add/update/delete' ,
`module` VARCHAR(20) COMMENT '操作模块/api/case/scenario/ui' ,
`details` VARCHAR(1000) COMMENT '操作详情' ,
`path` VARCHAR(255) COMMENT '操作路径' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '操作日志';
CREATE INDEX idx_oper_module ON operating_log (`oper_module`);
CREATE INDEX idx_oper_project_id ON operating_log (`project_id`);
CREATE INDEX idx_oper_time_index ON operating_log (`oper_time`);
DROP TABLE IF EXISTS operating_log_resource;
CREATE TABLE operating_log_resource
(
`id` VARCHAR(50) NOT NULL COMMENT 'ID',
`operating_log_id` VARCHAR(50) NOT NULL COMMENT 'Operating log ID',
`source_id` VARCHAR(50) NOT NULL COMMENT 'operating source id',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '操作日志关系记录';
CREATE INDEX operating_log_id_index ON operating_log_resource (`operating_log_id`);
CREATE INDEX source_id_index ON operating_log_resource (`source_id`);
CREATE INDEX idx_create_time ON operation_log(`create_time`);
CREATE INDEX idx_create_user ON operation_log(`create_user`);
CREATE INDEX idx_method ON operation_log(`method`);
CREATE INDEX idx_module ON operation_log(`module`);
CREATE INDEX idx_project_id ON operation_log(`project_id`);
CREATE INDEX idx_type ON operation_log(`type`);
DROP TABLE IF EXISTS plugin;
CREATE TABLE plugin

View File

@ -18,8 +18,6 @@ public class SystemInterceptor {
configList.add(new MybatisInterceptorConfig(TestResource.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(AuthSource.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(NoviceStatistics.class, "dataOption", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(OperatingLog.class, "operContent", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(OperatingLog.class, "operParams", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(PluginBlob.class, "formOption", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(PluginBlob.class, "formScript", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(ServiceIntegration.class, "configuration", CompressUtils.class, "zip", "unzip"));

View File

@ -0,0 +1,76 @@
package io.metersphere.sdk.log.annotation;
import io.metersphere.sdk.log.constants.OperationLogModule;
import io.metersphere.sdk.log.constants.OperationLogType;
import java.lang.annotation.*;
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
/**
* 操作日志注解类
* @author mr.zhao
*/
public @interface RequestLog {
/**
* 功能模块
*
* @return
*/
String module() default OperationLogModule.UNKNOWN_MODULE;
/**
* 项目
*
* @return
*/
String projectId() default "default";
/**
* 操作类型
*
* @return
*/
OperationLogType type() default OperationLogType.SELECT;
/**
* 资源ID
*/
String sourceId() default "";
/**
* 创建用户
*
* @return
*/
String createUser() default "";
/**
* 操作内容
*
* @return
*/
String details() default "";
/**
* 是否是批量删除操作
*
* @return
*/
boolean isBatch() default false;
/**
* 操作前触发内容
*
* @return
*/
String event() default "";
/**
* 传入执行类
*
* @return
*/
Class[] msClass() default {};
}

View File

@ -0,0 +1,216 @@
package io.metersphere.sdk.log.aspect;
import io.metersphere.sdk.log.annotation.RequestLog;
import io.metersphere.sdk.log.service.OperationLogService;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.SessionUtils;
import io.metersphere.system.domain.OperationLog;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.ApplicationContext;
import org.springframework.core.StandardReflectionParameterNameDiscoverer;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* 系统日志切面处理类
*/
@Aspect
@Component
public class OperationLogAspect {
/**
* 解析spell表达式
*/
ExpressionParser parser = new SpelExpressionParser();
/**
* 将方法参数纳入Spring管理
*/
private final StandardReflectionParameterNameDiscoverer
discoverer = new StandardReflectionParameterNameDiscoverer();
@Resource
private ApplicationContext applicationContext;
@Resource
private OperationLogService operationLogService;
private ThreadLocal<List<OperationLog>> beforeValue = new ThreadLocal<>();
private ThreadLocal<String> localUser = new ThreadLocal<>();
private final String[] methodNames = new String[]{"delete", "update", "add"};
/**
* 定义切点 @Pointcut 在注解的位置切入代码
*/
@Pointcut("@annotation(io.metersphere.sdk.log.annotation.RequestLog)")
public void logPointCut() {
}
@Before("logPointCut()")
public void before(JoinPoint joinPoint) {
try {
//从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取切入点所在的方法
Method method = signature.getMethod();
RequestLog msLog = method.getAnnotation(RequestLog.class);
if (msLog != null && StringUtils.isNotEmpty(msLog.event())) {
//获取参数对象数组
Object[] args = joinPoint.getArgs();
//获取方法参数名
String[] params = discoverer.getParameterNames(method);
//将参数纳入Spring管理
EvaluationContext context = new StandardEvaluationContext();
for (int len = 0; len < params.length; len++) {
context.setVariable(params[len], args[len]);
}
boolean isNext = false;
for (Class clazz : msLog.msClass()) {
if (clazz.getName().endsWith("SessionUtils")) {
localUser.set(SessionUtils.getUserId());
continue;
}
context.setVariable("msClass", applicationContext.getBean(clazz));
isNext = true;
}
if (isNext) {
Expression expression = parser.parseExpression(msLog.event());
List<OperationLog> beforeContent = expression.getValue(context, List.class);
beforeValue.set(beforeContent);
}
}
} catch (Exception e) {
LogUtils.error("操作日志写入异常:" + joinPoint.getSignature());
}
}
public boolean isMatch(String keyword) {
return Arrays.stream(methodNames)
.anyMatch(input -> input.contains(keyword));
}
private void add(OperationLog operationLog, RequestLog msLog, JoinPoint joinPoint) {
//从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取切入点所在的方法
Method method = signature.getMethod();
//获取参数对象数组
Object[] args = joinPoint.getArgs();
// 操作类型
operationLog.setType(msLog.type().name());
// 创建用户
if (StringUtils.isNotBlank(msLog.createUser())) {
operationLog.setCreateUser(msLog.createUser());
}
// 项目ID
operationLog.setProjectId(msLog.projectId());
operationLog.setModule(msLog.module());
//获取方法参数名
String[] params = discoverer.getParameterNames(method);
//将参数纳入Spring管理
EvaluationContext context = new StandardEvaluationContext();
for (int len = 0; len < params.length; len++) {
context.setVariable(params[len], args[len]);
}
for (Class clazz : msLog.msClass()) {
context.setVariable("msClass", applicationContext.getBean(clazz));
}
// 批量编辑操作
if (msLog.isBatch()) {
operationLogService.batchAdd(beforeValue.get());
return;
}
// 项目ID表达式
try {
Expression titleExp = parser.parseExpression(msLog.projectId());
String project = titleExp.getValue(context, String.class);
operationLog.setProjectId(project);
} catch (Exception e) {
operationLog.setProjectId(msLog.projectId());
}
// 标题
if (StringUtils.isNotEmpty(msLog.details())) {
String details = msLog.details();
try {
Expression titleExp = parser.parseExpression(details);
details = titleExp.getValue(context, String.class);
operationLog.setDetails(details);
} catch (Exception e) {
operationLog.setDetails(details);
}
}
// 资源ID
if (StringUtils.isNotEmpty(msLog.sourceId())) {
try {
String sourceId = msLog.sourceId();
Expression titleExp = parser.parseExpression(sourceId);
sourceId = titleExp.getValue(context, String.class);
operationLog.setSourceId(sourceId);
} catch (Exception e) {
operationLog.setSourceId(msLog.sourceId());
}
}
if (StringUtils.isBlank(operationLog.getCreateUser())) {
operationLog.setCreateUser(localUser.get());
}
operationLogService.add(operationLog);
}
/**
* 切面 配置通知
*/
@AfterReturning(value = "logPointCut()", returning = "result")
public void saveLog(JoinPoint joinPoint, Object result) {
try {
//从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取切入点所在的方法
Method method = signature.getMethod();
//保存日志
OperationLog operationLog = new OperationLog();
//保存获取的操作
operationLog.setId(UUID.randomUUID().toString());
String className = joinPoint.getTarget().getClass().getName();
operationLog.setMethod(StringUtils.join(className, ".", method.getName()));
operationLog.setCreateTime(System.currentTimeMillis());
operationLog.setCreateUser(SessionUtils.getUserId());
HttpServletRequest request = ((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getServletPath();
operationLog.setPath(path);
// 获取操作
RequestLog msLog = method.getAnnotation(RequestLog.class);
if (msLog != null) {
add(operationLog, msLog, joinPoint);
}
// 兼容遗漏注解的内容
else if (isMatch(method.getName())) {
operationLogService.add(operationLog);
}
} catch (Exception e) {
LogUtils.error("操作日志写入异常:", e);
} finally {
localUser.remove();
beforeValue.remove();
}
}
}

View File

@ -0,0 +1,49 @@
package io.metersphere.sdk.log.constants;
public class OperationLogModule {
public static final String UNKNOWN_MODULE = "UNKNOWN_MODULE";
public static final String SYSTEM_PARAMETER_SETTING = "SYSTEM_PARAMETER_SETTING";
public static final String SYSTEM_TEST_RESOURCE = "SYSTEM_TEST_RESOURCE";
public static final String SYSTEM_USER = "SYSTEM_USER";
public static final String SYSTEM_WORKSPACE = "SYSTEM_WORKSPACE";
public static final String WORKSPACE_TEMPLATE_SETTINGS = "WORKSPACE_TEMPLATE_SETTINGS";
public static final String WORKSPACE_MESSAGE_SETTINGS = "WORKSPACE_MESSAGE_SETTINGS";
public static final String WORKSPACE_TEMPLATE_SETTINGS_FIELD = "WORKSPACE_TEMPLATE_SETTINGS_FIELD";
public static final String WORKSPACE_TEMPLATE_SETTINGS_ISSUE = "WORKSPACE_TEMPLATE_SETTINGS_ISSUE";
public static final String WORKSPACE_SERVICE_INTEGRATION = "WORKSPACE_SERVICE_INTEGRATION";
public static final String WORKSPACE_TEMPLATE_SETTINGS_CASE = "WORKSPACE_TEMPLATE_SETTINGS_CASE";
public static final String WORKSPACE_TEMPLATE_SETTINGS_API = "WORKSPACE_TEMPLATE_SETTINGS_API";
public static final String WORKSPACE_MEMBER = "WORKSPACE_MEMBER";
public static final String API_AUTOMATION = "API_AUTOMATION";
public static final String API_AUTOMATION_SCHEDULE = "API_AUTOMATION_SCHEDULE";
public static final String API_AUTOMATION_REPORT = "API_AUTOMATION_REPORT";
public static final String API_DEFINITION = "API_DEFINITION";
public static final String API_DEFINITION_CASE = "API_DEFINITION_CASE";
public static final String TRACK_TEST_PLAN = "TRACK_TEST_PLAN";
public static final String TRACK_TEST_PLAN_SCHEDULE = "TRACK_TEST_PLAN_SCHEDULE";
public static final String TRACK_BUG = "TRACK_BUG";
public static final String TRACK_TEST_CASE_REVIEW = "TRACK_TEST_CASE_REVIEW";
public static final String TRACK_TEST_CASE = "TRACK_TEST_CASE";
public static final String TRACK_REPORT = "TRACK_REPORT";
public static final String AUTH_TITLE = "AUTH_TITLE";
public static final String PROJECT_PROJECT_JAR = "PROJECT_PROJECT_JAR";
public static final String PROJECT_ENVIRONMENT_SETTING = "PROJECT_ENVIRONMENT_SETTING";
public static final String PROJECT_PROJECT_MANAGER = "PROJECT_PROJECT_MANAGER";
public static final String PROJECT_FILE_MANAGEMENT = "PROJECT_FILE_MANAGEMENT";
public static final String PROJECT_TEMPLATE_MANAGEMENT = "PROJECT_TEMPLATE_MANAGEMENT";
public static final String PROJECT_PROJECT_MEMBER = "PROJECT_PROJECT_MEMBER";
public static final String PERSONAL_INFORMATION_PERSONAL_SETTINGS = "PERSONAL_INFORMATION_PERSONAL_SETTINGS";
public static final String PERSONAL_INFORMATION_APIKEYS = "PERSONAL_INFORMATION_APIKEYS";
public static final String GROUP_PERMISSION = "GROUP_PERMISSION";
public static final String PERFORMANCE_TEST_REPORT = "PERFORMANCE_TEST_REPORT";
public static final String PERFORMANCE_TEST = "PERFORMANCE_TEST";
public static final String ERROR_REPORT_LIBRARY = "ERROR_REPORT_LIBRARY";
public static final String SYSTEM_QUOTA_MANAGEMENT = "SYSTEM_QUOTA_MANAGEMENT";
public static final String ENTERPRISE_TEST_REPORT = "ENTERPRISE_TEST_REPORT";
public static final String SYSTEM_AUTHORIZATION_MANAGEMENT = "SYSTEM_AUTHORIZATION_MANAGEMENT";
public static final String UI_ELEMENT = "UI_ELEMENT";
public static final String UI_AUTOMATION = "UI_AUTOMATION";
public static final String UI_AUTOMATION_REPORT = "UI_AUTOMATION_REPORT";
public static final String UI_AUTOMATION_SCHEDULE = "UI_AUTOMATION_SCHEDULE";
public static final String PLUGIN_MANAGE = "PLUGIN_MANAGE";
}

View File

@ -0,0 +1,17 @@
package io.metersphere.sdk.log.constants;
public enum OperationLogType {
ADD,
DELETE,
UPDATE,
DEBUG,
REVIEW,
COPY,
EXECUTE,
SHARE,
RESTORE,
IMPORT,
EXPORT,
LOGIN,
SELECT
}

View File

@ -0,0 +1,55 @@
package io.metersphere.sdk.log.service;
import io.metersphere.system.domain.OperationLog;
import io.metersphere.system.mapper.OperationLogMapper;
import jakarta.annotation.Resource;
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.mybatis.spring.SqlSessionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class OperationLogService {
@Resource
private OperationLogMapper operationLogMapper;
@Resource
private SqlSessionFactory sqlSessionFactory;
public void add(OperationLog log) {
if (StringUtils.isBlank(log.getProjectId())) {
log.setProjectId("none");
}
if (StringUtils.isBlank(log.getCreateUser())) {
log.setCreateUser("admin");
}
// 限制长度
if (StringUtils.isNotBlank(log.getDetails()) && log.getDetails().length() > 1000) {
log.setDetails(log.getDetails().substring(0, 1000));
}
operationLogMapper.insert(log);
}
public void batchAdd(List<OperationLog> logs) {
if (CollectionUtils.isEmpty(logs)) {
return;
}
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
OperationLogMapper logMapper = sqlSession.getMapper(OperationLogMapper.class);
if (CollectionUtils.isNotEmpty(logs)) {
logs.forEach(item -> {
logMapper.insert(item);
});
}
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}
}

View File

@ -7,6 +7,9 @@ import io.metersphere.api.dto.definition.ApiDefinitionDTO;
import io.metersphere.api.dto.definition.ListRequestDTO;
import io.metersphere.api.service.ApiDefinitionService;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.sdk.log.annotation.RequestLog;
import io.metersphere.sdk.log.constants.OperationLogModule;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.sdk.util.PageUtils;
import io.metersphere.sdk.util.Pager;
import io.metersphere.validation.groups.Created;
@ -29,11 +32,20 @@ public class ApiDefinitionController {
@PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_VALUE)
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_ADD_API)
public ApiDefinitionDTO create(@Validated({Created.class}) @RequestBody ApiDefinitionDTO request,
@RequestLog(type = OperationLogType.ADD, module = OperationLogModule.API_DEFINITION,
sourceId = "#request.id", projectId = "#request.projectId", details = "#request.name")
public ApiDefinitionDTO add(@Validated({Created.class}) @RequestBody ApiDefinitionDTO request,
@RequestParam(value = "files") List<MultipartFile> bodyFiles) {
return apiDefinitionService.create(request, bodyFiles);
}
@PostMapping(value = "/batch-del")
@RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_READ_DELETE)
@RequestLog(isBatch = true, event = "#msClass.getLogs(#ids)", msClass = ApiDefinitionService.class)
public void batchDelete(@RequestBody List<String> ids) {
apiDefinitionService.batchDelete(ids);
}
@PostMapping(value = "/page")
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ)
public Pager<List<ApiDefinition>> list(@Validated @RequestBody ListRequestDTO request) {

View File

@ -5,13 +5,19 @@ import io.metersphere.api.domain.ApiDefinitionExample;
import io.metersphere.api.dto.definition.ApiDefinitionDTO;
import io.metersphere.api.dto.definition.ListRequestDTO;
import io.metersphere.api.mapper.ApiDefinitionMapper;
import io.metersphere.sdk.log.constants.OperationLogModule;
import io.metersphere.sdk.log.constants.OperationLogType;
import io.metersphere.system.domain.OperationLog;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Service
public class ApiDefinitionService {
@ -23,7 +29,6 @@ public class ApiDefinitionService {
return request;
}
public List<ApiDefinition> list(@NotNull ListRequestDTO request) {
ApiDefinitionExample example = new ApiDefinitionExample();
ApiDefinitionExample.Criteria criteria = example.createCriteria();
@ -42,8 +47,37 @@ public class ApiDefinitionService {
if (StringUtils.isNotBlank(request.getProtocol())) {
criteria.andProtocolEqualTo(request.getProtocol());
}
return apiDefinitionMapper.selectByExample(example);
}
public void batchDelete(List<String> ids) {
}
/**
* 批量操作日志由切面触发
*
* @param ids
*/
public List<OperationLog> getLogs(List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
List<OperationLog> logs = new ArrayList<>();
ApiDefinitionExample example = new ApiDefinitionExample();
example.createCriteria().andIdIn(ids);
List<ApiDefinition> definitions = apiDefinitionMapper.selectByExample(example);
definitions.forEach(definition -> {
OperationLog log = new OperationLog();
log.setId(UUID.randomUUID().toString());
log.setCreateUser(definition.getUpdateUser());
log.setProjectId(definition.getProjectId());
log.setType(OperationLogType.DELETE.name());
log.setModule(OperationLogModule.API_DEFINITION);
log.setSourceId(definition.getId());
log.setDetails(definition.getName());
logs.add(log);
});
return logs;
}
}

View File

@ -11,7 +11,6 @@ import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.Pager;
import io.metersphere.utils.JsonUtils;
import jakarta.annotation.Resource;
import org.junit.Before;
import org.junit.jupiter.api.*;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
@ -24,6 +23,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.util.ArrayList;
import java.util.List;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ -39,13 +39,8 @@ public class ApiDefinitionControllerTests {
private static String sessionId;
private static String csrfToken;
@Before
public void init() {
LogUtils.info("init base api test");
}
@Test
@Order(0)
@BeforeEach
public void login() throws Exception {
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/login")
.content("{\"username\":\"admin\",\"password\":\"metersphere\"}")
@ -173,4 +168,19 @@ public class ApiDefinitionControllerTests {
.andExpect(status().isBadRequest());
}
@Test
@Order(4)
public void testBatchDel() throws Exception {
LogUtils.info("delete api test");
List<String> tests = new ArrayList<>();
tests.add("test-api-id");
mockMvc.perform(MockMvcRequestBuilders.multipart(prefix + "/batch-del")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(JSON.toJSONString(tests))
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken))
.andExpect(status().isOk());
}
}