最新代码
This commit is contained in:
@@ -3,6 +3,7 @@ package com.starry.common.domain;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -36,10 +37,13 @@ public class BaseEntity<T> implements Serializable {
|
||||
private String createdBy;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createdTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updatedTime;
|
||||
@@ -52,7 +56,6 @@ public class BaseEntity<T> implements Serializable {
|
||||
@ApiModelProperty(value = "数据版本")
|
||||
private Long version;
|
||||
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.starry.common.redis;
|
||||
|
||||
import org.springframework.dao.QueryTimeoutException;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -26,7 +27,12 @@ public class RedisCache {
|
||||
*/
|
||||
public <T> T getCacheObject(final String key) {
|
||||
ValueOperations<String, Object> operations = redisTemplate.opsForValue();
|
||||
return (T) operations.get(key);
|
||||
try {
|
||||
return (T) operations.get(key);
|
||||
} catch (QueryTimeoutException e) {
|
||||
throw new RuntimeException("系统错误,通讯异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user