From 41704e538bd0402b8e8ca826404ba84f6de56fe5 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 11 六月 2024 17:35:39 +0800
Subject: [PATCH] 修改分享
---
zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java | 2 +-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java | 11 ++++-------
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 19 ++++++++++++++-----
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
index a320d6a..1cb8036 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
@@ -4,10 +4,7 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.service.ZfDoctorShareService;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -37,9 +34,9 @@
/**
* 鐢ㄦ埛鑷繁鏌ョ湅鍒汉鍒嗕韩鐨勬暟鎹拰鍒嗕韩浜�
*/
- @PostMapping("/getInfoByShareId")
- public AjaxResult empowerGetInfo2(@RequestBody Long shareId){
- return zfDoctorShareService.listByUserId(shareId);
+ @GetMapping("/getInfoByShareId")
+ public AjaxResult empowerGetInfo2(){
+ return zfDoctorShareService.listByUserId();
}
/**
* 鏍规嵁userId鍜宻hareId鏀跺洖宸茬粡鎺堟潈缁欓偅浜涗汉
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
index 2bb4b2d..5b125ae 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfDoctorShareService.java
@@ -18,7 +18,7 @@
AjaxResult deleteZa(ShareMore zfDoctor);
- AjaxResult listByUserId(Long shareId);
+ AjaxResult listByUserId();
List<ZfDoctor> listUserId(Long shareId);
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..cef2d83 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
@@ -7,9 +7,11 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ShareMore;
+import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDoctorShare;
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);
@@ -95,7 +100,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 +122,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 +135,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 +167,10 @@
return bs;
}
+ public Long getUserId(){
+ ZInfoUser myself = zInfoUserService.getMyself();
+ return myself.getUserId();
+ }
}
--
Gitblit v1.9.1