访问日志追加请求映射地址记录,便于查询
This commit is contained in:
@@ -75,12 +75,10 @@
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--监控Client-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.hccake.ballcat.admin;
|
||||
|
||||
import com.hccake.ballcat.commom.log.access.annotation.EnableAccessLog;
|
||||
import com.hccake.ballcat.common.job.annotation.EnableXxlJob;
|
||||
import com.hccake.ballcat.common.swagger.annotation.EnableSwagger2Aggregator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -9,7 +10,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
/**
|
||||
* @author Hccake
|
||||
*/
|
||||
/*@EnableXxlJob*/
|
||||
@EnableXxlJob
|
||||
@EnableSwagger2Aggregator
|
||||
@EnableAccessLog
|
||||
@ServletComponentScan("com.hccake.ballcat.admin.oauth.filter")
|
||||
|
||||
@@ -56,6 +56,11 @@ public class AdminAccessLog extends Model<AdminAccessLog> {
|
||||
*/
|
||||
@ApiModelProperty(value = "请求URI")
|
||||
private String uri;
|
||||
/**
|
||||
* 请求映射地址
|
||||
*/
|
||||
@ApiModelProperty(value = "请求映射地址")
|
||||
private String matchingPattern;
|
||||
/**
|
||||
* 操作方式
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.hccake.ballcat.common.core.util.IPUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -50,6 +51,7 @@ public class AdminAccessLogHandlerServiceImpl implements AccessLogHandlerService
|
||||
.setMethod(request.getMethod())
|
||||
.setUserAgent(request.getHeader("user-agent"))
|
||||
.setUri(URLUtil.getPath(request.getRequestURI()))
|
||||
.setMatchingPattern(String.valueOf(request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)))
|
||||
.setErrorMsg(Optional.ofNullable(myThrowable).map(Throwable::getMessage).orElse(null))
|
||||
.setHttpStatus(response.getStatus())
|
||||
.setReqParams(JSONUtil.toJsonStr(request.getParameterMap()))
|
||||
|
||||
@@ -39,8 +39,9 @@ public class SysPermissionController {
|
||||
*
|
||||
* @return 当前用户的路由
|
||||
*/
|
||||
@ApiOperation(value = "动态路由", notes = "动态路由")
|
||||
@GetMapping("/router")
|
||||
public R getUserPermission() {
|
||||
public R<List<Router>> getUserPermission() {
|
||||
|
||||
//获取角色ID
|
||||
SysUserDetails sysUserDetails = SecurityUtils.getSysUserDetails();
|
||||
|
||||
@@ -45,7 +45,7 @@ xxl:
|
||||
admin:
|
||||
addresses: http://ballcat-job:8888/xxl-job-admin # xxl-job-admin 接口地址
|
||||
executor:
|
||||
port: 7888 #通讯端口
|
||||
port: 8081 #通讯端口
|
||||
appName: ballcat-admin-job
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.hccake.ballcat.admin.test;
|
||||
|
||||
import com.hccake.ballcat.admin.modules.sys.service.SysRoleService;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysRole;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
@@ -13,14 +14,16 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
@SpringBootTest
|
||||
public class TestUpdate {
|
||||
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
|
||||
public void test() {
|
||||
|
||||
Wrapper<SysRole> wrapper = Wrappers.query();
|
||||
System.out.println(wrapper.getSqlSelect());
|
||||
System.out.println(wrapper.getCustomSqlSegment());
|
||||
System.out.println(wrapper.getExpression().getSqlSegment());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user