代码修改

This commit is contained in:
keivn
2021-12-26 14:17:28 +08:00
parent 506ca3760b
commit bdac2c81c0
28 changed files with 546 additions and 71 deletions

View File

@ -37,6 +37,14 @@
<version>1.6.2</version>
</dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
@ -61,6 +69,7 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!--添加小程序模块的依赖-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruiyi-carpool</artifactId>

View File

@ -2,11 +2,12 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Set;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.context.annotation.Description;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
@ -56,7 +57,10 @@ public class SysLoginController
* @return 结果
*/
@PostMapping("/weixiMiniLogin")
public AjaxResult weixiMiniLogin()
@ApiOperation(value = "carpool_01_微信小程序获取后台系统token", notes = "获取小程序accessToken")
public AjaxResult weixiMiniLogin(
@ApiParam( name = "openId",value = "微信openId",required = false) @RequestParam(value = "openId" ,required = false) String openId
)
{
AjaxResult ajax = AjaxResult.success();
// 微信小程序登入生成令牌

View File

@ -9,6 +9,7 @@ import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@ -48,7 +49,7 @@ public class SwaggerConfig
@Bean
public Docket createRestApi()
{
return new Docket(DocumentationType.OAS_30)
return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
@ -58,9 +59,9 @@ public class SwaggerConfig
// 扫描所有有注解的api用这种方式更灵活
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.carpool"))
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.carpool"))
// 扫描所有
// .apis(RequestHandlerSelectors.any())
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
/* 设置安全模式swagger可以设置访问token */