feat(source): 新增根据人脸和设备ID获取素材的功能

- 在SourceMapper接口中新增getSourceByFaceAndDeviceId方法
- 支持通过faceId、deviceId、type和排序策略查询特定素材
- 在XML映射文件中实现对应的SQL查询逻辑
- 支持多种排序策略:最新、最早、评分降序、评分升序、随机和已购买优先
- 查询结果限制为一条记录
This commit is contained in:
2025-11-20 14:55:28 +08:00
parent 8d2d0901fd
commit aaa8d8310a
2 changed files with 43 additions and 0 deletions

View File

@@ -131,4 +131,14 @@ public interface SourceMapper {
* @return 设备ID列表
*/
List<Long> getDeviceIdsByFaceId(Long faceId);
/**
* 根据faceId和设备ID获取source
* @param faceId 人脸ID
* @param deviceId 设备ID
* @param type 素材类型(1-视频,2-图片)
* @param sortStrategy 排序策略
* @return source实体
*/
SourceEntity getSourceByFaceAndDeviceId(Long faceId, Long deviceId, Integer type, String sortStrategy);
}