v0.0.13 #13
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.DeleteColumn;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import com.imyeyu.utils.Time;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -16,15 +18,19 @@ import java.io.Serializable;
|
||||
public class BaseEntity implements Serializable, Creatable, Updatable, Deletable {
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long updatedAt;
|
||||
|
||||
/** 删除时间 */
|
||||
@DeleteColumn
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long deletedAt;
|
||||
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return deletedAt != null && deletedAt < Time.now();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -16,5 +18,6 @@ public class Entity extends BaseEntity implements IDEntity<Long> {
|
||||
|
||||
/** ID */
|
||||
@Id
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected Long id;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.java.bean.Language;
|
||||
import com.imyeyu.java.ref.Ref;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -20,18 +22,23 @@ public class Multilingual extends Language implements IDEntity<String>, Creatabl
|
||||
/** 唯一标识 */
|
||||
@Id
|
||||
@AutoUUID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected String id;
|
||||
|
||||
/** 业务类型 */
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected String bizType;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long updatedAt;
|
||||
|
||||
/** 删除时间 */
|
||||
@JsonView(ResponseView.Admin.class)
|
||||
protected Long deletedAt;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.imyeyu.spring.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.imyeyu.spring.annotation.table.AutoUUID;
|
||||
import com.imyeyu.spring.annotation.table.Id;
|
||||
import com.imyeyu.spring.util.ResponseView;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -18,5 +20,6 @@ public class UUIDEntity extends BaseEntity implements IDEntity<String> {
|
||||
/** ID */
|
||||
@Id
|
||||
@AutoUUID
|
||||
@JsonView(ResponseView.Public.class)
|
||||
protected String id;
|
||||
}
|
||||
|
||||
30
src/main/java/com/imyeyu/spring/util/ResponseView.java
Normal file
30
src/main/java/com/imyeyu/spring/util/ResponseView.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.imyeyu.spring.util;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-02-25 15:46
|
||||
*/
|
||||
public interface ResponseView {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-02-25 15:46
|
||||
*/
|
||||
interface Public {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-02-25 15:46
|
||||
*/
|
||||
interface Admin extends Public {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user