This commit is contained in:
47
src/main/java/com/imyeyu/spring/entity/Multilingual.java
Normal file
47
src/main/java/com/imyeyu/spring/entity/Multilingual.java
Normal file
@@ -0,0 +1,47 @@
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user