From c80eea153bb7928faca0b5c4e897a7e82d50d45b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 18 May 2022 19:06:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=A5=E5=BF=97=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=B1=BB=E5=9E=8B=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/service/sys/log/LogService.java | 35 +++++++++++++++++++ frontend/src/views/system/log/index.vue | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/sys/log/LogService.java b/backend/src/main/java/io/dataease/service/sys/log/LogService.java index 688b2df2b9..e29ee15d7d 100644 --- a/backend/src/main/java/io/dataease/service/sys/log/LogService.java +++ b/backend/src/main/java/io/dataease/service/sys/log/LogService.java @@ -7,6 +7,7 @@ import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.BeanUtils; import io.dataease.controller.sys.base.BaseGridRequest; +import io.dataease.controller.sys.base.ConditionEntity; import io.dataease.dto.SysLogDTO; import io.dataease.dto.SysLogGridDTO; import io.dataease.dto.log.FolderItem; @@ -16,6 +17,8 @@ import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysLogWithBLOBs; import io.dataease.plugins.common.base.mapper.SysLogMapper; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -44,6 +47,38 @@ public class LogService { public List query(BaseGridRequest request) { + List conditions = request.getConditions(); + if (CollectionUtils.isNotEmpty(conditions)) { + ConditionEntity optypeCondition = null; + ConditionEntity sourceCondition = null; + int matchIndex = -1; + for (int i = 0; i < conditions.size(); i++) { + ConditionEntity conditionEntity = conditions.get(i); + String field = conditionEntity.getField(); + Object value = conditionEntity.getValue(); + + if (StringUtils.isNotBlank(field) && StringUtils.equals("optype", field) && ObjectUtils.isNotEmpty(value)) { + matchIndex = i; + optypeCondition = new ConditionEntity(); + sourceCondition = new ConditionEntity(); + List values = (List) value; + sourceCondition.setField("source_type"); + optypeCondition.setField("operate_type"); + List opValue = values.stream().map(v -> Integer.parseInt(v.split("-")[0])).collect(Collectors.toList()); + List soValue = values.stream().map(v -> Integer.parseInt(v.split("-")[1])).collect(Collectors.toList()); + optypeCondition.setValue(opValue); + sourceCondition.setValue(soValue); + optypeCondition.setOperator(conditionEntity.getOperator()); + sourceCondition.setOperator(conditionEntity.getOperator()); + } + } + if (matchIndex >= 0 ) { + conditions.remove(matchIndex); + if (ObjectUtils.isNotEmpty(optypeCondition))conditions.add(optypeCondition); + if (ObjectUtils.isNotEmpty(sourceCondition))conditions.add(sourceCondition); + } + } + GridExample gridExample = request.convertExample(); List voLogs = extSysLogMapper.query(gridExample); List dtos = voLogs.stream().map(this::convertDTO).collect(Collectors.toList()); diff --git a/frontend/src/views/system/log/index.vue b/frontend/src/views/system/log/index.vue index 29ac4bafcc..1553d97f08 100644 --- a/frontend/src/views/system/log/index.vue +++ b/frontend/src/views/system/log/index.vue @@ -44,7 +44,7 @@ export default { columns: [], searchConfig: { - useQuickSearch: true, + useQuickSearch: false, useComplexSearch: true, quickPlaceholder: this.$t('log.search_by_key'), components: [