package com.estate.expert.admin.domain.common;
|
|
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModelProperty;
|
import lombok.Builder;
|
import lombok.Value;
|
|
@ApiModel("实体引用")
|
@Value
|
@Builder
|
public class EntityRef {
|
|
@ApiModelProperty("实体ID")
|
Integer id;
|
|
@ApiModelProperty("用户名")
|
String name;
|
|
@ApiModelProperty(value = "额外信息", notes = "对于部分实体,可能需要额外信息,如模型需要版本号等")
|
Object info;
|
|
public static EntityRef of(Integer id) {
|
return EntityRef.builder().id(id).build();
|
}
|
|
public static EntityRef of(Integer id, String name) {
|
return EntityRef.builder().id(id).name(name).build();
|
}
|
|
public static EntityRef of(Integer id, String name, Object info) {
|
return EntityRef.builder().id(id).name(name).info(info).build();
|
}
|
}
|