From d32b8b5c9b23b2d4e447c0ed6880cdc20857b9a4 Mon Sep 17 00:00:00 2001 From: Aug <17674666882@163.com> Date: Fri, 20 Jun 2025 11:21:46 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81shiro=E6=9D=83=E9=99=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=202=E3=80=81swagger=E6=9D=83=E9=99=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/config/shiro/ShiroConfig.java | 3 ++ .../modules/app/controller/AppController.java | 42 ++++++++++++++++++++++ .../modules/app/controller/AppController2.java | 24 +++++++++++++ .../src/main/resources/application-dev.yml | 5 +++ 4 files changed, 74 insertions(+) create mode 100644 jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java create mode 100644 jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index e2a68a9..686a6d8 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -82,6 +82,9 @@ public class ShiroConfig { } } + //小程序相关接口不会被拦截 + filterChainDefinitionMap.put("/app/**", "anon"); //小程序相关接口 + // 配置不会被拦截的链接 顺序判断 filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录 filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除 diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java new file mode 100644 index 0000000..cf17b74 --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.app.controller; + +import com.alibaba.fastjson.JSONObject; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.system.model.SysLoginModel; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +@RestController +@RequestMapping("/app/A") +@Tag(name="测试模块A") +@Slf4j +public class AppController { + + @Operation(summary = "测试接口一") + @RequestMapping(value = "/testOne", method = RequestMethod.POST) + public Result testOne(String testA){ + Result result = new Result(); + log.info("输出内容:{}", testA); + result.error500("测试失败!"); + return result; + + } + + @Operation(summary = "测试接口二") + @RequestMapping(value = "/testTwo", method = RequestMethod.POST) + public Result testTwo(String testB){ + Result result = new Result(); + log.info("输出内容:{}", testB); + result.success("测试成功"); + return result; + + } + +} diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java new file mode 100644 index 0000000..09af67b --- /dev/null +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.app.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/app/B") +@Tag(name="测试模块B") +@Slf4j +public class AppController2 { + + @Operation(summary = "测试接口一", description = "测试一相关接口") + @RequestMapping(value = "/queryBannerList", method = {RequestMethod.GET}) + public Result queryBannerList(String type){ + log.info("输出内容:{}", type); + return Result.OK("测试成功"); + } + +} diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index 7294848..64a5b8d 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -324,3 +324,8 @@ justauth: type: default prefix: 'demo::' timeout: 1h + +#swagger文档接口展示 +springdoc: + packages-to-scan: org.jeecg.modules.app.controller # 只扫描你的自定义包 +# paths-to-match: /app/** # 只匹配特定路径