refactor(系统设置): 优化变更记录表名
This commit is contained in:
parent
a90a8a0865
commit
d19660f060
|
@ -9,14 +9,14 @@ import java.util.Arrays;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OperationLogHistory implements Serializable {
|
public class OperationHistory implements Serializable {
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
@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;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{operation_log_history.project_id.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{operation_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})
|
@Size(min = 1, max = 50, message = "{operation_history.project_id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
@Schema(description = "操作时间")
|
@Schema(description = "操作时间")
|
||||||
|
@ -29,8 +29,8 @@ public class OperationLogHistory implements Serializable {
|
||||||
private String sourceId;
|
private String sourceId;
|
||||||
|
|
||||||
@Schema(description = "操作类型/add/update/delete", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "操作类型/add/update/delete", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{operation_log_history.type.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{operation_history.type.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 20, message = "{operation_log_history.type.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 20, message = "{operation_history.type.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "操作模块/api/case/scenario/ui")
|
@Schema(description = "操作模块/api/case/scenario/ui")
|
|
@ -3,14 +3,14 @@ package io.metersphere.system.domain;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OperationLogHistoryExample {
|
public class OperationHistoryExample {
|
||||||
protected String orderByClause;
|
protected String orderByClause;
|
||||||
|
|
||||||
protected boolean distinct;
|
protected boolean distinct;
|
||||||
|
|
||||||
protected List<Criteria> oredCriteria;
|
protected List<Criteria> oredCriteria;
|
||||||
|
|
||||||
public OperationLogHistoryExample() {
|
public OperationHistoryExample() {
|
||||||
oredCriteria = new ArrayList<Criteria>();
|
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"?>
|
<?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">
|
<!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">
|
<mapper namespace="io.metersphere.system.mapper.OperationHistoryMapper">
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperationLogHistory">
|
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.OperationHistory">
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
|
@ -71,13 +71,13 @@
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, create_time, create_user, source_id, `type`, `module`
|
id, project_id, create_time, create_user, source_id, `type`, `module`
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<if test="distinct">
|
<if test="distinct">
|
||||||
distinct
|
distinct
|
||||||
</if>
|
</if>
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from operation_log_history
|
from operation_history
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -88,29 +88,29 @@
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from operation_log_history
|
from operation_history
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete from operation_log_history
|
delete from operation_history
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample">
|
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample">
|
||||||
delete from operation_log_history
|
delete from operation_history
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
<insert id="insert" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||||
insert into operation_log_history (id, project_id, create_time,
|
insert into operation_history (id, project_id, create_time,
|
||||||
create_user, source_id, `type`,
|
create_user, source_id, `type`,
|
||||||
`module`)
|
`module`)
|
||||||
values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
#{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{module,jdbcType=VARCHAR})
|
#{module,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
<insert id="insertSelective" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||||
insert into operation_log_history
|
insert into operation_history
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
id,
|
id,
|
||||||
|
@ -158,14 +158,14 @@
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.system.domain.OperationLogHistoryExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.system.domain.OperationHistoryExample" resultType="java.lang.Long">
|
||||||
select count(*) from operation_log_history
|
select count(*) from operation_history
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
update operation_log_history
|
update operation_history
|
||||||
<set>
|
<set>
|
||||||
<if test="record.id != null">
|
<if test="record.id != null">
|
||||||
id = #{record.id,jdbcType=BIGINT},
|
id = #{record.id,jdbcType=BIGINT},
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update operation_log_history
|
update operation_history
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
@ -206,8 +206,8 @@
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||||
update operation_log_history
|
update operation_history
|
||||||
<set>
|
<set>
|
||||||
<if test="projectId != null">
|
<if test="projectId != null">
|
||||||
project_id = #{projectId,jdbcType=VARCHAR},
|
project_id = #{projectId,jdbcType=VARCHAR},
|
||||||
|
@ -230,8 +230,8 @@
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperationLogHistory">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.OperationHistory">
|
||||||
update operation_log_history
|
update operation_history
|
||||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
<insert id="batchInsert" parameterType="map">
|
<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`)
|
(id, project_id, create_time, create_user, source_id, `type`, `module`)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsertSelective" parameterType="map">
|
<insert id="batchInsertSelective" parameterType="map">
|
||||||
insert into operation_log_history (
|
insert into operation_history (
|
||||||
<foreach collection="selective" item="column" separator=",">
|
<foreach collection="selective" item="column" separator=",">
|
||||||
${column.escapedColumnName}
|
${column.escapedColumnName}
|
||||||
</foreach>
|
</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
|
DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE = utf8mb4_general_ci COMMENT = 'DB WorkerID Assigner for UID Generator';
|
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 '主键' ,
|
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键' ,
|
||||||
`project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id',
|
`project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id',
|
||||||
|
@ -143,11 +143,11 @@ CREATE TABLE operation_log_history
|
||||||
DEFAULT CHARSET = utf8mb4
|
DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE = utf8mb4_general_ci COMMENT = '变更记录';
|
COLLATE = utf8mb4_general_ci COMMENT = '变更记录';
|
||||||
|
|
||||||
CREATE INDEX idx_create_time ON operation_log_history (`create_time`);
|
CREATE INDEX idx_create_time ON operation_history (`create_time`);
|
||||||
CREATE INDEX idx_create_user ON operation_log_history (`create_user`);
|
CREATE INDEX idx_create_user ON operation_history (`create_user`);
|
||||||
CREATE INDEX idx_module ON operation_log_history (`module`);
|
CREATE INDEX idx_module ON operation_history (`module`);
|
||||||
CREATE INDEX idx_project_id ON operation_log_history (`project_id`);
|
CREATE INDEX idx_project_id ON operation_history (`project_id`);
|
||||||
CREATE INDEX idx_type ON operation_log_history (`type`);
|
CREATE INDEX idx_type ON operation_history (`type`);
|
||||||
|
|
||||||
-- set innodb lock wait timeout to default
|
-- set innodb lock wait timeout to default
|
||||||
SET SESSION innodb_lock_wait_timeout = 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.mapper.OperationLogMapper;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.BeanUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
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.domain.Organization;
|
||||||
import io.metersphere.system.dto.sdk.OptionDTO;
|
import io.metersphere.system.dto.sdk.OptionDTO;
|
||||||
import io.metersphere.system.log.dto.LogDTO;
|
import io.metersphere.system.log.dto.LogDTO;
|
||||||
|
@ -35,7 +35,7 @@ public class OperationLogService {
|
||||||
@Resource
|
@Resource
|
||||||
private OperationLogMapper operationLogMapper;
|
private OperationLogMapper operationLogMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private OperationLogHistoryMapper operationLogHistoryMapper;
|
private OperationHistoryMapper operationHistoryMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private OperationLogBlobMapper operationLogBlobMapper;
|
private OperationLogBlobMapper operationLogBlobMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -53,8 +53,8 @@ public class OperationLogService {
|
||||||
@Resource
|
@Resource
|
||||||
private BaseOrganizationMapper baseOrganizationMapper;
|
private BaseOrganizationMapper baseOrganizationMapper;
|
||||||
|
|
||||||
private static OperationLogHistory getHistory(LogDTO log) {
|
private static OperationHistory getHistory(LogDTO log) {
|
||||||
OperationLogHistory history = new OperationLogHistory();
|
OperationHistory history = new OperationHistory();
|
||||||
BeanUtils.copyBean(history, log);
|
BeanUtils.copyBean(history, log);
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class OperationLogService {
|
||||||
}
|
}
|
||||||
log.setContent(subStrContent(log.getContent()));
|
log.setContent(subStrContent(log.getContent()));
|
||||||
operationLogMapper.insert(log);
|
operationLogMapper.insert(log);
|
||||||
operationLogHistoryMapper.insert(getHistory(log));
|
operationHistoryMapper.insert(getHistory(log));
|
||||||
operationLogBlobMapper.insert(getBlob(log));
|
operationLogBlobMapper.insert(getBlob(log));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class OperationLogService {
|
||||||
item.setCreateTime(currentTimeMillis);
|
item.setCreateTime(currentTimeMillis);
|
||||||
// 限制长度
|
// 限制长度
|
||||||
operationLogMapper.insert(item);
|
operationLogMapper.insert(item);
|
||||||
operationLogHistoryMapper.insert(getHistory(item));
|
operationHistoryMapper.insert(getHistory(item));
|
||||||
logBlobMapper.insert(getBlob(item));
|
logBlobMapper.insert(getBlob(item));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue