From 868942e202aeb967b8ce47b38cc2433a636a128d Mon Sep 17 00:00:00 2001 From: phanes <5411232+phanes@user.noreply.gitee.com> Date: 星期日, 16 一月 2022 17:46:24 +0800 Subject: [PATCH] update 格式化代码结构 统一编码格式 --- ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java index c34c77c..9b0d537 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java @@ -1,5 +1,6 @@ package com.ruoyi.demo.controller; +import cn.dev33.satoken.annotation.SaCheckPermission; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.core.controller.BaseController; @@ -14,9 +15,8 @@ import com.ruoyi.demo.service.ITestTreeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -34,7 +34,7 @@ */ @Validated @Api(value = "娴嬭瘯鏍戣〃鎺у埗鍣�", tags = {"娴嬭瘯鏍戣〃绠$悊"}) -@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RequiredArgsConstructor @RestController @RequestMapping("/demo/tree") public class TestTreeController extends BaseController { @@ -45,7 +45,7 @@ * 鏌ヨ娴嬭瘯鏍戣〃鍒楄〃 */ @ApiOperation("鏌ヨ娴嬭瘯鏍戣〃鍒楄〃") - @PreAuthorize("@ss.hasPermi('demo:tree:list')") + @SaCheckPermission("demo:tree:list") @GetMapping("/list") public AjaxResult<List<TestTreeVo>> list(@Validated(QueryGroup.class) TestTreeBo bo) { List<TestTreeVo> list = iTestTreeService.queryList(bo); @@ -56,22 +56,23 @@ * 瀵煎嚭娴嬭瘯鏍戣〃鍒楄〃 */ @ApiOperation("瀵煎嚭娴嬭瘯鏍戣〃鍒楄〃") - @PreAuthorize("@ss.hasPermi('demo:tree:export')") + @SaCheckPermission("demo:tree:export") @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.EXPORT) @GetMapping("/export") public void export(@Validated TestTreeBo bo, HttpServletResponse response) { List<TestTreeVo> list = iTestTreeService.queryList(bo); - ExcelUtil.exportExcel(list, "娴嬭瘯鏍戣〃", TestTreeVo.class, response); + ExcelUtil.exportExcel(list, "娴嬭瘯鏍戣〃", TestTreeVo.class, response); } /** * 鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅 */ @ApiOperation("鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅") - @PreAuthorize("@ss.hasPermi('demo:tree:query')") + @SaCheckPermission("demo:tree:query") @GetMapping("/{id}") - public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable("id") Long id) { + public AjaxResult<TestTreeVo> getInfo(@ApiParam("娴嬭瘯鏍慖D") + @NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { return AjaxResult.success(iTestTreeService.queryById(id)); } @@ -79,7 +80,7 @@ * 鏂板娴嬭瘯鏍戣〃 */ @ApiOperation("鏂板娴嬭瘯鏍戣〃") - @PreAuthorize("@ss.hasPermi('demo:tree:add')") + @SaCheckPermission("demo:tree:add") @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.INSERT) @RepeatSubmit @PostMapping() @@ -91,7 +92,7 @@ * 淇敼娴嬭瘯鏍戣〃 */ @ApiOperation("淇敼娴嬭瘯鏍戣〃") - @PreAuthorize("@ss.hasPermi('demo:tree:edit')") + @SaCheckPermission("demo:tree:edit") @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.UPDATE) @RepeatSubmit @PutMapping() @@ -103,11 +104,12 @@ * 鍒犻櫎娴嬭瘯鏍戣〃 */ @ApiOperation("鍒犻櫎娴嬭瘯鏍戣〃") - @PreAuthorize("@ss.hasPermi('demo:tree:remove')") - @Log(title = "娴嬭瘯鏍戣〃" , businessType = BusinessType.DELETE) + @SaCheckPermission("demo:tree:remove") + @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable Long[] ids) { + public AjaxResult<Void> remove(@ApiParam("娴嬭瘯鏍慖D涓�") + @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); } } -- Gitblit v1.9.3