mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-10-24 17:01:37 +08:00
refactor(extension/crud): 调整 BaseService 相关泛型类型加载为懒加载
This commit is contained in:
@@ -36,13 +36,25 @@ import java.util.List;
|
||||
*/
|
||||
public class ServiceImpl<M extends BaseMapper<T>, T> extends com.baomidou.mybatisplus.extension.service.impl.ServiceImpl<M, T> implements IService<T> {
|
||||
|
||||
protected final List<Field> entityFields = ReflectUtils.getNonStaticFields(this.getEntityClass());
|
||||
private List<Field> entityFields;
|
||||
|
||||
@Override
|
||||
public T getById(Serializable id) {
|
||||
return this.getById(id, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前实体类型字段
|
||||
*
|
||||
* @return 当前实体类型字段列表
|
||||
*/
|
||||
public List<Field> getEntityFields() {
|
||||
if (this.entityFields == null) {
|
||||
this.entityFields = ReflectUtils.getNonStaticFields(this.getEntityClass());
|
||||
}
|
||||
return this.entityFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 查询
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user