From 19bbb04fe271943850e5b0cdba1aaeed633bc83f Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 08 六月 2023 16:25:08 +0800
Subject: [PATCH] 添加swagger
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java | 128 ++++++++++++++++++++++++++++--------------
1 files changed, 84 insertions(+), 44 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
index d11cf9e..645746b 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
@@ -1,46 +1,48 @@
package com.ruoyi.web.controller.smartor;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.smartor.domain.PatArchive;
-import com.smartor.service.IPatArchiveService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.smartor.domain.PatArchive;
+import com.smartor.domain.PatUpInfoVO;
+import com.smartor.service.IPatArchiveService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
/**
* 鎮h�呮。妗圕ontroller
- *
- * @author ruoyi
- * @date 2023-02-22
+ *
+ * @author smartor
+ * @date 2023-03-04
*/
+@Api("鎮h�呮。妗�")
@RestController
-@RequestMapping("/smartor/archive")
-public class PatArchiveController extends BaseController
-{
+@RequestMapping("/smartor/patarchive")
+public class PatArchiveController extends BaseController {
@Autowired
private IPatArchiveService patArchiveService;
/**
* 鏌ヨ鎮h�呮。妗堝垪琛�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:list')")
+ @ApiOperation("鏌ヨ鎮h�呮。妗堝垪琛�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:list')")
@GetMapping("/list")
- public TableDataInfo list(PatArchive patArchive)
- {
+ public TableDataInfo list(PatArchive patArchive) {
startPage();
List<PatArchive> list = patArchiveService.selectPatArchiveList(patArchive);
return getDataTable(list);
@@ -49,11 +51,11 @@
/**
* 瀵煎嚭鎮h�呮。妗堝垪琛�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:export')")
+ @ApiOperation("瀵煎嚭鎮h�呮。妗堝垪琛�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:export')")
@Log(title = "鎮h�呮。妗�", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, PatArchive patArchive)
- {
+ public void export(HttpServletResponse response, PatArchive patArchive) {
List<PatArchive> list = patArchiveService.selectPatArchiveList(patArchive);
ExcelUtil<PatArchive> util = new ExcelUtil<PatArchive>(PatArchive.class);
util.exportExcel(response, list, "鎮h�呮。妗堟暟鎹�");
@@ -62,43 +64,81 @@
/**
* 鑾峰彇鎮h�呮。妗堣缁嗕俊鎭�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:query')")
- @GetMapping(value = "/{PatID}")
- public AjaxResult getInfo(@PathVariable("PatID") Long PatID)
- {
- return success(patArchiveService.selectPatArchiveByPatID(PatID));
+ @ApiOperation("鑾峰彇鎮h�呮。妗堣缁嗕俊鎭�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:query')")
+ @GetMapping(value = "/{patid}")
+ @ApiImplicitParam(name = "patid",value = "鎮h�卛d")
+ public AjaxResult getInfo(@PathVariable(name = "patid") Long patid) {
+ return success(patArchiveService.selectPatArchiveByPatid(patid));
}
/**
* 鏂板鎮h�呮。妗�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:add')")
+ @ApiOperation("鏂板鎮h�呮。妗�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:add')")
@Log(title = "鎮h�呮。妗�", businessType = BusinessType.INSERT)
@PostMapping
- public AjaxResult add(@RequestBody PatArchive patArchive)
- {
+ public AjaxResult add(@RequestBody PatArchive patArchive) {
return toAjax(patArchiveService.insertPatArchive(patArchive));
}
/**
* 淇敼鎮h�呮。妗�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:edit')")
+ @ApiOperation("淇敼鎮h�呮。妗�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:edit')")
@Log(title = "鎮h�呮。妗�", businessType = BusinessType.UPDATE)
@PutMapping
- public AjaxResult edit(@RequestBody PatArchive patArchive)
- {
+ public AjaxResult edit(@RequestBody PatArchive patArchive) {
return toAjax(patArchiveService.updatePatArchive(patArchive));
}
/**
* 鍒犻櫎鎮h�呮。妗�
*/
- @PreAuthorize("@ss.hasPermi('smartor:archive:remove')")
+ @ApiOperation("鍒犻櫎鎮h�呮。妗�")
+ @PreAuthorize("@ss.hasPermi('smartor:patarchive:remove')")
@Log(title = "鎮h�呮。妗�", businessType = BusinessType.DELETE)
- @DeleteMapping("/{PatIDs}")
- public AjaxResult remove(@PathVariable Long[] PatIDs)
- {
- return toAjax(patArchiveService.deletePatArchiveByPatIDs(PatIDs));
+ @DeleteMapping("/{patids}")
+ @ApiImplicitParam(name = "patids",value = "鎮h�卛d闆嗗悎", dataType = "long", dataTypeClass = Long.class)
+ public AjaxResult remove(@PathVariable Long[] patids) {
+ return toAjax(patArchiveService.deletePatArchiveByPatids(patids));
}
+
+
+ /**
+ * 瀵煎叆鎮h�呮枃浠跺鐞�
+ *
+ * @param multipartFile
+ */
+ @ApiOperation("瀵煎叆鎮h�呮枃浠跺鐞�")
+ @PostMapping("/importFilehandle")
+
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "tags", value = "鏍囩"),
+ @ApiImplicitParam(name = "multipartFile", value = "涓婁紶鏂囦欢")
+ })
+ public AjaxResult importFilehandle(@RequestParam("tags") String tags, @RequestParam("multipartFile") MultipartFile multipartFile) {
+ //鑾峰彇褰撳墠鐧婚檰浜�
+ LoginUser loginUser = getLoginUser();
+ SysUser user = loginUser.getUser();
+ PatUpInfoVO patUpInfoVO = patArchiveService.importFilehandle(user, tags, multipartFile);
+
+ return success(patUpInfoVO);
+ }
+
+ /**
+ * 瀵煎嚭鎮h�呴敊璇俊鎭�
+ *
+ * @param patArchiveList
+ */
+ @ApiOperation("瀵煎嚭鎮h�呴敊璇俊鎭�")
+ @PostMapping("/exportErrPatInfo")
+ public AjaxResult exportErrPatInfo(@RequestBody List<PatArchive> patArchiveList) {
+
+ return success(patArchiveService.exportErrPatInfo(patArchiveList));
+ }
+
+
}
--
Gitblit v1.9.3