Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
framework-tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 90c39a98
authored
Jul 12, 2024
by
renrui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add]mybatis修改
1 parent
e29b67e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
37 deletions
framework-system-manage/src/main/java/org/arch/manage/config/MybatisPlusConfig.java
framework-system-manage/src/main/java/org/arch/manage/conterller/SysEventLogController.java
framework-system-manage/src/main/java/org/arch/manage/config/MybatisPlusConfig.java
0 → 100644
View file @
90c39a9
package
org
.
arch
.
manage
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* MybatisPlus配置
*/
@Configuration
public
class
MybatisPlusConfig
{
/**
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
*/
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
// 添加分页插件
PaginationInnerInterceptor
pageInterceptor
=
new
PaginationInnerInterceptor
();
// 设置请求的页面大于最大页后操作,true调回到首页,false继续请求。默认false
pageInterceptor
.
setOverflow
(
false
);
// 单页分页条数限制,默认无限制
pageInterceptor
.
setMaxLimit
(
500L
);
// 设置数据库类型
pageInterceptor
.
setDbType
(
DbType
.
MYSQL
);
interceptor
.
addInnerInterceptor
(
pageInterceptor
);
return
interceptor
;
}
}
framework-system-manage/src/main/java/org/arch/manage/conterller/SysEventLogController.java
View file @
90c39a9
...
@@ -3,6 +3,7 @@ package org.arch.manage.conterller;
...
@@ -3,6 +3,7 @@ package org.arch.manage.conterller;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -36,50 +37,16 @@ public class SysEventLogController extends BaseController {
...
@@ -36,50 +37,16 @@ public class SysEventLogController extends BaseController {
@Resource
@Resource
private
SysEventLogService
sysEventLogService
;
private
SysEventLogService
sysEventLogService
;
/**
* 添加日志
*
* @param request 请求头
* @param params 请求参数
* @return 响应结果
*/
@PostMapping
(
value
=
"/addLog"
)
@ApiOperation
(
value
=
"添加日志接口"
,
notes
=
"添加日志接口"
)
@ApiOperationSupport
(
ignoreParameters
=
{
"userid"
,
"username"
,
"ipaddr"
,
"lid"
,
"eventtypeN"
,
"logtypeN"
,
"loglevN"
})
public
Result
<
Object
>
addLog
(
HttpServletRequest
request
,
@RequestBody
SysEventLog
params
)
{
sysEventLogService
.
addLog
(
request
,
params
,
getUserDto
());
return
Result
.
success
();
}
@PostMapping
(
value
=
"/getTjCount"
)
@ApiOperation
(
value
=
"日志统计"
,
notes
=
"获取审计日志总条数"
)
public
Result
<
String
>
getTjCount
()
{
long
count
=
sysEventLogService
.
count
();
return
Result
.
success
(
String
.
valueOf
(
count
));
}
@PostMapping
(
value
=
"/getCount"
)
@ApiOperation
(
value
=
"获取日志统计"
,
notes
=
"获取日志统计"
)
public
Result
<
Map
<
String
,
Object
>>
getCount
(
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
result
=
sysEventLogService
.
getCount
();
return
Result
.
success
(
result
);
}
/**
/**
* 查询日志列表
* 查询日志列表
*
*
* @param sysEventLogDTO 日志对象
* @param sysEventLogDTO 日志对象
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/"
)
@PostMapping
(
value
=
"/
page
"
)
@ApiOperation
(
value
=
"查询日志列表"
,
notes
=
"查询日志列表"
)
@ApiOperation
(
value
=
"查询日志列表"
,
notes
=
"查询日志列表"
)
@ApiOperationSupport
(
ignoreParameters
=
{
"userid"
,
"username"
,
"ipaddr"
,
"eventcontent"
,
"iswarn"
,
"lid"
,
"usercode"
,
"menuid"
,
"menupath"
,
"eventtypeN"
,
"logtypeN"
,
"loglevN"
})
//
@ApiOperationSupport(ignoreParameters = {"userid", "username", "ipaddr", "eventcontent", "iswarn", "lid", "usercode", "menuid", "menupath", "eventtypeN", "logtypeN", "loglevN"})
public
Result
<
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
<
SysEventLog
>>
getData
(
@RequestBody
SysEventLogDTO
sysEventLogDTO
)
{
public
Result
<
Page
<
SysEventLog
>>
getData
(
@RequestBody
SysEventLogDTO
sysEventLogDTO
)
{
Integer
current
=
sysEventLogDTO
.
getCurrent
();
Integer
current
=
sysEventLogDTO
.
getCurrent
();
Integer
pageSize
=
sysEventLogDTO
.
getPageSize
();
Integer
pageSize
=
sysEventLogDTO
.
getPageSize
();
String
sortType
=
sysEventLogDTO
.
getSortType
();
String
sortType
=
sysEventLogDTO
.
getSortType
();
...
@@ -111,6 +78,42 @@ public class SysEventLogController extends BaseController {
...
@@ -111,6 +78,42 @@ public class SysEventLogController extends BaseController {
}
}
/**
* 添加日志
*
* @param request 请求头
* @param params 请求参数
* @return 响应结果
*/
@PostMapping
(
value
=
"/addLog"
)
@ApiOperation
(
value
=
"添加日志接口"
,
notes
=
"添加日志接口"
)
@ApiOperationSupport
(
ignoreParameters
=
{
"userid"
,
"username"
,
"ipaddr"
,
"lid"
,
"eventtypeN"
,
"logtypeN"
,
"loglevN"
})
public
Result
<
Object
>
addLog
(
HttpServletRequest
request
,
@RequestBody
SysEventLog
params
)
{
sysEventLogService
.
addLog
(
request
,
params
,
getUserDto
());
return
Result
.
success
();
}
@PostMapping
(
value
=
"/getTjCount"
)
@ApiOperation
(
value
=
"日志统计"
,
notes
=
"获取审计日志总条数"
)
public
Result
<
String
>
getTjCount
()
{
long
count
=
sysEventLogService
.
count
();
return
Result
.
success
(
String
.
valueOf
(
count
));
}
@PostMapping
(
value
=
"/getCount"
)
@ApiOperation
(
value
=
"获取日志统计"
,
notes
=
"获取日志统计"
)
public
Result
<
Map
<
String
,
Object
>>
getCount
(
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
result
=
sysEventLogService
.
getCount
();
return
Result
.
success
(
result
);
}
private
void
getSort
(
String
sortField
,
boolean
sortType
,
QueryWrapper
<
SysEventLog
>
queryWrapper
){
private
void
getSort
(
String
sortField
,
boolean
sortType
,
QueryWrapper
<
SysEventLog
>
queryWrapper
){
switch
(
sortField
){
switch
(
sortField
){
case
"eventtype"
:
case
"eventtype"
:
...
...
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