Files
timi-spring/src/main/java/com/imyeyu/spring/entity/Multilingual.java
2026-04-17 12:14:15 +08:00

51 lines
1.0 KiB
Java

package com.imyeyu.spring.entity;
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 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, Destroyable {
/** 唯一标识 */
@Id
@AutoUUID
protected String id;
/** 业务类型 */
protected String bizType;
/** 创建时间 */
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);
}
}
}