refactor: 日志接口-系统菜单日志
This commit is contained in:
parent
4df2229011
commit
33ef309848
|
@ -36,10 +36,6 @@ public class OperationLog implements Serializable {
|
||||||
@Schema(description = "资源id")
|
@Schema(description = "资源id")
|
||||||
private String sourceId;
|
private String sourceId;
|
||||||
|
|
||||||
@Schema(description = "批次id", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotBlank(message = "{operation_log.batch_id.not_blank}", groups = {Created.class})
|
|
||||||
private String batchId;
|
|
||||||
|
|
||||||
@Schema(description = "操作方法", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "操作方法", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{operation_log.method.not_blank}", groups = {Created.class})
|
@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})
|
@Size(min = 1, max = 255, message = "{operation_log.method.length_range}", groups = {Created.class, Updated.class})
|
||||||
|
@ -68,7 +64,6 @@ public class OperationLog implements Serializable {
|
||||||
createTime("create_time", "createTime", "BIGINT", false),
|
createTime("create_time", "createTime", "BIGINT", false),
|
||||||
createUser("create_user", "createUser", "VARCHAR", false),
|
createUser("create_user", "createUser", "VARCHAR", false),
|
||||||
sourceId("source_id", "sourceId", "VARCHAR", false),
|
sourceId("source_id", "sourceId", "VARCHAR", false),
|
||||||
batchId("batch_id", "batchId", "VARCHAR", false),
|
|
||||||
method("method", "method", "VARCHAR", true),
|
method("method", "method", "VARCHAR", true),
|
||||||
type("type", "type", "VARCHAR", true),
|
type("type", "type", "VARCHAR", true),
|
||||||
module("module", "module", "VARCHAR", true),
|
module("module", "module", "VARCHAR", true),
|
||||||
|
|
|
@ -514,76 +514,6 @@ public class OperationLogExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andBatchIdIsNull() {
|
|
||||||
addCriterion("batch_id is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdIsNotNull() {
|
|
||||||
addCriterion("batch_id is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdEqualTo(String value) {
|
|
||||||
addCriterion("batch_id =", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdNotEqualTo(String value) {
|
|
||||||
addCriterion("batch_id <>", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdGreaterThan(String value) {
|
|
||||||
addCriterion("batch_id >", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("batch_id >=", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdLessThan(String value) {
|
|
||||||
addCriterion("batch_id <", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("batch_id <=", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdLike(String value) {
|
|
||||||
addCriterion("batch_id like", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdNotLike(String value) {
|
|
||||||
addCriterion("batch_id not like", value, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdIn(List<String> values) {
|
|
||||||
addCriterion("batch_id in", values, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdNotIn(List<String> values) {
|
|
||||||
addCriterion("batch_id not in", values, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdBetween(String value1, String value2) {
|
|
||||||
addCriterion("batch_id between", value1, value2, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andBatchIdNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("batch_id not between", value1, value2, "batchId");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andMethodIsNull() {
|
public Criteria andMethodIsNull() {
|
||||||
addCriterion("`method` is null");
|
addCriterion("`method` is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||||
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
|
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
|
||||||
<result column="batch_id" jdbcType="VARCHAR" property="batchId" />
|
|
||||||
<result column="method" jdbcType="VARCHAR" property="method" />
|
<result column="method" jdbcType="VARCHAR" property="method" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="module" jdbcType="VARCHAR" property="module" />
|
<result column="module" jdbcType="VARCHAR" property="module" />
|
||||||
|
@ -74,8 +73,8 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, organization_id, create_time, create_user, source_id, batch_id, `method`,
|
id, project_id, organization_id, create_time, create_user, source_id, `method`, `type`,
|
||||||
`type`, `module`, content, `path`
|
`module`, content, `path`
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.sdk.domain.OperationLogExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.sdk.domain.OperationLogExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -110,14 +109,12 @@
|
||||||
<insert id="insert" parameterType="io.metersphere.sdk.domain.OperationLog">
|
<insert id="insert" parameterType="io.metersphere.sdk.domain.OperationLog">
|
||||||
insert into operation_log (id, project_id, organization_id,
|
insert into operation_log (id, project_id, organization_id,
|
||||||
create_time, create_user, source_id,
|
create_time, create_user, source_id,
|
||||||
batch_id, `method`, `type`,
|
`method`, `type`, `module`,
|
||||||
`module`, content, `path`
|
content, `path`)
|
||||||
)
|
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR},
|
||||||
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR},
|
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{sourceId,jdbcType=VARCHAR},
|
||||||
#{batchId,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
#{method,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{module,jdbcType=VARCHAR},
|
||||||
#{module,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}
|
#{content,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR})
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.sdk.domain.OperationLog">
|
<insert id="insertSelective" parameterType="io.metersphere.sdk.domain.OperationLog">
|
||||||
insert into operation_log
|
insert into operation_log
|
||||||
|
@ -140,9 +137,6 @@
|
||||||
<if test="sourceId != null">
|
<if test="sourceId != null">
|
||||||
source_id,
|
source_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="batchId != null">
|
|
||||||
batch_id,
|
|
||||||
</if>
|
|
||||||
<if test="method != null">
|
<if test="method != null">
|
||||||
`method`,
|
`method`,
|
||||||
</if>
|
</if>
|
||||||
|
@ -178,9 +172,6 @@
|
||||||
<if test="sourceId != null">
|
<if test="sourceId != null">
|
||||||
#{sourceId,jdbcType=VARCHAR},
|
#{sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="batchId != null">
|
|
||||||
#{batchId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="method != null">
|
<if test="method != null">
|
||||||
#{method,jdbcType=VARCHAR},
|
#{method,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -225,9 +216,6 @@
|
||||||
<if test="record.sourceId != null">
|
<if test="record.sourceId != null">
|
||||||
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.batchId != null">
|
|
||||||
batch_id = #{record.batchId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="record.method != null">
|
<if test="record.method != null">
|
||||||
`method` = #{record.method,jdbcType=VARCHAR},
|
`method` = #{record.method,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -256,7 +244,6 @@
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
||||||
batch_id = #{record.batchId,jdbcType=VARCHAR},
|
|
||||||
`method` = #{record.method,jdbcType=VARCHAR},
|
`method` = #{record.method,jdbcType=VARCHAR},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
`module` = #{record.module,jdbcType=VARCHAR},
|
`module` = #{record.module,jdbcType=VARCHAR},
|
||||||
|
@ -284,9 +271,6 @@
|
||||||
<if test="sourceId != null">
|
<if test="sourceId != null">
|
||||||
source_id = #{sourceId,jdbcType=VARCHAR},
|
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="batchId != null">
|
|
||||||
batch_id = #{batchId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="method != null">
|
<if test="method != null">
|
||||||
`method` = #{method,jdbcType=VARCHAR},
|
`method` = #{method,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -312,7 +296,6 @@
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
source_id = #{sourceId,jdbcType=VARCHAR},
|
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||||
batch_id = #{batchId,jdbcType=VARCHAR},
|
|
||||||
`method` = #{method,jdbcType=VARCHAR},
|
`method` = #{method,jdbcType=VARCHAR},
|
||||||
`type` = #{type,jdbcType=VARCHAR},
|
`type` = #{type,jdbcType=VARCHAR},
|
||||||
`module` = #{module,jdbcType=VARCHAR},
|
`module` = #{module,jdbcType=VARCHAR},
|
||||||
|
@ -322,15 +305,14 @@
|
||||||
</update>
|
</update>
|
||||||
<insert id="batchInsert" parameterType="map">
|
<insert id="batchInsert" parameterType="map">
|
||||||
insert into operation_log
|
insert into operation_log
|
||||||
(id, project_id, organization_id, create_time, create_user, source_id, batch_id,
|
(id, project_id, organization_id, create_time, create_user, source_id, `method`,
|
||||||
`method`, `type`, `module`, content, `path`)
|
`type`, `module`, content, `path`)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.id,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.organizationId,jdbcType=VARCHAR},
|
(#{item.id,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.organizationId,jdbcType=VARCHAR},
|
||||||
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.sourceId,jdbcType=VARCHAR},
|
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.sourceId,jdbcType=VARCHAR},
|
||||||
#{item.batchId,jdbcType=VARCHAR}, #{item.method,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
#{item.method,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.module,jdbcType=VARCHAR},
|
||||||
#{item.module,jdbcType=VARCHAR}, #{item.content,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR}
|
#{item.content,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR})
|
||||||
)
|
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsertSelective" parameterType="map">
|
<insert id="batchInsertSelective" parameterType="map">
|
||||||
|
@ -361,9 +343,6 @@
|
||||||
<if test="'source_id'.toString() == column.value">
|
<if test="'source_id'.toString() == column.value">
|
||||||
#{item.sourceId,jdbcType=VARCHAR}
|
#{item.sourceId,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="'batch_id'.toString() == column.value">
|
|
||||||
#{item.batchId,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="'method'.toString() == column.value">
|
<if test="'method'.toString() == column.value">
|
||||||
#{item.method,jdbcType=VARCHAR}
|
#{item.method,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -9,7 +9,6 @@ CREATE TABLE IF NOT EXISTS operation_log
|
||||||
`create_time` BIGINT NOT NULL COMMENT '操作时间',
|
`create_time` BIGINT NOT NULL COMMENT '操作时间',
|
||||||
`create_user` VARCHAR(50) COMMENT '操作人',
|
`create_user` VARCHAR(50) COMMENT '操作人',
|
||||||
`source_id` VARCHAR(50) COMMENT '资源id',
|
`source_id` VARCHAR(50) COMMENT '资源id',
|
||||||
`batch_id` VARCHAR(50) COMMENT '批次id',
|
|
||||||
`method` VARCHAR(255) NOT NULL COMMENT '操作方法',
|
`method` VARCHAR(255) NOT NULL COMMENT '操作方法',
|
||||||
`type` VARCHAR(20) NOT NULL COMMENT '操作类型/add/update/delete',
|
`type` VARCHAR(20) NOT NULL COMMENT '操作类型/add/update/delete',
|
||||||
`module` VARCHAR(50) COMMENT '操作模块/api/case/scenario/ui',
|
`module` VARCHAR(50) COMMENT '操作模块/api/case/scenario/ui',
|
||||||
|
|
|
@ -53,4 +53,23 @@ public class OperationLogModule {
|
||||||
public static final String SYSTEM_PROJECT = "SYSTEM_PROJECT";
|
public static final String SYSTEM_PROJECT = "SYSTEM_PROJECT";
|
||||||
public static final String SYSTEM_PROJECT_MEMBER = "SYSTEM_PROJECT_MEMBER";
|
public static final String SYSTEM_PROJECT_MEMBER = "SYSTEM_PROJECT_MEMBER";
|
||||||
public static final String ORGANIZATION_PROJECT = "ORGANIZATION_PROJECT";
|
public static final String ORGANIZATION_PROJECT = "ORGANIZATION_PROJECT";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SETTING = "SETTING";
|
||||||
|
public static final String SETTING_SYSTEM = "SETTING_SYSTEM";
|
||||||
|
public static final String SETTING_SYSTEM_USER = "SETTING_SYSTEM_USER";
|
||||||
|
public static final String SETTING_SYSTEM_USER_GROUP = "SETTING_SYSTEM_USER_GROUP";
|
||||||
|
public static final String SETTING_SYSTEM_ORGANIZATION = "SETTING_SYSTEM_ORGANIZATION";
|
||||||
|
public static final String SETTING_SYSTEM_PARAMETER = "SETTING_SYSTEM_PARAMETER";
|
||||||
|
public static final String SETTING_SYSTEM_PARAMETER_PAGE_CONFIG = "SETTING_SYSTEM_PARAMETER_PAGE_CONFIG";
|
||||||
|
public static final String SETTING_SYSTEM_PARAMETER_AUTH_CONFIG = "SETTING_SYSTEM_PARAMETER_AUTH_CONFIG";
|
||||||
|
//系统设置-系统-资源池
|
||||||
|
public static final String SETTING_SYSTEM_RESOURCE_POOL = "SETTING_SYSTEM_RESOURCE_POOL";
|
||||||
|
public static final String SETTING_SYSTEM_AUTHORIZED_MANAGEMENT = "SETTING_SYSTEM_AUTHORIZED_MANAGEMENT";
|
||||||
|
public static final String SETTING_SYSTEM_LOG = "SETTING_SYSTEM_LOG";
|
||||||
|
public static final String SETTING_SYSTEM_PLUGIN_MANAGEMENT = "SETTING_SYSTEM_PLUGIN_MANAGEMENT";
|
||||||
|
public static final String SETTING_ORGANIZATION = "SETTING_ORGANIZATION";
|
||||||
|
public static final String SETTING_ORGANIZATION_MEMBER = "SETTING_ORGANIZATION_MEMBER";
|
||||||
|
public static final String SETTING_ORGANIZATION_SERVICE = "SETTING_ORGANIZATION_SERVICE";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class OperationLogService {
|
||||||
log.setCreateUser("admin");
|
log.setCreateUser("admin");
|
||||||
}
|
}
|
||||||
// 限制长度
|
// 限制长度
|
||||||
log.setBatchId(UUID.randomUUID().toString());
|
|
||||||
saveBlob(operationLogMapper, operationLogBlobMapper, log);
|
saveBlob(operationLogMapper, operationLogBlobMapper, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,9 +67,9 @@ public class OperationLogService {
|
||||||
OperationLogBlobMapper logBlobMapper = sqlSession.getMapper(OperationLogBlobMapper.class);
|
OperationLogBlobMapper logBlobMapper = sqlSession.getMapper(OperationLogBlobMapper.class);
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(logs)) {
|
if (CollectionUtils.isNotEmpty(logs)) {
|
||||||
String batchId = UUID.randomUUID().toString();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
logs.forEach(item -> {
|
logs.forEach(item -> {
|
||||||
item.setBatchId(batchId);
|
item.setCreateTime(currentTimeMillis);
|
||||||
if (StringUtils.isBlank(item.getId())) {
|
if (StringUtils.isBlank(item.getId())) {
|
||||||
item.setId(UUID.randomUUID().toString());
|
item.setId(UUID.randomUUID().toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
<select id="list" parameterType="io.metersphere.sdk.log.vo.OperationLogRequest" resultType="io.metersphere.sdk.log.vo.OperationLogResponse">
|
<select id="list" parameterType="io.metersphere.sdk.log.vo.OperationLogRequest" resultType="io.metersphere.sdk.log.vo.OperationLogResponse">
|
||||||
SELECT
|
SELECT
|
||||||
t.id,
|
|
||||||
t.project_id,
|
t.project_id,
|
||||||
t.organization_id,
|
t.organization_id,
|
||||||
t.create_time,
|
t.create_time,
|
||||||
|
@ -21,10 +20,10 @@
|
||||||
<if test="request.startTime != null and request.endTime != null">
|
<if test="request.startTime != null and request.endTime != null">
|
||||||
AND t.create_time BETWEEN #{request.startTime} AND #{request.endTime}
|
AND t.create_time BETWEEN #{request.startTime} AND #{request.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.level != null and request.level != 'system'">
|
<if test="request.level != null and request.level != 'SYSTEM'">
|
||||||
AND t.project_id <![CDATA[<>]]> 'SYSTEM'
|
AND t.project_id <![CDATA[<>]]> 'SYSTEM'
|
||||||
</if>
|
</if>
|
||||||
<if test="request.level != null and request.level == 'project'">
|
<if test="request.level != null and request.level == 'PROJECT'">
|
||||||
AND t.project_id <![CDATA[<>]]> 'ORGANIZATION'
|
AND t.project_id <![CDATA[<>]]> 'ORGANIZATION'
|
||||||
</if>
|
</if>
|
||||||
<if test="request.projectIds != null and request.projectIds.size > 0 ">
|
<if test="request.projectIds != null and request.projectIds.size > 0 ">
|
||||||
|
@ -49,7 +48,7 @@
|
||||||
AND t.content like CONCAT('%', #{request.content},'%')
|
AND t.content like CONCAT('%', #{request.content},'%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY t.oper_time DESC
|
ORDER BY t.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class SystemParameterService {
|
||||||
"system-parameter",
|
"system-parameter",
|
||||||
null,
|
null,
|
||||||
OperationLogType.ADD.name(),
|
OperationLogType.ADD.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER,
|
||||||
"基础设置");
|
"基础设置");
|
||||||
|
|
||||||
dto.setPath("/system/parameter/save/base-info");
|
dto.setPath("/system/parameter/save/base-info");
|
||||||
|
@ -245,7 +245,7 @@ public class SystemParameterService {
|
||||||
"system-parameter",
|
"system-parameter",
|
||||||
null,
|
null,
|
||||||
OperationLogType.ADD.name(),
|
OperationLogType.ADD.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER,
|
||||||
"基础设置");
|
"基础设置");
|
||||||
|
|
||||||
dto.setPath("/system/parameter/edit/email-info");
|
dto.setPath("/system/parameter/edit/email-info");
|
||||||
|
|
|
@ -197,7 +197,8 @@ permission.service_integration.name=Service Integration
|
||||||
permission.system_auth=Authorization Management
|
permission.system_auth=Authorization Management
|
||||||
permission.system_organization_project_member.add=Add member
|
permission.system_organization_project_member.add=Add member
|
||||||
permission.system_organization_project_member.delete=Delete member
|
permission.system_organization_project_member.delete=Delete member
|
||||||
|
permission.system_operation_log.name=Operation log
|
||||||
|
permission.organization_operation_log.name=Operation log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,8 @@ permission.service_integration.name=服务集成
|
||||||
permission.system_auth=授权管理
|
permission.system_auth=授权管理
|
||||||
permission.system_organization_project_member.add=添加成员
|
permission.system_organization_project_member.add=添加成员
|
||||||
permission.system_organization_project_member.delete=删除成员
|
permission.system_organization_project_member.delete=删除成员
|
||||||
|
permission.system_operation_log.name=日志
|
||||||
|
permission.organization_operation_log.name=日志
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,4 +196,6 @@ permission.service_integration.name=服務集成
|
||||||
permission.system_auth=授權管理
|
permission.system_auth=授權管理
|
||||||
permission.system_organization_project_member.add=添加成员
|
permission.system_organization_project_member.add=添加成员
|
||||||
permission.system_organization_project_member.delete=删除成员
|
permission.system_organization_project_member.delete=删除成员
|
||||||
|
permission.system_operation_log.name=日志
|
||||||
|
permission.organization_operation_log.name=日志
|
||||||
|
|
||||||
|
|
|
@ -4,21 +4,21 @@ package io.metersphere.system.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.sdk.constants.PermissionConstants;
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
|
||||||
import io.metersphere.sdk.log.service.OperationLogService;
|
import io.metersphere.sdk.log.service.OperationLogService;
|
||||||
import io.metersphere.sdk.log.vo.OperationLogRequest;
|
import io.metersphere.sdk.log.vo.OperationLogRequest;
|
||||||
import io.metersphere.sdk.log.vo.OperationLogResponse;
|
import io.metersphere.sdk.log.vo.OperationLogResponse;
|
||||||
import io.metersphere.sdk.util.PageUtils;
|
import io.metersphere.sdk.util.PageUtils;
|
||||||
import io.metersphere.sdk.util.Pager;
|
import io.metersphere.sdk.util.Pager;
|
||||||
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
|
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
|
||||||
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
||||||
import io.metersphere.system.service.OrganizationService;
|
import io.metersphere.system.service.OrganizationService;
|
||||||
import io.metersphere.system.service.SystemProjectService;
|
import io.metersphere.system.service.SystemProjectService;
|
||||||
|
import io.metersphere.system.service.UserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -39,10 +39,13 @@ public class OperationLogController {
|
||||||
@Resource
|
@Resource
|
||||||
private OperationLogService operationLogService;
|
private OperationLogService operationLogService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/get/options")
|
@GetMapping("/get/options")
|
||||||
@Operation(summary = "获取组织/项目级联下拉框选项")
|
@Operation(summary = "获取组织/项目级联下拉框选项")
|
||||||
@RequiresPermissions(value = {PermissionConstants.SYSTEM_OPERATING_LOG_READ, PermissionConstants.ORGANIZATION_OPERATING_LOG_READ}, logical = Logical.OR)
|
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ)
|
||||||
public OrganizationProjectOptionsResponse getOptions() {
|
public OrganizationProjectOptionsResponse getOptions() {
|
||||||
|
|
||||||
//获取全部组织
|
//获取全部组织
|
||||||
|
@ -59,11 +62,20 @@ public class OperationLogController {
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Operation(summary = "操作日志列表查询")
|
@Operation(summary = "组织操作日志列表查询")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ)
|
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ)
|
||||||
public Pager<List<OperationLogResponse>> list(@Validated @RequestBody OperationLogRequest request) {
|
public Pager<List<OperationLogResponse>> list(@Validated @RequestBody OperationLogRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
|
||||||
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
|
||||||
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
return PageUtils.setPageInfo(page, operationLogService.list(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/user/list")
|
||||||
|
@Operation(summary = "系统日志页面,获取用户列表")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_OPERATING_LOG_READ)
|
||||||
|
public List<User> getUserList() {
|
||||||
|
List<User> userList = userService.getUserList();
|
||||||
|
return userList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import io.metersphere.sdk.util.PageUtils;
|
||||||
import io.metersphere.sdk.util.Pager;
|
import io.metersphere.sdk.util.Pager;
|
||||||
import io.metersphere.sdk.util.SessionUtils;
|
import io.metersphere.sdk.util.SessionUtils;
|
||||||
import io.metersphere.system.domain.Organization;
|
import io.metersphere.system.domain.Organization;
|
||||||
import io.metersphere.system.domain.User;
|
|
||||||
import io.metersphere.system.dto.UserBatchCreateDTO;
|
import io.metersphere.system.dto.UserBatchCreateDTO;
|
||||||
import io.metersphere.system.dto.UserExtend;
|
import io.metersphere.system.dto.UserExtend;
|
||||||
import io.metersphere.system.request.OrganizationMemberBatchRequest;
|
import io.metersphere.system.request.OrganizationMemberBatchRequest;
|
||||||
|
@ -108,13 +107,6 @@ public class UserController {
|
||||||
return userService.deleteUser(request, SessionUtils.getUserId());
|
return userService.deleteUser(request, SessionUtils.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@Operation(summary = "系统/组织日志页面,获取用户列表")
|
|
||||||
@RequiresPermissions(value = {PermissionConstants.SYSTEM_OPERATING_LOG_READ, PermissionConstants.ORGANIZATION_OPERATING_LOG_READ}, logical = Logical.OR)
|
|
||||||
public List<User> getUserList() {
|
|
||||||
return userService.getUserList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/reset/password")
|
@PostMapping("/reset/password")
|
||||||
@Operation(summary = "重置用户密码")
|
@Operation(summary = "重置用户密码")
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_USER_READ_UPDATE)
|
@RequiresPermissions(PermissionConstants.SYSTEM_USER_READ_UPDATE)
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class AuthSourceLogService {
|
||||||
request.getId(),
|
request.getId(),
|
||||||
null,
|
null,
|
||||||
OperationLogType.ADD.name(),
|
OperationLogType.ADD.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER_AUTH_CONFIG,
|
||||||
request.getName());
|
request.getName());
|
||||||
|
|
||||||
dto.setModifiedValue(JSON.toJSONBytes(request));
|
dto.setModifiedValue(JSON.toJSONBytes(request));
|
||||||
|
@ -55,7 +55,7 @@ public class AuthSourceLogService {
|
||||||
request.getId(),
|
request.getId(),
|
||||||
null,
|
null,
|
||||||
OperationLogType.UPDATE.name(),
|
OperationLogType.UPDATE.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER_AUTH_CONFIG,
|
||||||
request.getName());
|
request.getName());
|
||||||
|
|
||||||
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
||||||
|
@ -73,7 +73,7 @@ public class AuthSourceLogService {
|
||||||
id,
|
id,
|
||||||
null,
|
null,
|
||||||
OperationLogType.UPDATE.name(),
|
OperationLogType.UPDATE.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER_AUTH_CONFIG,
|
||||||
authSource.getName());
|
authSource.getName());
|
||||||
|
|
||||||
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
||||||
|
@ -98,7 +98,7 @@ public class AuthSourceLogService {
|
||||||
authSource.getId(),
|
authSource.getId(),
|
||||||
null,
|
null,
|
||||||
OperationLogType.DELETE.name(),
|
OperationLogType.DELETE.name(),
|
||||||
OperationLogModule.SYSTEM_PARAMETER_SETTING,
|
OperationLogModule.SETTING_SYSTEM_PARAMETER_AUTH_CONFIG,
|
||||||
authSource.getName());
|
authSource.getName());
|
||||||
|
|
||||||
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
dto.setOriginalValue(JSON.toJSONBytes(authSource));
|
||||||
|
|
|
@ -136,6 +136,15 @@
|
||||||
"id": "SYSTEM_AUTH:READ+UPDATE"
|
"id": "SYSTEM_AUTH:READ+UPDATE"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SYSTEM_OPERATION_LOG",
|
||||||
|
"name": "permission.system_operation_log.name",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"id": "SYSTEM_OPERATING_LOG:READ"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -227,6 +236,15 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ORGANIZATION_OPERATION_LOG",
|
||||||
|
"name": "permission.organization_operation_log.name",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"id": "ORGANIZATION_OPERATING_LOG:READ"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class OperationLogControllerTests extends BaseTest {
|
||||||
public static final String OPTIONS_LIST = "/operation/log/get/options";
|
public static final String OPTIONS_LIST = "/operation/log/get/options";
|
||||||
|
|
||||||
|
|
||||||
public static final String USER_LIST = "/system/user/list";
|
public static final String USER_LIST = "/operation/log/user/list";
|
||||||
|
|
||||||
public static final String SYSTEM = "system";
|
public static final String SYSTEM = "SYSTEM";
|
||||||
public static final String ORGANIZATION = "organization";
|
public static final String ORGANIZATION = "ORGANIZATION";
|
||||||
public static final String PROJECT = "project";
|
public static final String PROJECT = "PROJECT";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class SystemParameterControllerTests extends BaseTest {
|
||||||
hashMap.put("smtp.password", "test");
|
hashMap.put("smtp.password", "test");
|
||||||
hashMap.put("smtp.from", "aaa@fit2cloud.com");
|
hashMap.put("smtp.from", "aaa@fit2cloud.com");
|
||||||
hashMap.put("smtp.recipient", "aaa@fit2cloud.com");
|
hashMap.put("smtp.recipient", "aaa@fit2cloud.com");
|
||||||
hashMap.put("smtp.ssl", "ture");
|
hashMap.put("smtp.ssl", "true");
|
||||||
hashMap.put("smtp.tsl", "false");
|
hashMap.put("smtp.tsl", "false");
|
||||||
this.requestPost(EMAIL_INFO_TEST_CONNECT_URL, hashMap, ERROR_REQUEST_MATCHER);
|
this.requestPost(EMAIL_INFO_TEST_CONNECT_URL, hashMap, ERROR_REQUEST_MATCHER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue