mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
refactor(SubmitTokenRepository): 添加 @Modifying 注解
- 在 SubmitTokenRepository 接口中,为 expireAll 方法添加了 @Modifying 注解 - 这个改动确保了修改数据库的操作被正确处理,提高了代码的健壮性和可维护性
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.lihongjie.coal.submitToken.entity.SubmitTokenEntity;
|
||||
import jakarta.persistence.LockModeType;
|
||||
|
||||
import org.springframework.data.jpa.repository.Lock;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -18,6 +19,7 @@ public interface SubmitTokenRepository extends BaseRepository<SubmitTokenEntity>
|
||||
@Query("select t from SubmitTokenEntity t where t.id = :token")
|
||||
Optional<SubmitTokenEntity> findByIdLocked(String token);
|
||||
|
||||
@Modifying
|
||||
@Query("delete from SubmitTokenEntity t where t.createTime < :expireTime")
|
||||
Integer expireAll(LocalDateTime expireTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user