From aaa8d8310a00a16ffe5eba8f2f1e4a3e76f7be6f Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 20 Nov 2025 14:55:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(source):=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E4=BA=BA=E8=84=B8=E5=92=8C=E8=AE=BE=E5=A4=87ID?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=B4=A0=E6=9D=90=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在SourceMapper接口中新增getSourceByFaceAndDeviceId方法 - 支持通过faceId、deviceId、type和排序策略查询特定素材 - 在XML映射文件中实现对应的SQL查询逻辑 - 支持多种排序策略:最新、最早、评分降序、评分升序、随机和已购买优先 - 查询结果限制为一条记录 --- .../com/ycwl/basic/mapper/SourceMapper.java | 10 ++++++ src/main/resources/mapper/SourceMapper.xml | 33 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java index 55fe26b7..b2e248dd 100644 --- a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java +++ b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java @@ -131,4 +131,14 @@ public interface SourceMapper { * @return 设备ID列表 */ List 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); } diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index f91f41dc..e2278194 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -410,4 +410,37 @@ WHERE ms.face_id = #{faceId} ORDER BY s.device_id ASC + +