From c35d9c6311b6f9ef75b49559a5c6db75e0a43ac6 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 30 七月 2024 20:06:50 +0800
Subject: [PATCH] 修改bug&分享

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java |   64 ++++++++++++++++---------------
 1 files changed, 33 insertions(+), 31 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 71f8424..fe33a72 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
@@ -9,8 +9,8 @@
 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.domain.ZfDownload;
+import com.ruoyi.mapper.ZfDownloadMapper;
 import com.ruoyi.service.*;
 import org.elasticsearch.action.delete.DeleteRequest;
 import org.elasticsearch.client.RequestOptions;
@@ -23,7 +23,7 @@
 import java.util.stream.Collectors;
 
 @Service
-public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDoctorDownloadMapper, ZfDoctorDownload> implements ZfDoctorDownloadService {
+public class ZfDoctorDownloadServiceImpl extends ServiceImpl<ZfDownloadMapper, ZfDownload> implements ZfDoctorDownloadService {
 
     @Resource
     EsService esService;
@@ -41,27 +41,29 @@
     @Resource
     private RestHighLevelClient restHighLevelClient;
 
-    private LambdaQueryWrapper<ZfDoctorDownload> buildCondition(ZfDoctorDownload zfDoctorDownload,Long userId) {
-        LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
-        lqw.in(ZfDoctorDownload::getDownloadId,userId);
-        lqw.orderByDesc(ZfDoctorDownload::getDownloadId);
-        lqw.like(zfDoctorDownload.getDownloadId() != null, ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
-            .like(zfDoctorDownload.getDownloadContent() != null, ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
+    private LambdaQueryWrapper<ZfDownload> buildCondition(ZfDownload zfDownload, Long userId) {
+        LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+        lqw.in(ZfDownload::getDownloadId,userId);
+        lqw.orderByDesc(ZfDownload::getDownloadId);
+        lqw.like(zfDownload.getDownloadId() != null, ZfDownload::getDownloadId, zfDownload.getDownloadId())
+            .like(zfDownload.getDownloadContent() != null, ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+            .eq( ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
         return lqw;
 }
-    private LambdaQueryWrapper<ZfDoctorDownload> uniqueCondition(ZfDoctorDownload zfDoctorDownload) {
-        LambdaQueryWrapper<ZfDoctorDownload> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadId())), ZfDoctorDownload::getDownloadId, zfDoctorDownload.getDownloadId())
-            .eq(StringUtils.isNotEmpty(String.valueOf(zfDoctorDownload.getDownloadContent())), ZfDoctorDownload::getDownloadContent, zfDoctorDownload.getDownloadContent());
+    private LambdaQueryWrapper<ZfDownload> uniqueCondition(ZfDownload zfDownload) {
+        LambdaQueryWrapper<ZfDownload> lqw = new LambdaQueryWrapper<>();
+        lqw.eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadId())), ZfDownload::getDownloadId, zfDownload.getDownloadId())
+            .eq(StringUtils.isNotEmpty(String.valueOf(zfDownload.getDownloadContent())), ZfDownload::getDownloadContent, zfDownload.getDownloadContent())
+            .eq(ZfDownload::getSysMenuId, zfDownload.getSysMenuId());
         return lqw;
     }
     @Override
-    public AjaxResult selectDoctorList(ZfDoctorDownload zfDoctorDownload,Integer pageNo ,Integer pageSize ) {
+    public AjaxResult selectDoctorList(ZfDownload zfDownload, Integer pageNo , Integer pageSize ) {
         ZInfoUser myself = zInfoUserService.getMyself();
-        LambdaQueryWrapper<ZfDoctorDownload> lqw = buildCondition(zfDoctorDownload,myself.getUserId());
-        List<ZfDoctorDownload> beanRecords = list(lqw);
+        LambdaQueryWrapper<ZfDownload> lqw = buildCondition(zfDownload,myself.getUserId());
+        List<ZfDownload> beanRecords = list(lqw);
         List<ZfDoctor> bs = new ArrayList<>();
-        for (ZfDoctorDownload a: beanRecords) {
+        for (ZfDownload a: beanRecords) {
             if (zfDoctorService.getById(a.getDownloadContent()) != null) {
                 ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
                 ds.setShareId(a.getShareId());
@@ -79,27 +81,27 @@
 
 
     @Override
-    public AjaxResult addData(ZfDoctorDownload zfDoctorDownload) {
-    zfDoctorDownload.setDownloadId(getUserId());
-    LambdaQueryWrapper<ZfDoctorDownload> lqw = uniqueCondition(zfDoctorDownload);
-    List<ZfDoctorDownload> list = list(lqw);
+    public AjaxResult addData(ZfDownload zfDownload) {
+    zfDownload.setDownloadId(getUserId());
+    LambdaQueryWrapper<ZfDownload> lqw = uniqueCondition(zfDownload);
+    List<ZfDownload> list = list(lqw);
         if (list.size() > 0) {
-        throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+        throw new RuntimeException("璇峰嬁閲嶅涓嬭浇鏁版嵁");
     }
 
-        zfDoctorDownload.setDownloadId(getUserId());
-        zfDoctorDownload.setShareId(zfDoctorShareService.getShareId(zfDoctorDownload));
-        if (save(zfDoctorDownload)) {
+        zfDownload.setDownloadId(getUserId());
+        zfDownload.setShareId(zfDoctorShareService.getShareId(zfDownload));
+        if (save(zfDownload)) {
         EsModel esModel = new EsModel();
-        Integer inte = zfDoctorDownload.getId().intValue();
+        Integer inte = zfDownload.getId().intValue();
         String uuid = UUID.randomUUID().toString().replace("-", "");
         esModel.setId(uuid);
         esModel.setCtId(Long.valueOf(inte));
         esModel.setCtTableName("瀹跺涵灏忓尰鐢�");
 
-        esModel.setBy1(String.valueOf(zfDoctorDownload.getDownloadId()));
-        esModel.setBy2(String.valueOf(zfDoctorDownload.getDownloadContent()));
-        esModel.setBy3(String.valueOf(zfDoctorDownload.getShareId()));
+        esModel.setBy1(String.valueOf(zfDownload.getDownloadId()));
+        esModel.setBy2(String.valueOf(zfDownload.getDownloadContent()));
+        esModel.setBy3(String.valueOf(zfDownload.getShareId()));
         //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰�
         esService.insertTable(esModel);
         return AjaxResult.success();
@@ -109,12 +111,12 @@
 }
     @Override
     public AjaxResult deleteData(Long[] ids) {
-        List<ZfDoctorDownload> zfDoctorDownloads = listByIds(Arrays.asList(ids));
+        List<ZfDownload> zfDownloads = listByIds(Arrays.asList(ids));
 
         if (zfDoctorShareService.removeByIds(Arrays.asList(ids))) {
 
             //鍒犻櫎es涓殑鏁版嵁
-            zfDoctorDownloads.stream().forEach(zfDoctorDownload -> {
+            zfDownloads.stream().forEach(zfDoctorDownload -> {
                 EsModel esModel = esService.findByCtId(zfDoctorDownload.getId().intValue(), "瀹跺涵灏忓尰鐢熶笅杞�");
 
                 if (esModel != null) {

--
Gitblit v1.9.1