Commit 90c39a98 by renrui

[add]mybatis修改

1 parent e29b67e9
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;
}
}
......@@ -3,6 +3,7 @@ package org.arch.manage.conterller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,50 +37,16 @@ public class SysEventLogController extends BaseController {
@Resource
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 日志对象
* @return
*/
@PostMapping(value = "/")
@PostMapping(value = "/page")
@ApiOperation(value = "查询日志列表", notes = "查询日志列表")
@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) {
//@ApiOperationSupport(ignoreParameters = {"userid", "username", "ipaddr", "eventcontent", "iswarn", "lid", "usercode", "menuid", "menupath", "eventtypeN", "logtypeN", "loglevN"})
public Result<Page<SysEventLog>> getData(@RequestBody SysEventLogDTO sysEventLogDTO) {
Integer current = sysEventLogDTO.getCurrent();
Integer pageSize = sysEventLogDTO.getPageSize();
String sortType = sysEventLogDTO.getSortType();
......@@ -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){
switch (sortField){
case "eventtype":
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!