From c30e0e9edeeb6f0cd00e70c3882ab0328b64b969 Mon Sep 17 00:00:00 2001 From: DELL Date: Tue, 26 Mar 2024 18:26:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=BC=E5=90=88=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2bug=EF=BC=8C?= =?UTF-8?q?=E7=9B=B8=E4=BC=BC=E5=BA=A6=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=BD=93=E7=9B=B8=E4=BC=BC=E5=BA=A6=E8=B5=B7=E5=A7=8B=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=E5=8C=85=E5=90=AB0=E6=97=B6=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E7=9B=B8=E4=BC=BC=E5=BA=A6=E4=B8=BAnull=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B9=9F=E8=BF=9B=E8=A1=8C=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OcrSearchHistoryController.java | 9 +++++- .../ocr/dataDao/OcrSearchHistoryMapper.java | 6 ++-- .../ocr/service/IOcrSearchHistoryService.java | 2 +- .../impl/OcrSearchHistoryServiceImpl.java | 8 ++--- .../ocr/util/SearchParaFormatting.java | 11 ++++++- .../mapper/oa/OcrSearchHistoryMapper.xml | 29 ++++++++----------- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java index 4f599876..0a546ea9 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java @@ -7,6 +7,7 @@ import cn.jyjz.xiaoyao.common.base.vo.ResultVoUtil; import cn.jyjz.xiaoyao.common.base.vo.UserToken; import cn.jyjz.xiaoyao.ocr.dataobject.OcrSearchHistory; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -44,9 +45,15 @@ public class OcrSearchHistoryController { @RequestMapping(value = "/searchList", method = RequestMethod.GET) public ResultVo searchList(HttpServletRequest request, @RequestParam(value = "search", required = true) String search) { + //租户主键,由前端页面传送 + String tenantId = request.getHeader("X-Tenant-Id"); + if (StringUtils.isBlank(tenantId)) { + return ResultVoUtil.error("租户主键不能为空"); + } + UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request)); //执行查询方法 - Map>> selectsearch = ocrSearchHistoryService.selectsearch(search, userToken.getLoginname()); + Map>> selectsearch = ocrSearchHistoryService.selectsearch(search, userToken.getLoginname(),userToken.getUserid(),tenantId); OcrSearchHistory ocrsearchhistory =new OcrSearchHistory(); ocrsearchhistory.setHistoryname(search); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSearchHistoryMapper.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSearchHistoryMapper.java index e0cb2e38..3c78666e 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSearchHistoryMapper.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataDao/OcrSearchHistoryMapper.java @@ -19,11 +19,11 @@ import java.util.Map; */ @Mapper public interface OcrSearchHistoryMapper extends BaseMapper { - List> selectsearch1(@Param("userid")String userid,@Param("search")String search); + List> selectsearch1(@Param("userid")String userid,@Param("search")String search,@Param("tenantId")String tenantId); - List> selectsearch2(@Param("userid")String userid,@Param("search")String search); + List> selectsearch2(@Param("userid")String userid,@Param("search")String search,@Param("tenantId")String tenantId); - List> selectsearch3(@Param("userid")String userid,@Param("search")String search); + List> selectsearch3(@Param("userid")String userid,@Param("search")String search,@Param("tenantId")String tenantId); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/IOcrSearchHistoryService.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/IOcrSearchHistoryService.java index 641ad9a5..5624c592 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/IOcrSearchHistoryService.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/IOcrSearchHistoryService.java @@ -17,7 +17,7 @@ import java.util.Map; * @since 2024-03-15 */ public interface IOcrSearchHistoryService extends IService { - Map>> selectsearch(String search, String assignee); + Map>> selectsearch(String search, String assignee, String userId, String tenantId); ResultVo toolscount(String tenantid); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java index f360a944..499d2589 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java @@ -38,13 +38,13 @@ public class OcrSearchHistoryServiceImpl extends ServiceImpl>> selectsearch(String search, String assignee) { + public Map>> selectsearch(String search, String assignee, String userId, String tenantId) { - List> strings1 = ocrsearchhistorymapper.selectsearch1(assignee,search); - List> strings2 = ocrsearchhistorymapper.selectsearch2(assignee,search); - List> strings3 = ocrsearchhistorymapper.selectsearch3(assignee,search); + List> strings1 = ocrsearchhistorymapper.selectsearch1(userId,search,tenantId); + List> strings2 = ocrsearchhistorymapper.selectsearch2(assignee,search,tenantId); + List> strings3 = ocrsearchhistorymapper.selectsearch3(assignee,search,tenantId); // List>>> list = new ArrayList<>(); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/SearchParaFormatting.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/SearchParaFormatting.java index 8a003abc..09789944 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/SearchParaFormatting.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/SearchParaFormatting.java @@ -91,7 +91,16 @@ public class SearchParaFormatting { //数字区间查询 if(sectionInts!=null && sectionInts.size()==2){ //相等 - queryWrapper.between(key,sectionInts.get(0),sectionInts.get(1)); +// queryWrapper.between(key,sectionInts.get(0),sectionInts.get(1)); + if (sectionInts.get(0) == 0) { + // 构建查询条件:key 为 null 或者在指定区间内 + queryWrapper.isNull(key); + queryWrapper.or(); + queryWrapper.between(key, sectionInts.get(0), sectionInts.get(1)); + } else { + // 相等 + queryWrapper.between(key, sectionInts.get(0), sectionInts.get(1)); + } break; } queryWrapper.between(key,sections[0],sections[1]); diff --git a/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSearchHistoryMapper.xml b/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSearchHistoryMapper.xml index e1d13cb5..4468403d 100644 --- a/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSearchHistoryMapper.xml +++ b/jyjz-system/jyjz-system-oa/src/main/resources/mapper/oa/OcrSearchHistoryMapper.xml @@ -17,50 +17,45 @@