From 2fa7dfbf31e6b572a557845314b0c6f19dd04118 Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期二, 09 七月 2024 21:29:38 +0800
Subject: [PATCH] 修改了家人姓名

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java |   61 +++++++++++++++++++++---------
 1 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
index b8b4f01..08c6d9a 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java
@@ -1,15 +1,17 @@
 package com.ruoyi.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 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.SysUser;
+import com.ruoyi.common.utils.MapUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.domain.ShareMore;
-import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.ZfDoctorShare;
+import com.ruoyi.domain.*;
 import com.ruoyi.mapper.ZfDoctorShareMapper;
+import com.ruoyi.service.ZInfoUserService;
 import com.ruoyi.service.ZfDoctorService;
 import com.ruoyi.service.ZfDoctorShareService;
 import lombok.extern.slf4j.Slf4j;
@@ -25,6 +27,9 @@
 public class ZfDoctorShareServiceImpl extends ServiceImpl<ZfDoctorShareMapper, ZfDoctorShare> implements ZfDoctorShareService {
     @Resource
     private ZfDoctorService zfDoctorService;
+
+    @Resource
+    private ZInfoUserService zInfoUserService;
 
     private LambdaQueryWrapper<ZfDoctorShare> uniqueCondition(ZfDoctorShare zfDoctorShare) {
         LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
@@ -69,7 +74,7 @@
         for (Long shareId : shareIds) {
             for (Long shareContent : shareContents) {
                 ZfDoctorShare za = new ZfDoctorShare();
-                za.setUserId(zfDoctor.getUserId());
+                za.setUserId(getUserId());
                 za.setShareContent(shareContent);
                 za.setShareId(shareId);
                 addData(za);
@@ -87,24 +92,23 @@
      * 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁
      */
     @Override
-    public AjaxResult listByFidAid(ShareMore zfDoctor) {
+    public List<Long> listByFidAid(ShareMore zfDoctor) {
         //鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
         Long [] shareIds = zfDoctor.getShareIds();
-        List<ZfDoctor> beanRecord3 = new ArrayList<>();
+        List<Long> beanRecord3 = new ArrayList<>();
         for (Long shareId : shareIds) {
             {
                 LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
                 lqw.eq(ZfDoctorShare::getShareId,shareId)
-                        .eq(ZfDoctorShare::getUserId, zfDoctor.getUserId());
+                        .eq(ZfDoctorShare::getUserId, getUserId());
                 List<ZfDoctorShare> beanRecords = list(lqw);
                 for (ZfDoctorShare beanRecord : beanRecords ) {
-                    beanRecord3.add(zfDoctorService.getById(beanRecord.getShareContent()));
+                    beanRecord3.add(beanRecord.getShareContent());
                 }
             }
         }
-        log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecord3);
 
-        return AjaxResult.success(beanRecord3);
+        return beanRecord3;
     }
 
     @Override
@@ -117,7 +121,7 @@
                 LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
                 lqw.eq(ZfDoctorShare::getShareId,shareId)
                         .eq(ZfDoctorShare::getShareContent, shareContent)
-                        .eq(ZfDoctorShare::getUserId, zfDoctor.getUserId());
+                        .eq(ZfDoctorShare::getUserId, getUserId());
 
                 zfDoctorShareService.remove(lqw);
                 //   addData(za);
@@ -130,28 +134,30 @@
      * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜�
      */
     @Override
-    public AjaxResult listByUserId(Long shareId) {
+    public AjaxResult listByUserId() {
         //鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
-        HashMap<Long,ZfDoctor>  bs = new HashMap<>();
+        HashMap<Long,List<ZfDoctor>>  bs = new HashMap<>();
         LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(ZfDoctorShare::getShareId,shareId);
+        lqw.eq(ZfDoctorShare::getShareId,getUserId());
         List<ZfDoctorShare> beanRecords = list(lqw);
+        List<ZfDoctor> b1 = new ArrayList<>();
         for (ZfDoctorShare beanRecord : beanRecords ) {
-            bs.put(beanRecord.getUserId(),zfDoctorService.getById(beanRecord.getShareContent()));
+                b1.add(zfDoctorService.getById(beanRecord.getShareContent()));
+                bs.put(beanRecord.getUserId(),b1);
         }
         log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs);
         return AjaxResult.success(bs);
 
     }
     /**
-     * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹�
+     * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹�==鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜�
      */
     @Override
-    public List<ZfDoctor> listUserId(Long shareId) {
+    public AjaxResult listUserId() {
         //鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
         List<ZfDoctor>  bs = new ArrayList<>();
         LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(ZfDoctorShare::getShareId,shareId);
+        lqw.eq(ZfDoctorShare::getShareId,getUserId());
         List<ZfDoctorShare> beanRecords = list(lqw);
         for (ZfDoctorShare beanRecord : beanRecords ) {
             ZfDoctor bs2 = zfDoctorService.getById(beanRecord.getShareContent());
@@ -159,9 +165,26 @@
             bs.add(bs2);
         }
         log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs);
-        return bs;
+        return AjaxResult.success(bs);
 
     }
+    public Long getUserId(){
+        ZInfoUser myself = zInfoUserService.getMyself();
+        return myself.getUserId();
 
+    }
+    @Override
+    public Long getShareId(ZfDoctorDownload zfDoctorDownload){
+        LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>();
+        lqw.eq(ZfDoctorShare::getShareId,zfDoctorDownload.getDownloadId())
+                .eq(ZfDoctorShare::getShareContent,zfDoctorDownload.getDownloadContent());
+        List<ZfDoctorShare> beanRecords = list(lqw);
+        if (beanRecords.size() != 0){
+            return beanRecords.get(0).getUserId();
+        }
+        else {
+            return null;
+        }
+    }
 
 }

--
Gitblit v1.9.1