Spring数据Rest:投影到收集/分页
我有实体Spring数据Rest:投影到收集/分页,spring,kotlin,spring-data-rest,projection,Spring,Kotlin,Spring Data Rest,Projection,我有实体Person和一些uuid,还有一个外部服务,我可以通过uuid获取照片 当我通过id拍摄person时,我有一个投影PersonWithPhoto,它调用外部服务并返回带有相关uuid的照片。但当我请求多个人时,我不希望有多个http调用(我只想做一个),按UUID拍照并返回预期结果 有什么建议吗 我的代码如下: @实体 @EntityListener(AuditingEntityListener::类) 数据类人员( @身份证 @GeneratedValue(策略=Generatio
Person
和一些uuid
,还有一个外部服务,我可以通过uuid
获取照片
当我通过id
拍摄person时,我有一个投影PersonWithPhoto
,它调用外部服务并返回带有相关uuid
的照片。但当我请求多个人时,我不希望有多个http调用(我只想做一个),按UUID拍照并返回预期结果
有什么建议吗
我的代码如下:
@实体
@EntityListener(AuditingEntityListener::类)
数据类人员(
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
val id:Long?=null,
val userid:UUID
)
@存储资源
@交易的
接口PersonRepository:JpaRepository{
}
@投影(name=“PersonWithPhoto”,类型=[Person::class])
界面人物与照片{
val id:Long,
@get:Value(“#{@personProfileService.getPesonPhotoDto(target)}”)
val照片:PhotoInfoDto
}
请分享您的code@MaifeeUlAsad完成