merge
This commit is contained in:
@@ -3,14 +3,20 @@ package com.xwbing.configuration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明: swagger配置
|
||||
* 项目名称: boot-module-demo
|
||||
@@ -22,6 +28,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public Docket sysDocket() {
|
||||
ParameterBuilder ticketPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
ticketPar.name("token").description("令牌")
|
||||
.modelRef(new ModelRef("string")).parameterType("header")
|
||||
.required(false).build(); //header中的ticket参数非必填,传空也可以
|
||||
pars.add(ticketPar.build());
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("system")
|
||||
.apiInfo(sysApiInf())
|
||||
@@ -43,6 +55,12 @@ public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public Docket otherDocket() {
|
||||
ParameterBuilder ticketPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
ticketPar.name("token").description("令牌")
|
||||
.modelRef(new ModelRef("string")).parameterType("header")
|
||||
.required(false).build(); //header中的ticket参数非必填,传空也可以
|
||||
pars.add(ticketPar.build());
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("other")
|
||||
.apiInfo(otherApiInf())
|
||||
|
||||
@@ -38,12 +38,6 @@ public class SysConfigControl {
|
||||
|
||||
@LogInfo("新增系统配置信息")
|
||||
@ApiOperation(value = "新增", notes = "新增系统配置信息", response = RestMessageVo.class)
|
||||
// @ApiImplicitParams({
|
||||
// @ApiImplicitParam(name = "code", value = "配置项的key,长度为1-50", paramType = "query", required = true, dataType = "string"),
|
||||
// @ApiImplicitParam(name = "value", value = "配置项的值", paramType = "query", required = true, dataType = "string"),
|
||||
// @ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", required = true, dataType = "string"),
|
||||
// @ApiImplicitParam(name = "name", value = "配置名称,长度为1-10", paramType = "query", required = true, dataType = "string")
|
||||
// })
|
||||
@PostMapping("save")
|
||||
public JSONObject save(@RequestBody @Valid SysConfig sysConfig) {
|
||||
String logMsg = "新增系统配置信息";
|
||||
@@ -54,7 +48,6 @@ public class SysConfigControl {
|
||||
|
||||
@LogInfo("根据code删除系统配置信息")
|
||||
@ApiOperation(value = "删除", notes = "根据code删除系统配置信息", response = RestMessageVo.class)
|
||||
@ApiImplicitParam(name = "code", value = "配置项的code", paramType = "query", required = true, dataType = "string")
|
||||
@GetMapping("removeByCode")
|
||||
public JSONObject removeByCode(@RequestParam String code) {
|
||||
String logMsg = "删除系统配置信息";
|
||||
@@ -86,7 +79,6 @@ public class SysConfigControl {
|
||||
|
||||
@LogInfo("根据key查找系统配置信息")
|
||||
@ApiOperation(value = "查找", notes = "根据key查找系统配置信息", response = SysConfigVo.class)
|
||||
@ApiImplicitParam(name = "code", value = "配置项的code", paramType = "query", required = true, dataType = "string")
|
||||
@GetMapping("getByCode")
|
||||
public JSONObject getByCode(@RequestParam String code) {
|
||||
String logMsg = "根据code查找系统配置信息";
|
||||
@@ -103,7 +95,6 @@ public class SysConfigControl {
|
||||
|
||||
@LogInfo("根据是否启用查找配置列表")
|
||||
@ApiOperation(value = "查找列表", notes = "根据是否启用查找配置列表", response = ListSysConfigVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", required = true, dataType = "string")
|
||||
@GetMapping("listByEnable")
|
||||
public JSONObject listByEnable(@RequestParam String enable) {
|
||||
String logMsg = "根据是否启用查找配置列表";
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LoginInterceptor extends HandlerInterceptorAdapter {
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String servletPath = request.getServletPath();
|
||||
if (!set.contains(servletPath) && !servletPath.contains("login") && !servletPath.contains("test")) {
|
||||
String token = request.getParameter("token");
|
||||
String token = request.getHeader("token");
|
||||
if (token != null && CommonDataUtil.getToken(token)!=null) {
|
||||
ThreadLocalUtil.setToken(token);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user