Commit 2aaca61da5aaecac72e0c930f56d9c58b563c573

Authored by 云中非
1 parent 63acf7d8

fix: 日志管理过滤字段完善

@@ -7,8 +7,8 @@ import lombok.RequiredArgsConstructor; @@ -7,8 +7,8 @@ import lombok.RequiredArgsConstructor;
7 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
8 import org.springframework.security.access.prepost.PreAuthorize; 8 import org.springframework.security.access.prepost.PreAuthorize;
9 import org.springframework.web.bind.annotation.*; 9 import org.springframework.web.bind.annotation.*;
  10 +import org.thingsboard.server.common.data.EntityType;
10 import org.thingsboard.server.common.data.audit.ActionType; 11 import org.thingsboard.server.common.data.audit.ActionType;
11 -import org.thingsboard.server.common.data.audit.AuditLog;  
12 import org.thingsboard.server.common.data.exception.ThingsboardException; 12 import org.thingsboard.server.common.data.exception.ThingsboardException;
13 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO; 13 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO;
14 import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; 14 import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum;
@@ -36,72 +36,76 @@ public class YtSyslogController extends BaseController { @@ -36,72 +36,76 @@ public class YtSyslogController extends BaseController {
36 return logService.detail(entityId); 36 return logService.detail(entityId);
37 } 37 }
38 38
39 - @GetMapping(value="exception",params = {PAGE_SIZE, PAGE}) 39 + @GetMapping(value = "exception", params = {PAGE_SIZE, PAGE})
40 @ApiOperation("异常日志列表") 40 @ApiOperation("异常日志列表")
41 @PreAuthorize("@check.checkPermissions({},{})") 41 @PreAuthorize("@check.checkPermissions({},{})")
42 public YtPageData<SysLogDTO> pageExceptions( 42 public YtPageData<SysLogDTO> pageExceptions(
43 @RequestParam(PAGE_SIZE) int pageSize, 43 @RequestParam(PAGE_SIZE) int pageSize,
44 @RequestParam(PAGE) int page, 44 @RequestParam(PAGE) int page,
  45 + @RequestParam(value = "startTime", required = false) Long startTime,
  46 + @RequestParam(value = "endTime", required = false) Long endTime,
45 @RequestParam(value = "actionType", required = false) ActionType actionType, 47 @RequestParam(value = "actionType", required = false) ActionType actionType,
46 @RequestParam(value = ORDER_FILED, required = false) String orderBy, 48 @RequestParam(value = ORDER_FILED, required = false) String orderBy,
47 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) 49 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType)
48 throws ThingsboardException { 50 throws ThingsboardException {
49 51
50 52
51 - if(StringUtils.isEmpty(orderBy)){ 53 + if (StringUtils.isEmpty(orderBy)) {
52 orderBy = ModelConstants.CREATED_TIME_PROPERTY; 54 orderBy = ModelConstants.CREATED_TIME_PROPERTY;
53 } 55 }
54 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType); 56 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType);
55 - return logService.exceptionPage(pageInfrom, null,null  
56 - ,getCurrentUser().isPtTenantAdmin()?getCurrentUser().getCurrentTenantId():null  
57 - ,getCurrentUser().isCustomerUser()?getCurrentUser().getCurrentUserId():null  
58 - ,actionType); 57 + return logService.exceptionPage(pageInfrom, startTime, endTime
  58 + , getCurrentUser().isPtTenantAdmin() ? getCurrentUser().getCurrentTenantId() : null
  59 + , getCurrentUser().isCustomerUser() ? getCurrentUser().getCurrentUserId() : null
  60 + , actionType);
59 } 61 }
60 62
61 - @GetMapping(value="operate",params = {PAGE_SIZE, PAGE}) 63 + @GetMapping(value = "operate", params = {PAGE_SIZE, PAGE})
62 @ApiOperation("操作日志列表") 64 @ApiOperation("操作日志列表")
63 @PreAuthorize("@check.checkPermissions({},{})") 65 @PreAuthorize("@check.checkPermissions({},{})")
64 public YtPageData<SysLogDTO> pageOperate( 66 public YtPageData<SysLogDTO> pageOperate(
65 @RequestParam(PAGE_SIZE) int pageSize, 67 @RequestParam(PAGE_SIZE) int pageSize,
66 @RequestParam(PAGE) int page, 68 @RequestParam(PAGE) int page,
  69 + @RequestParam(value = "startTime", required = false) Long startTime,
  70 + @RequestParam(value = "endTime", required = false) Long endTime,
  71 + @RequestParam(value = "entityType", required = false) EntityType entityType,
67 @RequestParam(value = "actionType", required = false) ActionType actionType, 72 @RequestParam(value = "actionType", required = false) ActionType actionType,
68 @RequestParam(value = ORDER_FILED, required = false) String orderBy, 73 @RequestParam(value = ORDER_FILED, required = false) String orderBy,
69 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) 74 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType)
70 throws ThingsboardException { 75 throws ThingsboardException {
71 - if(StringUtils.isEmpty(orderBy)){ 76 + if (StringUtils.isEmpty(orderBy)) {
72 orderBy = ModelConstants.CREATED_TIME_PROPERTY; 77 orderBy = ModelConstants.CREATED_TIME_PROPERTY;
73 } 78 }
74 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType); 79 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType);
75 - return logService.operatePage(pageInfrom, null,null  
76 - ,getCurrentUser().isPtTenantAdmin()?getCurrentUser().getCurrentTenantId():null  
77 - ,getCurrentUser().isCustomerUser()?getCurrentUser().getCurrentUserId():null  
78 - ,actionType); 80 + return logService.operatePage(pageInfrom, startTime, endTime
  81 + , getCurrentUser().isPtTenantAdmin() ? getCurrentUser().getCurrentTenantId() : null
  82 + , getCurrentUser().isCustomerUser() ? getCurrentUser().getCurrentUserId() : null
  83 + , entityType, actionType);
79 } 84 }
80 85
81 - @GetMapping(value="user",params = {PAGE_SIZE, PAGE}) 86 + @GetMapping(value = "user", params = {PAGE_SIZE, PAGE})
82 @ApiOperation("登录登出列表") 87 @ApiOperation("登录登出列表")
83 @PreAuthorize("@check.checkPermissions({},{})") 88 @PreAuthorize("@check.checkPermissions({},{})")
84 public YtPageData<SysLogDTO> pageLogin( 89 public YtPageData<SysLogDTO> pageLogin(
85 @RequestParam(PAGE_SIZE) int pageSize, 90 @RequestParam(PAGE_SIZE) int pageSize,
86 @RequestParam(PAGE) int page, 91 @RequestParam(PAGE) int page,
  92 + @RequestParam(value = "startTime", required = false) Long startTime,
  93 + @RequestParam(value = "endTime", required = false) Long endTime,
87 @RequestParam(value = "actionType", required = false) ActionType actionType, 94 @RequestParam(value = "actionType", required = false) ActionType actionType,
88 @RequestParam(value = ORDER_FILED, required = false) String orderBy, 95 @RequestParam(value = ORDER_FILED, required = false) String orderBy,
89 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) 96 @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType)
90 throws ThingsboardException { 97 throws ThingsboardException {
91 98
92 99
93 - if(StringUtils.isEmpty(orderBy)){ 100 + if (StringUtils.isEmpty(orderBy)) {
94 orderBy = ModelConstants.CREATED_TIME_PROPERTY; 101 orderBy = ModelConstants.CREATED_TIME_PROPERTY;
95 } 102 }
96 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType); 103 IPage<SysLogEntity> pageInfrom = logService.getPage(page, pageSize, orderBy, orderType);
97 - return logService.loginPage(pageInfrom, null,null  
98 - ,getCurrentUser().isPtTenantAdmin()?getCurrentUser().getCurrentTenantId():null  
99 - ,getCurrentUser().isCustomerUser()?getCurrentUser().getCurrentUserId():null  
100 - ,actionType); 104 + return logService.loginPage(pageInfrom, startTime, endTime
  105 + , getCurrentUser().isPtTenantAdmin() ? getCurrentUser().getCurrentTenantId() : null
  106 + , getCurrentUser().isCustomerUser() ? getCurrentUser().getCurrentUserId() : null
  107 + , actionType);
101 } 108 }
102 109
103 110
104 -  
105 -  
106 -  
107 } 111 }
1 /** 1 /**
2 * Copyright © 2016-2021 The Thingsboard Authors 2 * Copyright © 2016-2021 The Thingsboard Authors
3 - * 3 + * <p>
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - * 7 + * <p>
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + * <p>
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, 11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@ package org.thingsboard.server.common.data.yunteng.dto; @@ -17,6 +17,7 @@ package org.thingsboard.server.common.data.yunteng.dto;
17 17
18 18
19 import com.fasterxml.jackson.databind.JsonNode; 19 import com.fasterxml.jackson.databind.JsonNode;
  20 +import io.swagger.annotations.ApiModelProperty;
20 import lombok.Data; 21 import lombok.Data;
21 import lombok.EqualsAndHashCode; 22 import lombok.EqualsAndHashCode;
22 import org.thingsboard.server.common.data.EntityType; 23 import org.thingsboard.server.common.data.EntityType;
@@ -30,31 +31,38 @@ import java.util.UUID; @@ -30,31 +31,38 @@ import java.util.UUID;
30 @Data 31 @Data
31 public class SysLogDTO extends BaseDTO { 32 public class SysLogDTO extends BaseDTO {
32 33
33 - 34 + @ApiModelProperty(value = "操作时间")
34 private long createdTime; 35 private long createdTime;
35 36
36 - private EntityType entityType;  
37 37
38 private UUID tenantId; 38 private UUID tenantId;
  39 + @ApiModelProperty(value = "租户名称")
39 private String tenantName; 40 private String tenantName;
40 41
41 private UUID customerId; 42 private UUID customerId;
  43 + @ApiModelProperty(value = "客户名称")
42 private String customerName; 44 private String customerName;
43 45
  46 + @ApiModelProperty(value = "资源类型")
  47 + private EntityType entityType;
44 private UUID entityId; 48 private UUID entityId;
  49 + @ApiModelProperty(value = "资源名称")
45 private String entityName; 50 private String entityName;
46 51
47 private UUID userId; 52 private UUID userId;
  53 + @ApiModelProperty(value = "操作人员")
48 private String userName; 54 private String userName;
49 55
50 - 56 + @ApiModelProperty(value = "操作类型")
51 private ActionType actionType; 57 private ActionType actionType;
52 58
  59 + @ApiModelProperty(value = "操作数据")
53 private JsonNode actionData; 60 private JsonNode actionData;
54 61
  62 + @ApiModelProperty(value = "操作状态")
55 private ActionStatus actionStatus; 63 private ActionStatus actionStatus;
56 64
57 - 65 + @ApiModelProperty(value = "失败信息")
58 private String actionFailureDetails; 66 private String actionFailureDetails;
59 67
60 68
1 package org.thingsboard.server.dao.yunteng.impl; 1 package org.thingsboard.server.dao.yunteng.impl;
2 2
3 -import com.baomidou.mybatisplus.core.conditions.Wrapper;  
4 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;  
5 -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;  
6 import com.baomidou.mybatisplus.core.metadata.IPage; 3 import com.baomidou.mybatisplus.core.metadata.IPage;
7 import lombok.RequiredArgsConstructor; 4 import lombok.RequiredArgsConstructor;
8 import lombok.extern.slf4j.Slf4j; 5 import lombok.extern.slf4j.Slf4j;
9 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
10 import org.thingsboard.server.common.data.EntityType; 7 import org.thingsboard.server.common.data.EntityType;
11 -import org.thingsboard.server.common.data.StringUtils;  
12 import org.thingsboard.server.common.data.audit.ActionType; 8 import org.thingsboard.server.common.data.audit.ActionType;
13 -import org.thingsboard.server.common.data.audit.AuditLog;  
14 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO; 9 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO;
15 -import org.thingsboard.server.common.data.yunteng.dto.YtOpinionDTO;  
16 import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; 10 import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData;
17 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity; 11 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity;
18 -import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity;  
19 import org.thingsboard.server.dao.yunteng.mapper.YtSysLogMapper; 12 import org.thingsboard.server.dao.yunteng.mapper.YtSysLogMapper;
20 import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; 13 import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
21 import org.thingsboard.server.dao.yunteng.service.YtSysLogService; 14 import org.thingsboard.server.dao.yunteng.service.YtSysLogService;
22 15
23 import java.util.ArrayList; 16 import java.util.ArrayList;
24 import java.util.List; 17 import java.util.List;
25 -import java.util.UUID;  
26 18
27 @Slf4j 19 @Slf4j
28 @Service 20 @Service
@@ -39,26 +31,26 @@ public class YtSysLogServiceImpl extends AbstractBaseService<YtSysLogMapper, Sys @@ -39,26 +31,26 @@ public class YtSysLogServiceImpl extends AbstractBaseService<YtSysLogMapper, Sys
39 @Override 31 @Override
40 public YtPageData<SysLogDTO> exceptionPage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType) { 32 public YtPageData<SysLogDTO> exceptionPage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType) {
41 IPage<SysLogDTO> page = 33 IPage<SysLogDTO> page =
42 - baseMapper.getPageDatasMatched(pageInfrom, tenantId,customerId,startTime,endTime,EntityType.RUNNING_EXCEPTION,actionType); 34 + baseMapper.getPageDatasMatched(pageInfrom, tenantId, customerId, startTime, endTime, EntityType.RUNNING_EXCEPTION, actionType);
43 return getPageData(page, SysLogDTO.class); 35 return getPageData(page, SysLogDTO.class);
44 } 36 }
45 37
46 38
47 @Override 39 @Override
48 - public YtPageData<SysLogDTO> operatePage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType) { 40 + public YtPageData<SysLogDTO> operatePage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, EntityType entityType, ActionType actionType) {
49 List<EntityType> entityTypes = new ArrayList<>(); 41 List<EntityType> entityTypes = new ArrayList<>();
50 entityTypes.add(EntityType.RUNNING_EXCEPTION); 42 entityTypes.add(EntityType.RUNNING_EXCEPTION);
51 entityTypes.add(EntityType.USER); 43 entityTypes.add(EntityType.USER);
52 44
53 IPage<SysLogDTO> page = 45 IPage<SysLogDTO> page =
54 - baseMapper.getPageDatasNot(pageInfrom, tenantId,customerId,startTime,endTime,actionType, entityTypes); 46 + baseMapper.getPageDatasNot(pageInfrom, tenantId, customerId, startTime, endTime, entityType, actionType, entityTypes);
55 return getPageData(page, SysLogDTO.class); 47 return getPageData(page, SysLogDTO.class);
56 } 48 }
57 49
58 @Override 50 @Override
59 public YtPageData<SysLogDTO> loginPage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType) { 51 public YtPageData<SysLogDTO> loginPage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType) {
60 IPage<SysLogDTO> page = 52 IPage<SysLogDTO> page =
61 - baseMapper.getPageDatasMatched(pageInfrom, tenantId,customerId,startTime,endTime,EntityType.USER,actionType); 53 + baseMapper.getPageDatasMatched(pageInfrom, tenantId, customerId, startTime, endTime, EntityType.USER, actionType);
62 return getPageData(page, SysLogDTO.class); 54 return getPageData(page, SysLogDTO.class);
63 } 55 }
64 } 56 }
@@ -6,12 +6,8 @@ import org.apache.ibatis.annotations.Mapper; @@ -6,12 +6,8 @@ import org.apache.ibatis.annotations.Mapper;
6 import org.apache.ibatis.annotations.Param; 6 import org.apache.ibatis.annotations.Param;
7 import org.thingsboard.server.common.data.EntityType; 7 import org.thingsboard.server.common.data.EntityType;
8 import org.thingsboard.server.common.data.audit.ActionType; 8 import org.thingsboard.server.common.data.audit.ActionType;
9 -import org.thingsboard.server.common.data.audit.AuditLog;  
10 -import org.thingsboard.server.common.data.rpc.RpcStatus;  
11 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO; 9 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO;
12 -import org.thingsboard.server.common.data.yunteng.dto.YtRpcRecordDTO;  
13 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity; 10 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity;
14 -import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity;  
15 11
16 import java.util.List; 12 import java.util.List;
17 13
@@ -21,12 +17,11 @@ import java.util.List; @@ -21,12 +17,11 @@ import java.util.List;
21 @Mapper 17 @Mapper
22 public interface YtSysLogMapper extends BaseMapper<SysLogEntity> { 18 public interface YtSysLogMapper extends BaseMapper<SysLogEntity> {
23 IPage<SysLogDTO> getPageDatasMatched(IPage<?> page, @Param("tenantId") String tenantId, @Param("customerId") String customerId 19 IPage<SysLogDTO> getPageDatasMatched(IPage<?> page, @Param("tenantId") String tenantId, @Param("customerId") String customerId
24 - , @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("entityType") EntityType entityType, @Param("actionType") ActionType actionType);  
25 - IPage<SysLogDTO> getPageDatasNot(IPage<?> page, @Param("tenantId") String tenantId, @Param("customerId") String customerId  
26 - , @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("actionType") ActionType actionType, @Param("entityType") List<EntityType> entityType);  
27 - 20 + , @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("entityType") EntityType entityType, @Param("actionType") ActionType actionType);
28 21
  22 + IPage<SysLogDTO> getPageDatasNot(IPage<?> page, @Param("tenantId") String tenantId, @Param("customerId") String customerId
  23 + , @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("entityFilter") EntityType entityFilter, @Param("actionType") ActionType actionType, @Param("entityType") List<EntityType> entityType);
29 24
30 25
31 - SysLogDTO detailById( @Param("entityId") String entityId); 26 + SysLogDTO detailById(@Param("entityId") String entityId);
32 } 27 }
1 package org.thingsboard.server.dao.yunteng.service; 1 package org.thingsboard.server.dao.yunteng.service;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage; 3 import com.baomidou.mybatisplus.core.metadata.IPage;
  4 +import org.thingsboard.server.common.data.EntityType;
4 import org.thingsboard.server.common.data.audit.ActionType; 5 import org.thingsboard.server.common.data.audit.ActionType;
5 -import org.thingsboard.server.common.data.audit.AuditLog;  
6 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO; 6 import org.thingsboard.server.common.data.yunteng.dto.SysLogDTO;
7 import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; 7 import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData;
8 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity; 8 import org.thingsboard.server.dao.yunteng.entities.SysLogEntity;
9 -import org.thingsboard.server.dao.yunteng.entities.YtOpinionEntity;  
10 9
11 public interface YtSysLogService extends BaseService<SysLogEntity> { 10 public interface YtSysLogService extends BaseService<SysLogEntity> {
12 11
@@ -43,7 +42,7 @@ public interface YtSysLogService extends BaseService<SysLogEntity> { @@ -43,7 +42,7 @@ public interface YtSysLogService extends BaseService<SysLogEntity> {
43 * @param actionType 日志类型 42 * @param actionType 日志类型
44 * @return 43 * @return
45 */ 44 */
46 - YtPageData<SysLogDTO> operatePage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, ActionType actionType); 45 + YtPageData<SysLogDTO> operatePage(IPage<SysLogEntity> pageInfrom, Long startTime, Long endTime, String tenantId, String customerId, EntityType entityType, ActionType actionType);
47 46
48 /** 47 /**
49 * 登录日志列表 48 * 登录日志列表
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 25
26 <sql id="baseColumn"> 26 <sql id="baseColumn">
27 base.id, base.tenant_id, base.created_time, base.customer_id, base.entity_type, base.entity_id, base.entity_name, base.user_id, base.user_name, base.action_type, base.action_status 27 base.id, base.tenant_id, base.created_time, base.customer_id, base.entity_type, base.entity_id, base.entity_name, base.user_id, base.user_name, base.action_type, base.action_status
28 - ,ten.title tenant_name 28 + ,ten.title tenant_name,cus.title customer_name
29 </sql> 29 </sql>
30 <sql id="detailColumn"> 30 <sql id="detailColumn">
31 <include refid="baseColumn"></include> 31 <include refid="baseColumn"></include>
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 SELECT <include refid="baseColumn"/> 36 SELECT <include refid="baseColumn"/>
37 FROM audit_log base 37 FROM audit_log base
38 LEFT JOIN tenant ten ON base.tenant_id = ten.id 38 LEFT JOIN tenant ten ON base.tenant_id = ten.id
  39 + LEFT JOIN customer cus ON base.customer_id = cus.id
39 <where> 40 <where>
40 base.entity_type = #{entityType} 41 base.entity_type = #{entityType}
41 <if test="tenantId !=null and tenantId !=''"> 42 <if test="tenantId !=null and tenantId !=''">
@@ -61,12 +62,16 @@ @@ -61,12 +62,16 @@
61 SELECT <include refid="baseColumn"/> 62 SELECT <include refid="baseColumn"/>
62 FROM audit_log base 63 FROM audit_log base
63 LEFT JOIN tenant ten ON base.tenant_id = ten.id 64 LEFT JOIN tenant ten ON base.tenant_id = ten.id
  65 + LEFT JOIN customer cus ON base.customer_id = cus.id
64 <where> 66 <where>
65 base.entity_type 67 base.entity_type
66 NOT IN 68 NOT IN
67 <foreach collection="entityType" item="item" open="(" separator="," close=")"> 69 <foreach collection="entityType" item="item" open="(" separator="," close=")">
68 #{item} 70 #{item}
69 </foreach> 71 </foreach>
  72 + <if test="entityFilter !=null">
  73 + AND base.entity_type = #{entityFilter}
  74 + </if>
70 <if test="tenantId !=null and tenantId !=''"> 75 <if test="tenantId !=null and tenantId !=''">
71 AND base.tenant_id = #{tenantId}::uuid 76 AND base.tenant_id = #{tenantId}::uuid
72 </if> 77 </if>
@@ -89,6 +94,7 @@ @@ -89,6 +94,7 @@
89 SELECT <include refid="detailColumn"/> 94 SELECT <include refid="detailColumn"/>
90 FROM audit_log base 95 FROM audit_log base
91 LEFT JOIN tenant ten ON base.tenant_id = ten.id 96 LEFT JOIN tenant ten ON base.tenant_id = ten.id
  97 + LEFT JOIN customer cus ON base.customer_id = cus.id
92 <where> 98 <where>
93 base.id = #{entityId}::uuid 99 base.id = #{entityId}::uuid
94 100