refactor(系统设置): 优化变更记录表名
This commit is contained in:
parent
a90a8a0865
commit
d19660f060
|
@ -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")
|
|
@ -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<Criteria> oredCriteria;
|
||||
|
||||
public OperationLogHistoryExample() {
|
||||
public OperationHistoryExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
|
@ -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<OperationHistory> 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<OperationHistory> list);
|
||||
|
||||
int batchInsertSelective(@Param("list") List<OperationHistory> list, @Param("selective") OperationHistory.Column ... selective);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?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.OperationLogHistoryMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperationLogHistory">
|
||||
<mapper namespace="io.metersphere.system.mapper.OperationHistoryMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperationHistory">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
|
@ -71,13 +71,13 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, project_id, create_time, create_user, source_id, `type`, `module`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample" resultMap="BaseResultMap">
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from operation_log_history
|
||||
from operation_history
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -88,29 +88,29 @@
|
|||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from operation_log_history
|
||||
from operation_history
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from operation_log_history
|
||||
delete from operation_history
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample">
|
||||
delete from operation_log_history
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample">
|
||||
delete from operation_history
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
||||
insert into operation_log_history (id, project_id, create_time,
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||
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>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
||||
insert into operation_log_history
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||
insert into operation_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
|
@ -158,14 +158,14 @@
|
|||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample" resultType="java.lang.Long">
|
||||
select count(*) from operation_log_history
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample" resultType="java.lang.Long">
|
||||
select count(*) from operation_history
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update operation_log_history
|
||||
update operation_history
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
|
@ -194,7 +194,7 @@
|
|||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
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 @@
|
|||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
||||
update operation_log_history
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||
update operation_history
|
||||
<set>
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
|
@ -230,8 +230,8 @@
|
|||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
||||
update operation_log_history
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||
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}
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into operation_log_history
|
||||
insert into operation_history
|
||||
(id, project_id, create_time, create_user, source_id, `type`, `module`)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
|
@ -251,7 +251,7 @@
|
|||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
insert into operation_log_history (
|
||||
insert into operation_history (
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
|
@ -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<OperationLogHistory> 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<OperationLogHistory> list);
|
||||
|
||||
int batchInsertSelective(@Param("list") List<OperationLogHistory> list, @Param("selective") OperationLogHistory.Column ... selective);
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue