From 22f2171b2f5a5cd594ea027860207bf3646f1f9d Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 05 二月 2024 14:08:14 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java
index 473b896..0ededfa 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java
@@ -7,6 +7,7 @@
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -27,15 +28,14 @@
 
 /**
  * 鎹愮尞娴佺▼Controller
- * 
+ *
  * @author ruoyi
  * @date 2021-11-15
  */
 @Api("鎹愮尞娴佺▼绠$悊")
 @RestController
 @RequestMapping("/project/donateflowchart")
-public class ServiceDonateflowchartController extends BaseController
-{
+public class ServiceDonateflowchartController extends BaseController {
     @Autowired
     private IServiceDonateflowchartService serviceDonateflowchartService;
 
@@ -45,8 +45,7 @@
     @ApiOperation("鏌ヨ鎹愮尞娴佺▼")
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:list')")
     @GetMapping("/list")
-    public TableDataInfo list(ServiceDonateflowchart serviceDonateflowchart)
-    {
+    public TableDataInfo list(ServiceDonateflowchart serviceDonateflowchart) {
         startPage();
         List<ServiceDonateflowchart> list = serviceDonateflowchartService.queryList(serviceDonateflowchart);
 
@@ -60,8 +59,7 @@
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:export')")
     @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(ServiceDonateflowchart serviceDonateflowchart)
-    {
+    public AjaxResult export(ServiceDonateflowchart serviceDonateflowchart) {
         List<ServiceDonateflowchart> list = serviceDonateflowchartService.queryList(serviceDonateflowchart);
         ExcelUtil<ServiceDonateflowchart> util = new ExcelUtil<ServiceDonateflowchart>(ServiceDonateflowchart.class);
         return util.exportExcel(list, "鎹愮尞娴佺▼鏁版嵁");
@@ -73,8 +71,7 @@
     @ApiOperation("閫氳繃id鑾峰彇鎹愮尞娴佺▼")
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(serviceDonateflowchartService.getById(id));
     }
 
@@ -84,11 +81,11 @@
     @ApiOperation("鏂板鎹愮尞娴佺▼")
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:add')")
     @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.INSERT)
-    @PostMapping
+    @PostMapping("/add")
     @RepeatSubmit
-    public AjaxResult add(@RequestBody ServiceDonateflowchart serviceDonateflowchart)
-    {
-        return toAjax(serviceDonateflowchartService.save(serviceDonateflowchart));
+    public AjaxResult add(@RequestBody ServiceDonateflowchart serviceDonateflowchart) {
+        boolean save = serviceDonateflowchartService.save(serviceDonateflowchart);
+        return AjaxResult.success(serviceDonateflowchart);
     }
 
     /**
@@ -97,10 +94,16 @@
     @ApiOperation("淇敼鎹愮尞娴佺▼")
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:edit')")
     @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.UPDATE)
-    @PutMapping
-    @RepeatSubmit    
-    public AjaxResult edit(@RequestBody ServiceDonateflowchart serviceDonateflowchart)
-    {
+    @PostMapping("/edit")
+    @RepeatSubmit
+    public AjaxResult edit(@RequestBody ServiceDonateflowchart serviceDonateflowchart) {
+        ServiceDonateflowchart serviceDonateflowchart1 = new ServiceDonateflowchart();
+        serviceDonateflowchart1.setInfoid(serviceDonateflowchart.getInfoid());
+        List<ServiceDonateflowchart> list = serviceDonateflowchartService.queryList(serviceDonateflowchart1);
+        if (CollectionUtils.isEmpty(list)) {
+            return error("浼︾悊瀹℃煡淇敼鏁版嵁涓嶅瓨鍦�,璇锋鏌ュ悗鍐嶆淇敼");
+        }
+        serviceDonateflowchart.setId(list.get(0).getId());
         return toAjax(serviceDonateflowchartService.updateById(serviceDonateflowchart));
     }
 
@@ -110,9 +113,8 @@
     @ApiOperation("鍒犻櫎鎹愮尞娴佺▼")
     //@PreAuthorize("@ss.hasPermi('system:donateflowchart:remove')")
     @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @GetMapping("/remove/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(serviceDonateflowchartService.removeByIds(Arrays.asList(ids)));
     }
 }

--
Gitblit v1.9.3