From 5cdf5c84b04951a6fe43fbe622335f0a14b44f77 Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期六, 22 六月 2024 18:18:26 +0800
Subject: [PATCH] 修改了权限的代码

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteController.java |   40 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteController.java
index 4e2f4a6..6b79a8d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfPetNoteController.java
@@ -8,6 +8,7 @@
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.ZfPet;
 import com.ruoyi.domain.ZfPetNote;
 import com.ruoyi.domain.ZfProperty;
 import com.ruoyi.service.ZfPetNoteService;
@@ -20,6 +21,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.websocket.server.PathParam;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
@@ -51,9 +53,23 @@
      * 鏍规嵁瀹犵墿id鑾峰彇鐩稿叧澶囧繕褰�
      */
     @GetMapping
-    public AjaxResult getByPetId(@PathParam("pid")Long pid){
-        return zfPetNoteService.getAllPetNoteByPetId(pid);
+    public AjaxResult getByPetId(@PathParam("pid")String pid,ZfPetNote zfPetNote){
+        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+        return zfPetNoteService.getAllPetNoteByPetId(pageNum,pageSize,pid,zfPetNote);
     }
+
+
+    /**
+     * 鑾峰彇瀵煎叆妯℃澘
+     */
+    @PostMapping("/model")
+    public void getExportModel(HttpServletResponse response){
+        List<ZfPetNote> list = Collections.singletonList(new ZfPetNote());
+        ExcelUtil<ZfPetNote> util = new ExcelUtil<>(ZfPetNote.class);
+        util.exportExcel(response,list,"榄呭疇澶囧繕褰曞鍏ユā鏉�");
+    }
+
 
     /**
      * 瀵煎嚭榄呭疇澶囧繕褰曡褰曞垪琛�
@@ -69,15 +85,29 @@
         util.exportExcel(response, list, "榄呭疇澶囧繕褰曡褰曟暟鎹�");
     }
 
+    @Log(title = "榄呭疇澶囧繕褰曡褰�", businessType = BusinessType.EXPORT)
+    @PostMapping("/export1/{ids}")
+    public void export1(HttpServletResponse response, ZfPetNote zfPetNote, @PathVariable Long[] ids)
+    {
+        List<ZfPetNote> list = zfPetNoteService.selectByIds(ids);
+        log.info("瀵煎嚭璁板綍涓�:{}",list);
+        ExcelUtil<ZfPetNote> util = new ExcelUtil<>(ZfPetNote.class);
+        util.exportExcel(response, list, "榄呭疇澶囧繕褰曡褰曟暟鎹�");
+    }
+
+
     /**
      * 瀵煎叆榄呭疇澶囧繕褰曡褰曞垪琛�
      */
     @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
-    @PostMapping("/importData")
-    public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception
+    @PostMapping("/importData/{pid}")
+    public AjaxResult importData(@RequestParam("excelImport") MultipartFile file,@PathVariable String pid) throws Exception
     {
         ExcelUtil<ZfPetNote> util = new ExcelUtil<>(ZfPetNote.class);
         List<ZfPetNote> eventList = util.importExcel(file.getInputStream());
+        for (ZfPetNote zfPetNote : eventList) {
+            zfPetNote.setPid(pid);
+        }
         log.info("榄呭疇澶囧繕褰曞垪琛ㄤ负锛歿}",eventList);
 
         if (zfPetNoteService.saveBatch(eventList)) {
@@ -104,7 +134,7 @@
     @PostMapping
     public AjaxResult add(@RequestBody ZfPetNote zfPetNote)
     {
-        return toAjax(zfPetNoteService.save(zfPetNote));
+        return zfPetNoteService.mySave(zfPetNote);
     }
 
     /**

--
Gitblit v1.9.1