当前位置: 首页> 科技> 互联网 > 阿里云个人网站备案_广州白云区有什么好玩的_企业培训十大热门课程_英语seo

阿里云个人网站备案_广州白云区有什么好玩的_企业培训十大热门课程_英语seo

时间:2025/7/9 18:57:50来源:https://blog.csdn.net/qq56477643/article/details/142787291 浏览次数:0次
阿里云个人网站备案_广州白云区有什么好玩的_企业培训十大热门课程_英语seo

Interceptor

@Slf4j
@Component
public class XxxxInterceptor implements HandlerInterceptor {@Override@SneakyThrowspublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {.... throw new DefineException("xxxxx....");.... 			request.setAttribute("userInfo",userInfo);return true;}

Aspect

@Aspect
@Component
@Slf4j
@Order(2)
public class DataLimitAspect {@Autowiredprivate XxxxService xxxService;@Pointcut("@annotation(xxx.annotation.DataLimit)")public void dataLimitPointcut() {}@Before("dataLimitPointcut()")public void before(JoinPoint joinPoint) {ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();HttpServletRequest request = attributes.getRequest();UserDTO userInfo = (UserDTO)request.getAttribute("userInfo");....DataLimit annotation = method.getAnnotation(DataLimit.class);if (annotation.idOnly()) {request.setAttribute("id",id);return;}....for (Object arg : joinPoint.getArgs()) {if (arg instanceof String){ functionAaa((String) arg ,id);}}....}void functionAaa(String str ,Integer id){....	xxxService.count()...};
}                        

GET请求

    @DataLimit@GetMapping("/xxx")@ApiOperation("...")public AjaxResult getXxxx(@RequestParam String str , HttpServletRequest request ) {Object idObj = request.getAttribute("id");if (null!=idObj) {...}}

POST请求

    @DataLimit@PostMapping("/xxx")@ApiOperation("...")public AjaxResult postXxxx(@RequestPart("file") MultipartFile file, @RequestAttribute("userInfo") UserDTO userInfo , HttpServletRequest request ) {Object idObj = request.getAttribute("id");if (null!=idObj) {...}}
关键字:阿里云个人网站备案_广州白云区有什么好玩的_企业培训十大热门课程_英语seo

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: