52 lines
1.2 KiB
Java
52 lines
1.2 KiB
Java
package com.imyeyu.spring.bean;
|
|
|
|
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.entity.Creatable;
|
|
import com.imyeyu.spring.entity.Deletable;
|
|
import com.imyeyu.spring.entity.IDEntity;
|
|
import com.imyeyu.spring.entity.Updatable;
|
|
import lombok.Data;
|
|
import lombok.EqualsAndHashCode;
|
|
|
|
/**
|
|
* 多语言实体基类
|
|
*
|
|
* @author 夜雨
|
|
* @since 2025-10-17 15:21
|
|
*/
|
|
@Data
|
|
@EqualsAndHashCode(callSuper = true)
|
|
public class Multilingual extends Language implements IDEntity<String>, Creatable, Updatable, Deletable {
|
|
|
|
/** 唯一标识 */
|
|
@Id
|
|
@AutoUUID
|
|
protected String id;
|
|
|
|
/** 创建时间 */
|
|
protected Long createdAt;
|
|
|
|
/** 更新时间 */
|
|
protected Long updatedAt;
|
|
|
|
/** 删除时间 */
|
|
protected Long deletedAt;
|
|
|
|
/**
|
|
* 获取指定语言值
|
|
*
|
|
* @param language 指定语言
|
|
* @return 值
|
|
*/
|
|
public String getValue(Language.Enum language) {
|
|
try {
|
|
return Ref.getFieldValue(this, language.toString().replace("_", ""), String.class);
|
|
} catch (IllegalAccessException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|