Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a47854c2
authored
May 18, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]新增swagger
1 parent
4ed46c84
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletions
pom.xml
src/main/java/cn/com/glsx/admin/config/WebConfig.java
src/main/java/cn/com/glsx/admin/modules/controller/ElectricFenceController.java
pom.xml
View file @
a47854c
...
@@ -73,6 +73,11 @@
...
@@ -73,6 +73,11 @@
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-swagger2
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/cn/com/glsx/admin/config/WebConfig.java
View file @
a47854c
...
@@ -4,6 +4,7 @@ import cn.com.glsx.auth.interceptor.WebRequestAuthorizeInterceptor;
...
@@ -4,6 +4,7 @@ import cn.com.glsx.auth.interceptor.WebRequestAuthorizeInterceptor;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
/**
...
@@ -22,8 +23,16 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -22,8 +23,16 @@ public class WebConfig implements WebMvcConfigurer {
//3.所有的preHandle 执行完再执行全部postHandle 最后是postHandle
//3.所有的preHandle 执行完再执行全部postHandle 最后是postHandle
registry
.
addInterceptor
(
authInterceptor
).
addPathPatterns
(
"/**"
)
registry
.
addInterceptor
(
authInterceptor
).
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"swagger-ui.html"
)
.
excludePathPatterns
(
"/actuator/**"
)
.
excludePathPatterns
(
"/actuator/**"
)
.
excludePathPatterns
(
"/api/**"
);
.
excludePathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/swagger-ui.html/**"
);
}
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"swagger-ui.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
}
}
}
}
src/main/java/cn/com/glsx/admin/modules/controller/ElectricFenceController.java
View file @
a47854c
...
@@ -3,6 +3,8 @@ package cn.com.glsx.admin.modules.controller;
...
@@ -3,6 +3,8 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.ElectricFenceBO
;
import
cn.com.glsx.admin.modules.model.ElectricFenceBO
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
value
=
"/fence"
)
@RequestMapping
(
value
=
"/fence"
)
@Api
(
value
=
"围栏管理"
,
tags
=
{
"围栏管理"
})
public
class
ElectricFenceController
{
public
class
ElectricFenceController
{
/**
/**
...
@@ -20,6 +23,7 @@ public class ElectricFenceController {
...
@@ -20,6 +23,7 @@ public class ElectricFenceController {
*/
*/
@SysLog
(
"新增围栏"
)
@SysLog
(
"新增围栏"
)
@PostMapping
(
value
=
"/add"
)
@PostMapping
(
value
=
"/add"
)
@ApiOperation
(
value
=
"新增围栏"
)
public
R
add
(
@RequestBody
@Validated
ElectricFenceBO
fenceBO
)
{
public
R
add
(
@RequestBody
@Validated
ElectricFenceBO
fenceBO
)
{
return
R
.
ok
();
return
R
.
ok
();
...
@@ -33,6 +37,7 @@ public class ElectricFenceController {
...
@@ -33,6 +37,7 @@ public class ElectricFenceController {
*/
*/
@SysLog
(
"编辑围栏"
)
@SysLog
(
"编辑围栏"
)
@PostMapping
(
value
=
"/edit"
)
@PostMapping
(
value
=
"/edit"
)
@ApiOperation
(
value
=
"编辑围栏"
)
public
R
edit
(
@RequestBody
@Validated
ElectricFenceBO
fenceBO
)
{
public
R
edit
(
@RequestBody
@Validated
ElectricFenceBO
fenceBO
)
{
return
R
.
ok
();
return
R
.
ok
();
}
}
...
@@ -44,6 +49,7 @@ public class ElectricFenceController {
...
@@ -44,6 +49,7 @@ public class ElectricFenceController {
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/info"
)
@GetMapping
(
value
=
"/info"
)
@ApiOperation
(
value
=
"查看围栏详情"
)
public
R
info
(
@RequestParam
(
"fenceId"
)
Long
fenceId
)
{
public
R
info
(
@RequestParam
(
"fenceId"
)
Long
fenceId
)
{
return
R
.
ok
();
return
R
.
ok
();
...
@@ -57,6 +63,7 @@ public class ElectricFenceController {
...
@@ -57,6 +63,7 @@ public class ElectricFenceController {
*/
*/
@SysLog
(
"删除围栏"
)
@SysLog
(
"删除围栏"
)
@GetMapping
(
value
=
"/delete"
)
@GetMapping
(
value
=
"/delete"
)
@ApiOperation
(
value
=
"删除围栏"
)
public
R
delete
(
@RequestParam
(
"fenceId"
)
Long
fenceId
)
{
public
R
delete
(
@RequestParam
(
"fenceId"
)
Long
fenceId
)
{
return
R
.
ok
();
return
R
.
ok
();
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment