Skip to content

Commit

Permalink
去除实时控制台功能,查询方式修改成注解方式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjie committed Jun 4, 2019
1 parent e6c23f8 commit 7eba964
Show file tree
Hide file tree
Showing 76 changed files with 707 additions and 1,912 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.zhengjie.aop.limit;
package me.zhengjie.annotation;

import me.zhengjie.aspect.LimitType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,32 @@
import java.lang.annotation.Target;

/**
* @描述 : 为生成{@link javax.persistence.criteria.Predicate }提供的注解
* @作者 : Dong ZhaoYang
* @日期 : 2017/08/07
* @时间 : 16:25
* @author jie
* @date 2019-6-4 13:52:30
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PredicateInfo {
public @interface Query {

/** Dong ZhaoYang 2017/8/7 基本对象的属性名 */
String propName() default "";
/** Dong ZhaoYang 2017/8/7 查询方式 */
QueryType queryType() default QueryType.BASIC;
Type type() default Type.EQUAL;

enum QueryType {
/** Dong ZhaoYang 2017/8/7 基本 */
BASIC
/**
* 连接查询的属性名,如User类中的dept
* @return
*/
String joinName() default "";

/**
* 默认左连接
* @return
*/
Join join() default Join.LEFT;

enum Type {
EQUAL
/** Dong ZhaoYang 2017/8/7 大于等于 */
, GREATER_THAN
/** Dong ZhaoYang 2017/8/7 小于等于 */
Expand All @@ -35,6 +44,19 @@ enum QueryType {
, RIGHT_LIKE
/** Dong ZhaoYang 2017/8/7 小于 */
, LESS_THAN_NQ
//** jie 2019/6/4 包含 */
, IN
}

/**
* @author jie
* 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询
*/
enum Join {
/** jie 2019-6-4 13:18:30 左连接 */
LEFT
/** jie 2019-6-4 13:18:30 右连接 */
, RIGHT
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.zhengjie.aspect;

import com.google.common.collect.ImmutableList;
import me.zhengjie.aop.limit.Limit;
import me.zhengjie.annotation.Limit;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.utils.RequestHolder;
import me.zhengjie.utils.StringUtils;
Expand All @@ -28,7 +28,7 @@ public class LimitAspect {
private static final Logger logger = LoggerFactory.getLogger(LimitAspect.class);


@Pointcut("@annotation(me.zhengjie.aop.limit.Limit)")
@Pointcut("@annotation(me.zhengjie.annotation.Limit)")
public void pointcut() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public KeyGenerator keyGenerator() {
sb.append(target.getClass().getName());
sb.append(method.getName());
for (Object obj : params) {
// 由于参数可能不同, hashCode肯定不一样, 缓存的key也需要不一样
sb.append(JSON.toJSONString(obj).hashCode());
}
return sb.toString();
Expand Down
Loading

0 comments on commit 7eba964

Please sign in to comment.