diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistory.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistory.java similarity index 85% rename from backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistory.java rename to backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistory.java index 0a1055f0f3..6db66b34ca 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistory.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistory.java @@ -9,14 +9,14 @@ import java.util.Arrays; import lombok.Data; @Data -public class OperationLogHistory implements Serializable { +public class OperationHistory implements Serializable { @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{operation_log_history.id.not_blank}", groups = {Updated.class}) + @NotBlank(message = "{operation_history.id.not_blank}", groups = {Updated.class}) private Long id; @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{operation_log_history.project_id.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 50, message = "{operation_log_history.project_id.length_range}", groups = {Created.class, Updated.class}) + @NotBlank(message = "{operation_history.project_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{operation_history.project_id.length_range}", groups = {Created.class, Updated.class}) private String projectId; @Schema(description = "操作时间") @@ -29,8 +29,8 @@ public class OperationLogHistory implements Serializable { private String sourceId; @Schema(description = "操作类型/add/update/delete", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{operation_log_history.type.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 20, message = "{operation_log_history.type.length_range}", groups = {Created.class, Updated.class}) + @NotBlank(message = "{operation_history.type.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 20, message = "{operation_history.type.length_range}", groups = {Created.class, Updated.class}) private String type; @Schema(description = "操作模块/api/case/scenario/ui") diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistoryExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistoryExample.java similarity index 99% rename from backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistoryExample.java rename to backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistoryExample.java index 0bb600f3dc..9b8d0daeae 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationLogHistoryExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OperationHistoryExample.java @@ -3,14 +3,14 @@ package io.metersphere.system.domain; import java.util.ArrayList; import java.util.List; -public class OperationLogHistoryExample { +public class OperationHistoryExample { protected String orderByClause; protected boolean distinct; protected List oredCriteria; - public OperationLogHistoryExample() { + public OperationHistoryExample() { oredCriteria = new ArrayList(); } diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.java b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.java new file mode 100644 index 0000000000..f3df48d26f --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.java @@ -0,0 +1,34 @@ +package io.metersphere.system.mapper; + +import io.metersphere.system.domain.OperationHistory; +import io.metersphere.system.domain.OperationHistoryExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface OperationHistoryMapper { + long countByExample(OperationHistoryExample example); + + int deleteByExample(OperationHistoryExample example); + + int deleteByPrimaryKey(Long id); + + int insert(OperationHistory record); + + int insertSelective(OperationHistory record); + + List selectByExample(OperationHistoryExample example); + + OperationHistory selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") OperationHistory record, @Param("example") OperationHistoryExample example); + + int updateByExample(@Param("record") OperationHistory record, @Param("example") OperationHistoryExample example); + + int updateByPrimaryKeySelective(OperationHistory record); + + int updateByPrimaryKey(OperationHistory record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") OperationHistory.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.xml similarity index 91% rename from backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.xml rename to backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.xml index 63dd456bd4..84b6fe6ecb 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationHistoryMapper.xml @@ -1,7 +1,7 @@ - - + + @@ -71,13 +71,13 @@ id, project_id, create_time, create_user, source_id, `type`, `module` - select distinct - from operation_log_history + from operation_history @@ -88,29 +88,29 @@ - delete from operation_log_history + delete from operation_history where id = #{id,jdbcType=BIGINT} - - delete from operation_log_history + + delete from operation_history - - insert into operation_log_history (id, project_id, create_time, + + insert into operation_history (id, project_id, create_time, create_user, source_id, `type`, `module`) values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{module,jdbcType=VARCHAR}) - - insert into operation_log_history + + insert into operation_history id, @@ -158,14 +158,14 @@ - + select count(*) from operation_history - update operation_log_history + update operation_history id = #{record.id,jdbcType=BIGINT}, @@ -194,7 +194,7 @@ - update operation_log_history + update operation_history set id = #{record.id,jdbcType=BIGINT}, project_id = #{record.projectId,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, @@ -206,8 +206,8 @@ - - update operation_log_history + + update operation_history project_id = #{projectId,jdbcType=VARCHAR}, @@ -230,8 +230,8 @@ where id = #{id,jdbcType=BIGINT} - - update operation_log_history + + update operation_history set project_id = #{projectId,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, create_user = #{createUser,jdbcType=VARCHAR}, @@ -241,7 +241,7 @@ where id = #{id,jdbcType=BIGINT} - insert into operation_log_history + insert into operation_history (id, project_id, create_time, create_user, source_id, `type`, `module`) values @@ -251,7 +251,7 @@ - insert into operation_log_history ( + insert into operation_history ( ${column.escapedColumnName} diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.java b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.java deleted file mode 100644 index 3c79f1c077..0000000000 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/OperationLogHistoryMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.metersphere.system.mapper; - -import io.metersphere.system.domain.OperationLogHistory; -import io.metersphere.system.domain.OperationLogHistoryExample; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -public interface OperationLogHistoryMapper { - long countByExample(OperationLogHistoryExample example); - - int deleteByExample(OperationLogHistoryExample example); - - int deleteByPrimaryKey(Long id); - - int insert(OperationLogHistory record); - - int insertSelective(OperationLogHistory record); - - List selectByExample(OperationLogHistoryExample example); - - OperationLogHistory selectByPrimaryKey(Long id); - - int updateByExampleSelective(@Param("record") OperationLogHistory record, @Param("example") OperationLogHistoryExample example); - - int updateByExample(@Param("record") OperationLogHistory record, @Param("example") OperationLogHistoryExample example); - - int updateByPrimaryKeySelective(OperationLogHistory record); - - int updateByPrimaryKey(OperationLogHistory record); - - int batchInsert(@Param("list") List list); - - int batchInsertSelective(@Param("list") List list, @Param("selective") OperationLogHistory.Column ... selective); -} \ No newline at end of file diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_2__sdk_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_2__sdk_ddl.sql index 6798a52ec3..02b3d2a8a2 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_2__sdk_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_2__sdk_ddl.sql @@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS worker_node DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'DB WorkerID Assigner for UID Generator'; -CREATE TABLE operation_log_history +CREATE TABLE operation_history ( `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' , `project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id', @@ -143,11 +143,11 @@ CREATE TABLE operation_log_history DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '变更记录'; -CREATE INDEX idx_create_time ON operation_log_history (`create_time`); -CREATE INDEX idx_create_user ON operation_log_history (`create_user`); -CREATE INDEX idx_module ON operation_log_history (`module`); -CREATE INDEX idx_project_id ON operation_log_history (`project_id`); -CREATE INDEX idx_type ON operation_log_history (`type`); +CREATE INDEX idx_create_time ON operation_history (`create_time`); +CREATE INDEX idx_create_user ON operation_history (`create_user`); +CREATE INDEX idx_module ON operation_history (`module`); +CREATE INDEX idx_project_id ON operation_history (`project_id`); +CREATE INDEX idx_type ON operation_history (`type`); -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/log/service/OperationLogService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/log/service/OperationLogService.java index 9e73e9174e..38871da1f2 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/log/service/OperationLogService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/log/service/OperationLogService.java @@ -7,7 +7,7 @@ import io.metersphere.sdk.mapper.OperationLogBlobMapper; import io.metersphere.sdk.mapper.OperationLogMapper; import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.Translator; -import io.metersphere.system.domain.OperationLogHistory; +import io.metersphere.system.domain.OperationHistory; import io.metersphere.system.domain.Organization; import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.log.dto.LogDTO; @@ -35,7 +35,7 @@ public class OperationLogService { @Resource private OperationLogMapper operationLogMapper; @Resource - private OperationLogHistoryMapper operationLogHistoryMapper; + private OperationHistoryMapper operationHistoryMapper; @Resource private OperationLogBlobMapper operationLogBlobMapper; @Resource @@ -53,8 +53,8 @@ public class OperationLogService { @Resource private BaseOrganizationMapper baseOrganizationMapper; - private static OperationLogHistory getHistory(LogDTO log) { - OperationLogHistory history = new OperationLogHistory(); + private static OperationHistory getHistory(LogDTO log) { + OperationHistory history = new OperationHistory(); BeanUtils.copyBean(history, log); return history; } @@ -82,7 +82,7 @@ public class OperationLogService { } log.setContent(subStrContent(log.getContent())); operationLogMapper.insert(log); - operationLogHistoryMapper.insert(getHistory(log)); + operationHistoryMapper.insert(getHistory(log)); operationLogBlobMapper.insert(getBlob(log)); } @@ -127,7 +127,7 @@ public class OperationLogService { item.setCreateTime(currentTimeMillis); // 限制长度 operationLogMapper.insert(item); - operationLogHistoryMapper.insert(getHistory(item)); + operationHistoryMapper.insert(getHistory(item)); logBlobMapper.insert(getBlob(item)); }); }