Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebaeb1ac56 | ||
|
|
45124eba81 | ||
|
|
4cd0b2338d | ||
|
|
35fa531be9 | ||
|
|
b690656848 | ||
|
|
6e5f33f641 | ||
|
|
53b8c4c23f | ||
|
|
f8beb03362 | ||
|
|
f5528fbfad | ||
|
|
90c97f211b | ||
|
|
42dee2e4ad | ||
|
|
66eb6108cd | ||
|
|
82f950e71d | ||
|
|
cceabb0c8d | ||
|
|
62de8e4885 | ||
|
|
9f7460e959 | ||
|
|
90d4c5e5f6 |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.spring</groupId>
|
<groupId>com.imyeyu.spring</groupId>
|
||||||
<artifactId>timi-spring</artifactId>
|
<artifactId>timi-spring</artifactId>
|
||||||
<version>0.0.19</version>
|
<version>0.0.17</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.lang.annotation.Target;
|
|||||||
/**
|
/**
|
||||||
* 应用在 Controller 的接口上
|
* 应用在 Controller 的接口上
|
||||||
*
|
*
|
||||||
* <p>{@link #inSeconds()} 生命周期内(秒)限制访问 {@link #value()} 次
|
* <p>{@link #lifeCycle()} 生命周期内(秒)限制访问 {@link #value()} 次
|
||||||
*
|
*
|
||||||
* @author 夜雨
|
* @author 夜雨
|
||||||
* @version 2021-08-16 17:57
|
* @version 2021-08-16 17:57
|
||||||
@@ -32,5 +32,5 @@ public @interface RequestRateLimit {
|
|||||||
*
|
*
|
||||||
* @return 生命周期秒数
|
* @return 生命周期秒数
|
||||||
*/
|
*/
|
||||||
int inSeconds() default 10;
|
int lifeCycle() default 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class RequestRateLimitAbstractInterceptor implements HandlerInte
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 频率限制
|
// 频率限制
|
||||||
return beforeRun(req, resp, buildId(handlerMethod), requestRateLimit.inSeconds(), requestRateLimit.value());
|
return beforeRun(req, resp, buildId(handlerMethod), requestRateLimit.lifeCycle(), requestRateLimit.value());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,34 @@ public class Page<T> extends BasePage {
|
|||||||
/** 排序字段映射 */
|
/** 排序字段映射 */
|
||||||
protected LinkedHashMap<String, BaseMapper.OrderType> orderMap;
|
protected LinkedHashMap<String, BaseMapper.OrderType> orderMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建分页参数
|
||||||
|
*
|
||||||
|
* @param index 页码
|
||||||
|
* @param size 每页数量
|
||||||
|
*/
|
||||||
|
public Page(int index, int size) {
|
||||||
|
super(index, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取偏移量
|
||||||
|
*
|
||||||
|
* @return 偏移量
|
||||||
|
*/
|
||||||
|
public long getOffset() {
|
||||||
|
return (long) index * size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取限制数量
|
||||||
|
*
|
||||||
|
* @return 限制数量
|
||||||
|
*/
|
||||||
|
public long getLimit() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加排序字段
|
* 添加排序字段
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.imyeyu.java.TimiJava;
|
|||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.config.AbstractRedisConfig;
|
import com.imyeyu.spring.config.AbstractRedisConfig;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.data.redis.connection.RedisConnection;
|
import org.springframework.data.redis.connection.RedisConnection;
|
||||||
import org.springframework.data.redis.core.Cursor;
|
import org.springframework.data.redis.core.Cursor;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
@@ -28,6 +30,8 @@ import java.util.function.Consumer;
|
|||||||
* @author 夜雨
|
* @author 夜雨
|
||||||
* @version 2021-11-21 09:58
|
* @version 2021-11-21 09:58
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Redis<K, V> {
|
public class Redis<K, V> {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user