Skip to content

Commit

Permalink
refactor: 优化部分代码
Browse files Browse the repository at this point in the history
修复 Qodana 扫描问题
  • Loading branch information
Charles7c committed Jan 27, 2024
1 parent ab1e999 commit 9c0cd2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -123,19 +121,16 @@ 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
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -33,6 +34,7 @@
@Data
public class BaseDO implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -37,6 +38,7 @@
@Data
public class BaseResp implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,6 +39,7 @@
*/
@Data
@ParameterObject
@EqualsAndHashCode(callSuper = true)
@Schema(description = "分页查询条件")
public class PageQuery extends SortQuery {

Expand Down

0 comments on commit 9c0cd2f

Please sign in to comment.