From cb22e2441394cd61116d64a844708ca9390a0529 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期日, 21 七月 2024 18:43:55 +0800
Subject: [PATCH] Merge branch 'master' of http://47.93.189.255:8099/r/zhangshi_app_backend
---
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorShareServiceImpl.java | 55 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 42 insertions(+), 13 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 cef2d83..93fdac1 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,15 @@
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.ZInfoUser;
-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;
@@ -21,6 +21,9 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.alibaba.druid.sql.PagerUtils.limit;
@Slf4j
@Service
@@ -92,7 +95,7 @@
* 鏍规嵁UserId鍜屽垎浜汉shareId鏌ョ湅宸茬粡鎺堟潈缁欓偅浜涗汉閭d簺鏁版嵁
*/
@Override
- public AjaxResult listByFidAid(ShareMore zfDoctor) {
+ public AjaxResult listByFidAid(ShareMore zfDoctor,Integer pageNo ,Integer pageSize) {
//鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
Long [] shareIds = zfDoctor.getShareIds();
List<ZfDoctor> beanRecord3 = new ArrayList<>();
@@ -107,9 +110,14 @@
}
}
}
- log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecord3);
+ List<ZfDoctor> record = beanRecord3.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
- return AjaxResult.success(beanRecord3);
+ int totalPage = (beanRecord3.size() -1) / pageSize +1;
+
+ Page<ZfDoctor> zfDoctorPage = new Page<>(pageNo, pageSize,totalPage);
+ HashMap<String, Object> data = MapUtils.getShareResult(zfDoctorPage, record,beanRecord3.size());
+
+ return AjaxResult.success(data);
}
@Override
@@ -137,26 +145,28 @@
@Override
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,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(Integer pageNo ,Integer pageSize) {
//鎵惧埌瀵瑰簲鐨勮祴浜堟暟鎹殑鐢ㄦ埛浠ュ強鏁版嵁鍐呭
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());
@@ -164,7 +174,13 @@
bs.add(bs2);
}
log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", bs);
- return bs;
+ 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,bs.size());
+ return AjaxResult.success(data);
}
public Long getUserId(){
@@ -172,5 +188,18 @@
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