From 94b1a3bde93ad87f9347d8a08d70dd4f2318f1ce Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期日, 21 七月 2024 17:47:51 +0800
Subject: [PATCH] 修改分享bug

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
index 76e3fa6..05e4b74 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java
@@ -1,11 +1,14 @@
 package com.ruoyi.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.EsModel;
+import com.ruoyi.common.utils.MapUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.domain.ZInfoUser;
+import com.ruoyi.domain.ZfDoctor;
 import com.ruoyi.domain.ZfDoctorDownload;
 import com.ruoyi.mapper.ZfDoctorDownloadMapper;
 import com.ruoyi.service.*;
@@ -16,10 +19,8 @@
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDoctorDownloadMapper, ZfDoctorDownload> implements ZfDoctorDownloadService {
@@ -32,6 +33,7 @@
 
     @Resource
     ZfDoctorService zfDoctorService;
+
 
     @Resource
     ZInfoUserService zInfoUserService;
@@ -54,16 +56,31 @@
         return lqw;
     }
     @Override
-    public List<ZfDoctorDownload> selectDoctorList(ZfDoctorDownload zfDoctorDownload) {
+    public AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize ) {
         ZInfoUser myself = zInfoUserService.getMyself();
         LambdaQueryWrapper<ZfDoctorDownload> lqw = buildCondition(zfDoctorDownload,myself.getUserId());
         List<ZfDoctorDownload> beanRecords = list(lqw);
-        return new ArrayList<>(beanRecords);
+        List<ZfDoctor> bs = new ArrayList<>();
+        for (ZfDoctorDownload a: beanRecords) {
+            if (zfDoctorService.getById(a.getDownloadContent()) != null) {
+                ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
+                ds.setShareId(a.getShareId());
+                bs.add(ds);
+            }
+        }
+        List<ZfDoctor>  record = bs.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
+
+        int totalPage = (bs.size() -1) / pageSize +1;
+
+        Page<ZfDoctor> zfDoctorPage = new Page<>(pageNo, pageSize,totalPage);
+        HashMap<String, Object> data = MapUtils.getShareResult(zfDoctorPage, record);
+        return AjaxResult.success(data);
     }
 
 
     @Override
     public AjaxResult addData(ZfDoctorDownload zfDoctorDownload) {
+    zfDoctorDownload.setDownloadId(getUserId());
     LambdaQueryWrapper<ZfDoctorDownload> lqw = uniqueCondition(zfDoctorDownload);
     List<ZfDoctorDownload> list = list(lqw);
         if (list.size() > 0) {

--
Gitblit v1.9.1