From 7510cec570ed7ad5b13b2f3993285e70e26389c7 Mon Sep 17 00:00:00 2001 From: dengchun Date: Sun, 27 Apr 2025 00:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=90=9C=E7=B4=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E5=85=88=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ComponentSearchServiceImpl.java | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ComponentSearchServiceImpl.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ComponentSearchServiceImpl.java index 2e3cde4..6881330 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ComponentSearchServiceImpl.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ComponentSearchServiceImpl.java @@ -1,6 +1,7 @@ package org.jeecg.modules.database.service.impl; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jodd.util.StringUtil; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.modules.database.constant.ComponentSearchType; +import org.jeecg.modules.database.entity.DocumentFavorites; import org.jeecg.modules.database.entity.Experiment; import org.jeecg.modules.database.entity.SearchResult; import org.jeecg.modules.database.mapper.ComponentSearchMapper; @@ -38,11 +40,11 @@ public class ComponentSearchServiceImpl extends ServiceImpl search(Integer type, String content) { - SearchResult searchResult = new SearchResult(); - Map requestMap = new HashMap(); - requestMap.put("dataType", type); - requestMap.put("content", content); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(searchResult,requestMap); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SearchResult::getDataType, type); + queryWrapper.likeRight(SearchResult::getContent, content); + return this.list(queryWrapper); } @@ -52,12 +54,9 @@ public class ComponentSearchServiceImpl extends ServiceImpl { if (StringUtil.isNotEmpty(sampleInfo.getSampleModel())) { - SearchResult searchResult = new SearchResult(); - Map requestMap = new HashMap(); - requestMap.put("dataType", ComponentSearchType.MODEL_NUMBER.getCode()); - requestMap.put("content", sampleInfo.getSampleModel().trim()); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(searchResult,requestMap); - + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SearchResult::getDataType, ComponentSearchType.MODEL_NUMBER.getCode()); + queryWrapper.likeRight(SearchResult::getContent, sampleInfo.getSampleModel().trim()); if (0L == this.count(queryWrapper)){ SearchResult modelNumberRecord = new SearchResult(); modelNumberRecord.setDataType(ComponentSearchType.MODEL_NUMBER.getCode()); @@ -71,12 +70,9 @@ public class ComponentSearchServiceImpl extends ServiceImpl queryWrapper = QueryGenerator.initQueryWrapper(searchResult,requestMap); - + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SearchResult::getDataType, ComponentSearchType.MODEL_NAME.getCode()); + queryWrapper.likeRight(SearchResult::getContent, sampleInfo.getSampleName().trim()); if (0L == this.count(queryWrapper)){ SearchResult modelNameRecord = new SearchResult(); modelNameRecord.setDataType(ComponentSearchType.MODEL_NAME.getCode()); @@ -90,11 +86,9 @@ public class ComponentSearchServiceImpl extends ServiceImpl queryWrapper = QueryGenerator.initQueryWrapper(searchResult,requestMap); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SearchResult::getDataType, ComponentSearchType.MODEL_BATCH_NO.getCode()); + queryWrapper.likeRight(SearchResult::getContent, sampleInfo.getModelBatch().trim()); if (0L == this.count(queryWrapper)){ SearchResult modelBatchNoRecord = new SearchResult(); modelBatchNoRecord.setDataType(ComponentSearchType.MODEL_BATCH_NO.getCode());