完善ip黑名单

This commit is contained in:
2024-08-08 15:03:09 +08:00
parent 59a2f3174b
commit 1f860b01bc
2 changed files with 10 additions and 1 deletions

View File

@@ -13,6 +13,8 @@ import lombok.Data;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Type;
import java.time.LocalDateTime;
@Data
@Entity
public class IpListEntity extends CommonEntity {
@@ -28,4 +30,11 @@ public class IpListEntity extends CommonEntity {
@Comment("地址类型 0:黑名单 1:白名单")
private String addressType;
@Comment("开始时间")
private LocalDateTime startTime;
@Comment("结束时间")
private LocalDateTime endTime;
}

View File

@@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface IpListRepository extends BaseRepository<IpListEntity> {
@Query(value = "select address_type from t_ip_list where address >>= cast(?1 as inet) order by address_type limit 1 ", nativeQuery = true)
@Query(value = "select address_type from t_ip_list where address >>= cast(?1 as inet) order by address_type desc limit 1 ", nativeQuery = true)
String getAddressType(String address);
}