refactor(service): 统一Service缓存为VO对象并优化关联实体处理
重构Service类实现,将QueryService泛型参数调整为VO类型,确保缓存VO对象而非实体。优化关联实体处理逻辑,减少重复代码。修改findById方法返回VO对象,新增getById方法获取实体。更新相关调用点以适配新接口。 调整WebSocket处理、控制器及Service实现,确保数据类型一致性。完善文档记录重构过程及发现的问题。为后续优化提供基础架构支持。
This commit is contained in:
@@ -7,7 +7,13 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
|
||||
public interface IEntityService<T> {
|
||||
T findById(Integer id);
|
||||
/**
|
||||
* 根据ID查询实体
|
||||
* <b> 注意:如果实体类有关联实体此方法不能使用 @Cacheable 注解 </b>
|
||||
* @param id 实体ID
|
||||
* @return 实体对象
|
||||
*/
|
||||
T getById(Integer id);
|
||||
|
||||
Page<T> findAll(Specification<T> spec, Pageable pageable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user