feat: 开发中...

This commit is contained in:
2023-04-06 08:52:04 +08:00
parent 2b507f9329
commit b5eb9b468e
15 changed files with 422 additions and 84 deletions

View File

@@ -1,9 +1,12 @@
package cn.hamster3.application.blog.entity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
@@ -24,12 +27,15 @@ public class BlogEntity {
@Column(name = "id", nullable = false, updatable = false)
private Long id;
@Length(max = 128, message = "标题长度不能超过 128 个字符!")
@Column(name = "title", nullable = false, length = 128)
private String title;
@Column(name = "abstracts", nullable = false, length = 512)
@Length(max = 1024, message = "摘要长度不能超过 1024 个字符!")
@Column(name = "abstracts", nullable = false, length = 1024)
private String abstracts;
@NotBlank(message = "博客文章内容不能为空!")
@ToString.Exclude
@Lob
@Basic(fetch = FetchType.LAZY)
@@ -42,6 +48,7 @@ public class BlogEntity {
@Column(name = "publish", nullable = false)
private Boolean publish = false;
@NotNull(message = "标签不能为 null")
@Setter
@ElementCollection
@Column(name = "tag")

View File

@@ -1,11 +1,9 @@
package cn.hamster3.application.blog.vo.blog;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import java.util.Set;
@@ -13,20 +11,16 @@ import java.util.Set;
@NoArgsConstructor
@AllArgsConstructor
public class BlogUpdateRequireVO {
@Length(max = 32, message = "标题长度不能超过 32 个字符!")
@NotBlank(message = "标题不能为空!")
private String title;
@Length(max = 512, message = "摘要长度不能超过 512 个字符!")
private String abstracts;
@NotBlank(message = "博客文章内容不能为空!")
private String content;
private Boolean top;
private Boolean publish;
@NotNull(message = "标签不能为 null")
private Set<String> tags;
}

View File

@@ -7,7 +7,7 @@ spring:
ddl-auto: update
# open-in-view: true
show-ddl: true
show-sql: true
# show-sql: true
autoconfigure:
exclude:
# - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration