From a69aafe60ce001834b981778f12fd74d4af77e23 Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期日, 23 六月 2024 22:04:42 +0800 Subject: [PATCH] 小医生修改&下载分享数据 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 35 +++++++++++++++++++++++++++-------- 1 files changed, 27 insertions(+), 8 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..b2a34d5 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 @@ -6,10 +6,9 @@ import com.ruoyi.common.core.domain.entity.SysUser; 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 +24,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 +71,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); @@ -95,7 +97,7 @@ { 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())); @@ -117,7 +119,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,11 +132,11 @@ * 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜� */ @Override - public AjaxResult listByUserId(Long shareId) { + public AjaxResult listByUserId() { //鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭 HashMap<Long,ZfDoctor> bs = new HashMap<>(); LambdaQueryWrapper<ZfDoctorShare> lqw = new LambdaQueryWrapper<>(); - lqw.eq(ZfDoctorShare::getShareId,shareId); + lqw.eq(ZfDoctorShare::getShareId,getUserId()); List<ZfDoctorShare> beanRecords = list(lqw); for (ZfDoctorShare beanRecord : beanRecords ) { bs.put(beanRecord.getUserId(),zfDoctorService.getById(beanRecord.getShareContent())); @@ -162,6 +164,23 @@ return 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