56 lines
1.1 KiB
Java
56 lines
1.1 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.IDEntity;
|
|
|
|
/**
|
|
* @author 夜雨
|
|
* @since 2025-10-17 15:21
|
|
*/
|
|
public class Multilingual extends Language implements IDEntity<String>, Creatable {
|
|
|
|
@Id
|
|
@AutoUUID
|
|
protected String id;
|
|
|
|
protected Long createdAt;
|
|
|
|
/**
|
|
* 获取指定语言值
|
|
*
|
|
* @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);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
@Override
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
@Override
|
|
public Long getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
@Override
|
|
public void setCreatedAt(Long createdAt) {
|
|
this.createdAt = createdAt;
|
|
}
|
|
}
|