|
|
@@ -0,0 +1,119 @@
|
|
|
+package space.anyi.serve.entity.meta;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.annotation.TableId;
|
|
|
+import com.baomidou.mybatisplus.annotation.TableName;
|
|
|
+import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
|
+import jakarta.validation.constraints.Size;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 元数据表,用于存储键值对形式的配置或扩展属性
|
|
|
+ * @TableName meta
|
|
|
+ */
|
|
|
+@TableName(value ="dev.meta")
|
|
|
+@Schema(description = "元数据实体,存储键值对形式的配置")
|
|
|
+public class Meta {
|
|
|
+ public static final String WEBSITE_META_KEY = "website_config";
|
|
|
+ /**
|
|
|
+ * 自增主键,唯一标识一条元数据记录
|
|
|
+ */
|
|
|
+ @TableId
|
|
|
+ @Schema(description = "自增主键")
|
|
|
+ private Integer id;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的键,长度不超过32个字符,不可为空
|
|
|
+ */
|
|
|
+ @NotBlank(message = "元数据键不能为空")
|
|
|
+ @Size(max = 32, message = "元数据键长度不能超过32个字符")
|
|
|
+ @Schema(description = "元数据的键", maxLength = 32)
|
|
|
+ private String key;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的值,使用 JSONB 类型存储,支持结构化数据
|
|
|
+ */
|
|
|
+ @Schema(description = "元数据的值,JSONB 格式")
|
|
|
+ private Object value;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自增主键,唯一标识一条元数据记录
|
|
|
+ */
|
|
|
+ public Integer getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自增主键,唯一标识一条元数据记录
|
|
|
+ */
|
|
|
+ public void setId(Integer id) {
|
|
|
+ this.id = id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的键,长度不超过32个字符,不可为空
|
|
|
+ */
|
|
|
+ public String getKey() {
|
|
|
+ return key;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的键,长度不超过32个字符,不可为空
|
|
|
+ */
|
|
|
+ public void setKey(String key) {
|
|
|
+ this.key = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的值,使用 JSONB 类型存储,支持结构化数据
|
|
|
+ */
|
|
|
+ public Object getValue() {
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 元数据的值,使用 JSONB 类型存储,支持结构化数据
|
|
|
+ */
|
|
|
+ public void setValue(Object value) {
|
|
|
+ this.value = value;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean equals(Object that) {
|
|
|
+ if (this == that) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (that == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (getClass() != that.getClass()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Meta other = (Meta) that;
|
|
|
+ return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
|
|
+ && (this.getKey() == null ? other.getKey() == null : this.getKey().equals(other.getKey()))
|
|
|
+ && (this.getValue() == null ? other.getValue() == null : this.getValue().equals(other.getValue()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int hashCode() {
|
|
|
+ final int prime = 31;
|
|
|
+ int result = 1;
|
|
|
+ result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
|
|
+ result = prime * result + ((getKey() == null) ? 0 : getKey().hashCode());
|
|
|
+ result = prime * result + ((getValue() == null) ? 0 : getValue().hashCode());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(getClass().getSimpleName());
|
|
|
+ sb.append(" [");
|
|
|
+ sb.append("Hash = ").append(hashCode());
|
|
|
+ sb.append(", id=").append(id);
|
|
|
+ sb.append(", key=").append(key);
|
|
|
+ sb.append(", value=").append(value);
|
|
|
+ sb.append("]");
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+}
|