mirror of https://gitee.com/topiam/eiam
修复操作日志查询问题
parent
252042f490
commit
25b5421200
|
@ -5,6 +5,7 @@ target/
|
||||||
!**/src/test/**
|
!**/src/test/**
|
||||||
!**/target/generated-sources/**
|
!**/target/generated-sources/**
|
||||||
logs/**
|
logs/**
|
||||||
|
*.log
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
.classpath
|
.classpath
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import cn.topiam.employee.support.security.util.SecurityUtils;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
@ -151,7 +152,9 @@ public interface AuditDataConverter {
|
||||||
QAuditEntity auditEntity = QAuditEntity.auditEntity;
|
QAuditEntity auditEntity = QAuditEntity.auditEntity;
|
||||||
Predicate predicate = ExpressionUtils.and(auditEntity.isNotNull(),
|
Predicate predicate = ExpressionUtils.and(auditEntity.isNotNull(),
|
||||||
auditEntity.deleted.eq(Boolean.FALSE));
|
auditEntity.deleted.eq(Boolean.FALSE));
|
||||||
//用户名存在,查询用户ID
|
UserType userType = SecurityUtils.getCurrentUser().getUserType();
|
||||||
|
// 登录角色 管理员
|
||||||
|
if (UserType.ADMIN.equals(userType)) {
|
||||||
if (StringUtils.hasText(query.getUsername())) {
|
if (StringUtils.hasText(query.getUsername())) {
|
||||||
String actorId = "";
|
String actorId = "";
|
||||||
if (UserType.USER.getType().equals(query.getUserType())) {
|
if (UserType.USER.getType().equals(query.getUserType())) {
|
||||||
|
@ -161,8 +164,6 @@ public interface AuditDataConverter {
|
||||||
if (!Objects.isNull(user)) {
|
if (!Objects.isNull(user)) {
|
||||||
actorId = user.getId().toString();
|
actorId = user.getId().toString();
|
||||||
}
|
}
|
||||||
// 用户类型
|
|
||||||
predicate = ExpressionUtils.and(predicate, auditEntity.actorType.eq(UserType.USER));
|
|
||||||
}
|
}
|
||||||
if (UserType.ADMIN.getType().equals(query.getUserType())) {
|
if (UserType.ADMIN.getType().equals(query.getUserType())) {
|
||||||
AdministratorRepository administratorRepository = ApplicationContextHelp
|
AdministratorRepository administratorRepository = ApplicationContextHelp
|
||||||
|
@ -172,11 +173,23 @@ public interface AuditDataConverter {
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
actorId = optional.get().getId().toString();
|
actorId = optional.get().getId().toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
predicate = ExpressionUtils.and(predicate, auditEntity.actorId.eq(actorId));
|
||||||
|
}
|
||||||
// 用户类型
|
// 用户类型
|
||||||
|
if (UserType.USER.getType().equals(query.getUserType())) {
|
||||||
|
predicate = ExpressionUtils.and(predicate, auditEntity.actorType.eq(UserType.USER));
|
||||||
|
}
|
||||||
|
if (UserType.ADMIN.getType().equals(query.getUserType())) {
|
||||||
predicate = ExpressionUtils.and(predicate,
|
predicate = ExpressionUtils.and(predicate,
|
||||||
auditEntity.actorType.eq(UserType.ADMIN));
|
auditEntity.actorType.eq(UserType.ADMIN));
|
||||||
}
|
}
|
||||||
predicate = ExpressionUtils.and(predicate, auditEntity.actorId.eq(actorId));
|
}
|
||||||
|
// 登录角色 管理员
|
||||||
|
if (UserType.USER.equals(userType)) {
|
||||||
|
predicate = ExpressionUtils.and(predicate, auditEntity.actorId.eq(SecurityUtils.getCurrentUser().getId()));
|
||||||
|
// 用户类型
|
||||||
|
predicate = ExpressionUtils.and(predicate, auditEntity.actorType.eq(UserType.USER));
|
||||||
}
|
}
|
||||||
// 事件类型
|
// 事件类型
|
||||||
if (!CollectionUtils.isEmpty(query.getEventType())) {
|
if (!CollectionUtils.isEmpty(query.getEventType())) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ export default () => {
|
||||||
title: intl.formatMessage({ id: 'pages.audit.columns.username' }),
|
title: intl.formatMessage({ id: 'pages.audit.columns.username' }),
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
|
hideInSearch: true,
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
placeholder: intl.formatMessage({ id: 'pages.audit.columns.username.placeholder' }),
|
placeholder: intl.formatMessage({ id: 'pages.audit.columns.username.placeholder' }),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue