From d9e54388e7fde2462e8b7e0165c5e7da3f202593 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 07 七月 2022 19:07:59 +0800 Subject: [PATCH] add 整合 springdoc-openapi-javadoc 基于代码注释生成文档 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java | 23 +++++++---------------- 1 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 475cdb7..3dedb11 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -11,9 +11,8 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysDeptService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -28,7 +27,7 @@ * @author Lion Li */ @Validated -@Api(value = "閮ㄩ棬鎺у埗鍣�", tags = {"閮ㄩ棬绠$悊"}) +@Tag(name ="閮ㄩ棬鎺у埗鍣�", description = "閮ㄩ棬绠$悊") @RequiredArgsConstructor @RestController @RequestMapping("/system/dept") @@ -39,7 +38,6 @@ /** * 鑾峰彇閮ㄩ棬鍒楄〃 */ - @ApiOperation("鑾峰彇閮ㄩ棬鍒楄〃") @SaCheckPermission("system:dept:list") @GetMapping("/list") public R<List<SysDept>> list(SysDept dept) { @@ -50,10 +48,9 @@ /** * 鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級 */ - @ApiOperation("鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級") @SaCheckPermission("system:dept:list") @GetMapping("/list/exclude/{deptId}") - public R<List<SysDept>> excludeChild(@ApiParam("閮ㄩ棬ID") @PathVariable(value = "deptId", required = false) Long deptId) { + public R<List<SysDept>> excludeChild(@Parameter(name = "閮ㄩ棬ID") @PathVariable(value = "deptId", required = false) Long deptId) { List<SysDept> depts = deptService.selectDeptList(new SysDept()); depts.removeIf(d -> d.getDeptId().equals(deptId) || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); @@ -63,10 +60,9 @@ /** * 鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅 */ - @ApiOperation("鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅") @SaCheckPermission("system:dept:query") @GetMapping(value = "/{deptId}") - public R<SysDept> getInfo(@ApiParam("閮ㄩ棬ID") @PathVariable Long deptId) { + public R<SysDept> getInfo(@Parameter(name = "閮ㄩ棬ID") @PathVariable Long deptId) { deptService.checkDeptDataScope(deptId); return R.ok(deptService.selectDeptById(deptId)); } @@ -74,7 +70,6 @@ /** * 鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛� */ - @ApiOperation("鑾峰彇閮ㄩ棬涓嬫媺鏍戝垪琛�") @GetMapping("/treeselect") public R<List<Tree<Long>>> treeselect(SysDept dept) { List<SysDept> depts = deptService.selectDeptList(dept); @@ -84,9 +79,8 @@ /** * 鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍� */ - @ApiOperation("鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍�") @GetMapping(value = "/roleDeptTreeselect/{roleId}") - public R<Map<String, Object>> roleDeptTreeselect(@ApiParam("瑙掕壊ID") @PathVariable("roleId") Long roleId) { + public R<Map<String, Object>> roleDeptTreeselect(@Parameter(name = "瑙掕壊ID") @PathVariable("roleId") Long roleId) { List<SysDept> depts = deptService.selectDeptList(new SysDept()); Map<String, Object> ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); @@ -97,7 +91,6 @@ /** * 鏂板閮ㄩ棬 */ - @ApiOperation("鏂板閮ㄩ棬") @SaCheckPermission("system:dept:add") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.INSERT) @PostMapping @@ -111,7 +104,6 @@ /** * 淇敼閮ㄩ棬 */ - @ApiOperation("淇敼閮ㄩ棬") @SaCheckPermission("system:dept:edit") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.UPDATE) @PutMapping @@ -132,11 +124,10 @@ /** * 鍒犻櫎閮ㄩ棬 */ - @ApiOperation("鍒犻櫎閮ㄩ棬") @SaCheckPermission("system:dept:remove") @Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{deptId}") - public R<Void> remove(@ApiParam("閮ㄩ棬ID涓�") @PathVariable Long deptId) { + public R<Void> remove(@Parameter(name = "閮ㄩ棬ID涓�") @PathVariable Long deptId) { if (deptService.hasChildByDeptId(deptId)) { return R.fail("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄�"); } -- Gitblit v1.9.3