feat: 公众号开发
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.starry.admin.common.aspect;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: huchuansai
|
||||
* @Date: 2023/8/2 4:38 PM
|
||||
* @Description:
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class MybatisAspectj {
|
||||
|
||||
// 配置织入点
|
||||
@Pointcut("execution(public * com.baomidou.mybatisplus.core.mapper.BaseMapper.selectOne(..))")
|
||||
public void selectOneAspect() {
|
||||
}
|
||||
|
||||
@Before("selectOneAspect()")
|
||||
public void beforeSelect(JoinPoint point) {
|
||||
Object arg = point.getArgs()[0];
|
||||
if (arg instanceof AbstractWrapper) {
|
||||
arg = (AbstractWrapper) arg;
|
||||
((AbstractWrapper) arg).last("limit 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class GlobalExceptionHandler {
|
||||
public R handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
||||
String requestUrl = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生未知异常.", requestUrl, e);
|
||||
return R.error("系统发生未知异常,请联系管理员");
|
||||
return R.error(e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/v2/api-docs/**"
|
||||
).permitAll()
|
||||
// 对登录注册要允许匿名访问
|
||||
.antMatchers("/login", "/captcha/get-captcha").permitAll()
|
||||
.antMatchers("/login", "/captcha/get-captcha", "/wx/test/**").permitAll()
|
||||
// 跨域请求会先进行一次options请求
|
||||
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||
.anyRequest()// 除上面外的所有请求全部需要鉴权认证
|
||||
|
||||
Reference in New Issue
Block a user