XuqmGroup-Server/push-service/src/main/java/com/xuqm/push/entity/DeviceTokenEntity.java

112 行
3.4 KiB
Java

2026-04-21 22:07:29 +08:00
package com.xuqm.push.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import java.time.LocalDateTime;
@Entity
@Table(name = "push_device_token",
uniqueConstraints = @UniqueConstraint(columnNames = {"appKey", "userId", "deviceId"}))
2026-04-21 22:07:29 +08:00
public class DeviceTokenEntity {
public enum Vendor {
HUAWEI, XIAOMI, OPPO, VIVO, HONOR, HARMONY, APNS
}
2026-04-21 22:07:29 +08:00
@Id
private String id;
@Column(nullable = false, length = 64)
private String appKey;
2026-04-21 22:07:29 +08:00
@Column(nullable = false, length = 128)
private String userId;
@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 16)
private Vendor vendor;
@Column(nullable = false, length = 512)
private String token;
@Column(length = 32)
private String platform;
@Column(length = 128)
private String deviceId;
@Column(length = 64)
private String brand;
@Column(length = 128)
private String model;
@Column(length = 64)
private String osVersion;
@Column(length = 64)
private String appVersion;
@Column(nullable = false)
private boolean receivePush = true;
@Column
private LocalDateTime lastLoginAt;
2026-04-21 22:07:29 +08:00
@Column(nullable = false)
private LocalDateTime createdAt;
@Column(nullable = false)
private LocalDateTime updatedAt;
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getAppKey() { return appKey; }
public void setAppKey(String appKey) { this.appKey = appKey; }
2026-04-21 22:07:29 +08:00
public String getUserId() { return userId; }
public void setUserId(String userId) { this.userId = userId; }
public Vendor getVendor() { return vendor; }
public void setVendor(Vendor vendor) { this.vendor = vendor; }
public String getToken() { return token; }
public void setToken(String token) { this.token = token; }
public String getPlatform() { return platform; }
public void setPlatform(String platform) { this.platform = platform; }
public String getDeviceId() { return deviceId; }
public void setDeviceId(String deviceId) { this.deviceId = deviceId; }
public String getBrand() { return brand; }
public void setBrand(String brand) { this.brand = brand; }
public String getModel() { return model; }
public void setModel(String model) { this.model = model; }
public String getOsVersion() { return osVersion; }
public void setOsVersion(String osVersion) { this.osVersion = osVersion; }
public String getAppVersion() { return appVersion; }
public void setAppVersion(String appVersion) { this.appVersion = appVersion; }
public boolean isReceivePush() { return receivePush; }
public void setReceivePush(boolean receivePush) { this.receivePush = receivePush; }
public LocalDateTime getLastLoginAt() { return lastLoginAt; }
public void setLastLoginAt(LocalDateTime lastLoginAt) { this.lastLoginAt = lastLoginAt; }
2026-04-21 22:07:29 +08:00
public LocalDateTime getCreatedAt() { return createdAt; }
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
public LocalDateTime getUpdatedAt() { return updatedAt; }
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
}