From ca054d1db9256bc8d367486b0d78e89cd4fd7fdb Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 22 十月 2024 20:41:10 +0800
Subject: [PATCH] 删除时会连着分享和下载的数据一起删掉

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java
index 59edb03..f8f393f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZPropertyController.java
@@ -10,7 +10,9 @@
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.domain.ZProperty;
 import com.ruoyi.domain.ZfEconomy;
+import com.ruoyi.service.ZPropertyDownloadService;
 import com.ruoyi.service.ZPropertyService;
+import com.ruoyi.service.ZPropertyShareService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -39,6 +41,12 @@
     @Autowired
     private ZPropertyService zPropertyService;
 
+    @Autowired
+    private ZPropertyDownloadService zPropertyDownloadService;
+
+    @Autowired
+    private ZPropertyShareService zPropertyShareService;
+
     /**
      * 鏌ヨ鎵�鏈夎褰�
      */
@@ -47,6 +55,11 @@
         Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
         Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
         return zPropertyService.selectDataList(zProperty,pageNum,pageSize);
+    }
+
+    @GetMapping("/type")
+    public AjaxResult listType(){
+        return zPropertyService.listType();
     }
 
     /**
@@ -60,7 +73,7 @@
     /**
      * 妯℃澘
      */
-    @GetMapping("/model")
+    @PostMapping("/model")
     public void getModel(HttpServletResponse response){
         ZProperty zProperty = new ZProperty();
         List<ZProperty> emptyList = Collections.singletonList(zProperty);
@@ -73,8 +86,18 @@
      */
 //    @PreAuthorize("@ss.hasPermi('system:property:export')")
     @Log(title = "涓汉璐骇璁板綍", businessType = BusinessType.EXPORT)
-    @PostMapping("/export/{ids}")
-    public void export(HttpServletResponse response,@PathVariable Long[] ids)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response)
+    {
+        List<ZProperty> list = zPropertyService.selectByCondition();
+        log.info("瀵煎嚭璁板綍涓�:{}",list);
+        ExcelUtil<ZProperty> util = new ExcelUtil<>(ZProperty.class);
+        util.exportExcel(response, list, "涓汉璐骇璁板綍鏁版嵁");
+    }
+
+    @Log(title = "涓汉璐骇璁板綍", businessType = BusinessType.EXPORT)
+    @PostMapping("/export1/{ids}")
+    public void export1(HttpServletResponse response,@PathVariable Long[] ids)
     {
         List<ZProperty> list = zPropertyService.selectByIds(ids);
         log.info("瀵煎嚭璁板綍涓�:{}",list);
@@ -122,6 +145,9 @@
     @DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
+        if (! (zPropertyDownloadService.deleteData(ids) && zPropertyShareService.deleteByContentId(ids)  ) ){
+            return AjaxResult.error();
+        }
         return toAjax(zPropertyService.removeByIds(Arrays.asList(ids)));
     }
 

--
Gitblit v1.9.1