|
@@ -1,73 +0,0 @@
|
|
|
-package com.persagy.apm.dmpalarm.config;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-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;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.ISqlSegment;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.segments.NormalSegmentList;
|
|
|
-import com.persagy.apm.dmpalarm.model.AlarmRecord;
|
|
|
-
|
|
|
-@Aspect
|
|
|
-@Component
|
|
|
-public class TableNameAspect {
|
|
|
- @Pointcut("execution( * com.baomidou.mybatisplus.core.mapper.BaseMapper.*(..)) || "
|
|
|
- + " execution( * com.persagy.apm.dmpalarm.service.impl.BaseServiceImpl.*(..))")
|
|
|
- public void point() {
|
|
|
- System.out.println(12345);
|
|
|
- }
|
|
|
-
|
|
|
- @Before("point()")
|
|
|
- public void doBefore(JoinPoint joinPoint) {
|
|
|
-// for (Object args : joinPoint.getArgs()) {
|
|
|
-// if(args instanceof QueryWrapper) {
|
|
|
-// QueryWrapper<?> queryWrapper = (QueryWrapper<?>)args;
|
|
|
-// NormalSegmentList normal = queryWrapper.getExpression().getNormal();
|
|
|
-// Map<String,String> map=new HashMap<>();
|
|
|
-// int i=1;
|
|
|
-// String key="";
|
|
|
-// for (ISqlSegment iSqlSegment : normal) {
|
|
|
-// if(i==1) {
|
|
|
-// key=iSqlSegment.getSqlSegment();
|
|
|
-// map.put(iSqlSegment.getSqlSegment(), null);
|
|
|
-// }
|
|
|
-// if(i==3) {
|
|
|
-// iSqlSegment.getSqlSegment();
|
|
|
-// map.put(key, iSqlSegment.getSqlSegment());
|
|
|
-// i=-1;
|
|
|
-// }
|
|
|
-// i++;
|
|
|
-//
|
|
|
-// }
|
|
|
-// System.out.println(map);
|
|
|
-//// Map<String,String> map=new HashMap<>();
|
|
|
-//// String[] strs="and#<#>#!=#like#in#not#null#no".split("#");
|
|
|
-//// String sqlSegment = normal.getSqlSegment().toUpperCase().replace("AND", "");
|
|
|
-//// for (int i = 0; i < strs.length; i++) {
|
|
|
-//// sqlSegment=sqlSegment.replace(strs[i].toUpperCase(), "");
|
|
|
-//// }
|
|
|
-//// sqlSegment= sqlSegment.replace("(", "").replace(")", "").trim();
|
|
|
-//// String[] sqlSegments = sqlSegment.split(" ");
|
|
|
-//// for (String string : sqlSegments) {
|
|
|
-//// System.out.println(string.trim());
|
|
|
-//
|
|
|
-//
|
|
|
-// Map<String, Object> nap = queryWrapper.getParamNameValuePairs();
|
|
|
-// String start=(String) queryWrapper.getParamNameValuePairs().get(AlarmRecord.PROP_EFFECT_START_TIME);
|
|
|
-// String end=(String) queryWrapper.getParamNameValuePairs().get(AlarmRecord.PROP_EFFECT_END_TIME);
|
|
|
-// System.out.println(start);
|
|
|
-// System.out.println(end);
|
|
|
-//
|
|
|
-// }else if(args instanceof AlarmRecord) {
|
|
|
-// System.out.println(args);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
- }
|
|
|
-}
|