diff --git a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/core/SaTokenDaoRedisImpl.java b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/core/SaTokenDaoRedisImpl.java index 69dad209..a3a2e7e3 100644 --- a/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/core/SaTokenDaoRedisImpl.java +++ b/continew-starter-auth/continew-starter-auth-satoken/src/main/java/top/charles7c/continew/starter/auth/satoken/core/SaTokenDaoRedisImpl.java @@ -77,10 +77,8 @@ public void updateTimeout(String key, long timeout) { // 判断是否想要设置为永久 if (timeout == SaTokenDao.NEVER_EXPIRE) { long expire = getTimeout(key); - if (expire == SaTokenDao.NEVER_EXPIRE) { - // 如果其已经被设置为永久,则不作任何处理 - } else { - // 如果尚未被设置为永久,那么再次 set 一次 + // 如果其已经被设置为永久,则不作任何处理。如果尚未被设置为永久,那么再次 set 一次 + if (expire != SaTokenDao.NEVER_EXPIRE) { this.set(key, this.get(key), timeout); } return; @@ -123,8 +121,7 @@ public void deleteObject(String key) { @Override public long getObjectTimeout(String key) { - long timeout = RedisUtils.getTimeToLive(key); - return timeout < 0 ? timeout : timeout / 1000; + return this.getTimeout(key); } @Override @@ -132,10 +129,8 @@ public void updateObjectTimeout(String key, long timeout) { // 判断是否想要设置为永久 if (timeout == SaTokenDao.NEVER_EXPIRE) { long expire = getObjectTimeout(key); - if (expire == SaTokenDao.NEVER_EXPIRE) { - // 如果其已经被设置为永久,则不作任何处理 - } else { - // 如果尚未被设置为永久,那么再次 set 一次 + // 如果其已经被设置为永久,则不作任何处理。如果尚未被设置为永久,那么再次 set 一次 + if (expire != SaTokenDao.NEVER_EXPIRE) { this.setObject(key, this.getObject(key), timeout); } return; diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseDO.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseDO.java index 2b5cd45f..eab0c8aa 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseDO.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseDO.java @@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; +import java.io.Serial; import java.io.Serializable; import java.time.LocalDateTime; @@ -33,6 +34,7 @@ @Data public class BaseDO implements Serializable { + @Serial private static final long serialVersionUID = 1L; /** diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseResp.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseResp.java index f8a43b03..d215fa0f 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseResp.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/base/BaseResp.java @@ -25,6 +25,7 @@ import lombok.Data; import top.charles7c.continew.starter.extension.crud.constant.ContainerPool; +import java.io.Serial; import java.io.Serializable; import java.time.LocalDateTime; @@ -37,6 +38,7 @@ @Data public class BaseResp implements Serializable { + @Serial private static final long serialVersionUID = 1L; /** diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java index 9d5529cc..f7f22e55 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Min; import lombok.Data; +import lombok.EqualsAndHashCode; import org.hibernate.validator.constraints.Range; import org.springdoc.core.annotations.ParameterObject; import org.springframework.data.domain.Sort; @@ -38,6 +39,7 @@ */ @Data @ParameterObject +@EqualsAndHashCode(callSuper = true) @Schema(description = "分页查询条件") public class PageQuery extends SortQuery {