feat: 添加注解元数据
This commit is contained in:
parent
73891dca70
commit
9be28a426b
@ -1,6 +1,7 @@
|
||||
package dev.flyfish.framework.domain.base;
|
||||
|
||||
import dev.flyfish.framework.annotations.Property;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
@ -38,12 +39,14 @@ public abstract class AuditDomain extends Domain {
|
||||
*/
|
||||
@CreatedBy
|
||||
@Property(value = "创建人", readonly = true)
|
||||
@Size(max = 100)
|
||||
protected String creator;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@Property(column = "creator_id", readonly = true)
|
||||
@Size(max = 36)
|
||||
protected String creatorId;
|
||||
|
||||
/**
|
||||
@ -51,11 +54,13 @@ public abstract class AuditDomain extends Domain {
|
||||
*/
|
||||
@LastModifiedBy
|
||||
@Property(value = "更新人", readonly = true)
|
||||
@Size(max = 100)
|
||||
protected String modifier;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@Property(column = "modifier_id", readonly = true)
|
||||
@Size(max = 36)
|
||||
protected String modifierId;
|
||||
}
|
||||
|
@ -6,18 +6,21 @@ import dev.flyfish.framework.annotations.Property;
|
||||
import dev.flyfish.framework.validation.groups.CodeValid;
|
||||
import dev.flyfish.framework.validation.groups.NameValid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class Domain implements Po, Named, Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8288256526019424379L;
|
||||
|
||||
/**
|
||||
@ -35,6 +38,7 @@ public abstract class Domain implements Po, Named, Serializable {
|
||||
@Property(title = "编码", inherited = true)
|
||||
@NotBlank(message = "编码不可为空", groups = CodeValid.class)
|
||||
@Generation(Generation.Strategy.CODE)
|
||||
@Size(max = 32)
|
||||
protected String code;
|
||||
|
||||
/**
|
||||
@ -43,6 +47,7 @@ public abstract class Domain implements Po, Named, Serializable {
|
||||
@Property(title = "名称", inherited = true)
|
||||
@NotBlank(message = "名称不可为空", groups = NameValid.class)
|
||||
@Generation(Generation.Strategy.NAME)
|
||||
@Size(max = 100)
|
||||
protected String name;
|
||||
|
||||
/**
|
||||
@ -66,8 +71,7 @@ public abstract class Domain implements Po, Named, Serializable {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj instanceof Domain) {
|
||||
Domain comparing = (Domain) obj;
|
||||
if (obj instanceof Domain comparing) {
|
||||
if (this.getId() == null || comparing.getId() == null) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user