From b6dd47b05107fc36d8ff4f7f29a4446521f95503 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期四, 02 一月 2025 18:44:28 +0800 Subject: [PATCH] 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateflowchartController.java | 50 ++++++++++++++++++++++++++------------------------ 1 files changed, 26 insertions(+), 24 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 cf64e70..4307ae6 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; @@ -43,10 +43,9 @@ * 鏌ヨ鎹愮尞娴佺▼鍒楄〃 */ @ApiOperation("鏌ヨ鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:list')") + //// @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); @@ -57,11 +56,10 @@ * 瀵煎嚭鎹愮尞娴佺▼鍒楄〃 */ @ApiOperation("瀵煎嚭鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:export')") + //// @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, "鎹愮尞娴佺▼鏁版嵁"); @@ -71,10 +69,9 @@ * 鑾峰彇鎹愮尞娴佺▼璇︾粏淇℃伅 */ @ApiOperation("閫氳繃id鑾峰彇鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:query')") + //// @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)); } @@ -82,25 +79,31 @@ * 鏂板鎹愮尞娴佺▼ */ @ApiOperation("鏂板鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:add')") + //// @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); } /** * 淇敼鎹愮尞娴佺▼ */ @ApiOperation("淇敼鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:edit')") + //// @PreAuthorize("@ss.hasPermi('system:donateflowchart:edit')") @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.UPDATE) @PostMapping("/edit") - @RepeatSubmit - public AjaxResult edit(@RequestBody ServiceDonateflowchart serviceDonateflowchart) - { + @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)); } @@ -108,11 +111,10 @@ * 鍒犻櫎鎹愮尞娴佺▼ */ @ApiOperation("鍒犻櫎鎹愮尞娴佺▼") - //@PreAuthorize("@ss.hasPermi('system:donateflowchart:remove')") + //// @PreAuthorize("@ss.hasPermi('system:donateflowchart:remove')") @Log(title = "鎹愮尞娴佺▼", businessType = BusinessType.DELETE) @GetMapping("/remove/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(serviceDonateflowchartService.removeByIds(Arrays.asList(ids))); } } -- Gitblit v1.9.3