From cdd1ef49773e49dd91d19f9d02c82fb70e9f658c Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期五, 18 七月 2025 18:07:54 +0800 Subject: [PATCH] zjh20250718 --- ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAdviceController.java | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAdviceController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAdviceController.java index 41d5d81..ec2858e 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAdviceController.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjAdviceController.java @@ -116,7 +116,7 @@ @GetMapping("/getKjTjAdviceKjbqBySex") @ApiOperation(value = "鏍规嵁浣撴浜烘�у埆鍜屾槸鍚︿负鎬绘鏌ヨ浣撴寤鸿鎺ュ彛") - public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam String sex, @RequestParam @ApiParam(value = "1甯歌鍖荤敓 0鎬绘") String isZj, + public AjaxResult getKjTjAdviceKjbqBySex(@RequestParam @ApiParam(value = "1甯歌鍖荤敓 0鎬绘") String isZj, @RequestParam(required = false) @ApiParam(value ="寤鸿鍐呭") String jynr, @RequestParam(required = false) @ApiParam(value ="寤鸿鏍囬") String jybt, @ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer page, @@ -157,14 +157,18 @@ @GetMapping("/getCyTjAdviceKjbqBySex") @ApiOperation(value = "鏍规嵁褰撳墠鐧诲綍浜篿d鑾峰彇甯哥敤寤鸿") - public AjaxResult getCyTjAdviceKjbqBySex(@RequestParam(required = false) String sex, @RequestParam @ApiParam(value = "鐢ㄦ埛id 浼犲綋鍓嶇櫥褰曚汉") Long userId, + public AjaxResult getCyTjAdviceKjbqBySex( @RequestParam @ApiParam(value = "鐢ㄦ埛id 浼犲綋鍓嶇櫥褰曚汉") Long userId, @ApiParam(value = "椤电爜鏁�(榛樿1)") @RequestParam(defaultValue = "1") Integer page, - @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize) { + @ApiParam(value = "鏄剧ず鏉℃暟(榛樿10)") @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String nr) { LambdaQueryWrapper<TjUserAdvice> wq0 = new LambdaQueryWrapper<>(); - if(!SecurityUtils.isAdmin(userId)) wq0.eq(TjUserAdvice::getUserId, userId); + if(!SecurityUtils.isAdmin(userId)) + wq0.eq(TjUserAdvice::getUserId, userId); List<TjUserAdvice> list = userAdviceService.list(wq0); List<TjAdvice> kjbqPage = new ArrayList<>(); Map<String,Object> map = new HashMap<>(); + map.put("total", 0); + map.put("records", null); if (null != list && !list.isEmpty()) { for (TjUserAdvice advice : list) { TjAdvice advice1 = tjAdviceService.getById(advice.getAdviceId()); @@ -173,9 +177,18 @@ kjbqPage.add(advice1); } } - List<TjAdvice> adviceList = kjbqPage.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); - map.put("total", kjbqPage.size()); - map.put("records", adviceList); + List<TjAdvice> adviceList =null; + if(StringUtil.isNotBlank( nr)){ + adviceList = kjbqPage.stream().filter(kjbq -> StringUtil.isNotBlank(kjbq.getTitle()) && kjbq.getTitle().contains(nr)).collect(Collectors.toList()); + List<TjAdvice> tjAdviceList = adviceList.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + map.put("total", adviceList.size()); + map.put("records", tjAdviceList); + }else { + adviceList = kjbqPage.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + map.put("total", kjbqPage.size()); + map.put("records", adviceList); + } + return AjaxResult.success(map); } return AjaxResult.success("璇ョ敤鎴锋殏鏃舵病鏈夊父鐢ㄥ缓璁�!"); -- Gitblit v1.8.0