Files
FrameTour-BE/src/main/java/com/ycwl/basic/mapper/SourceMapper.java
Jerry Yan 125fadd6c5 feat(basic): 新增AI微单类型支持
- 在SourceType枚举中新增AI_CAM类型及其判断方法
- 在ProductType枚举中新增AI_CAM_PHOTO_SET类型
- 扩展SourceMapper接口及XML实现删除指定faceId和type的关联记录功能
- 更新AppAiCamServiceImpl服务逻辑,在添加新关联前先删除旧记录
- 修改GoodsServiceImpl以识别并处理AI微单类型的商品名称前缀
- 在FaceServiceImpl中增加对AI微单内容的查询与展示逻辑
- 优化face相关素材分类展示,确保AI微单正确归类显示
2025-12-05 19:58:53 +08:00

168 lines
5.0 KiB
Java

package com.ycwl.basic.mapper;
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
import com.ycwl.basic.model.pc.source.entity.SourceWatermarkEntity;
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
/**
* @Author:longbinbin
* @Date:2024/12/2 11:21
* 视频源
*/
@Mapper
public interface SourceMapper {
List<SourceRespVO> list(SourceReqQuery sourceReqQuery);
SourceRespVO getById(Long id);
SourceRespVO userGetById(Long id, Long userId);
List<SourceEntity> listBySampleIds(List<Long> sourceIds);
int add(SourceEntity source);
int deleteById(Long id);
int update(SourceEntity source);
/**
* @param sourceReqQuery
* @return
*/
List<SourceRespVO> listGroupByType(SourceReqQuery sourceReqQuery);
/**
* 用户素材数量
*
* @param userId
* @return
*/
int countByMemberId(String userId);
List<SourceEntity> listVideoBySampleIds(List<Long> sampleId);
SourceEntity findBySampleId(Long faceSampleId);
int addRelation(MemberSourceEntity source);
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
Integer countUser(SourceReqQuery sourceReqQuery);
SourceRespVO listUserOne(Long userId, Long sourceId);
int addRelations(List<MemberSourceEntity> list);
List<MemberSourceEntity> filterExistingRelations(List<MemberSourceEntity> list);
boolean sourceExists(Long sourceId);
List<MemberSourceEntity> filterValidSourceRelations(List<MemberSourceEntity> list);
int updateRelation(MemberSourceEntity memberSourceEntity);
int freeRelations(List<Long> ids, int type);
List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);
/**
* 按 faceId 和 type 分组查询源素材,每组返回最新的一条记录
* @param sourceReqQuery 查询参数
* @return 分组后的素材列表
*/
List<SourceRespVO> queryGroupedByFaceAndType(SourceReqQuery sourceReqQuery);
SourceEntity querySameVideo(Long faceSampleId, Long deviceId);
int hasRelationTo(Long memberId, Long sourceId, int type);
List<SourceEntity> listVideoByScenicFaceRelation(Long scenicId, Long faceId);
List<SourceEntity> listVideoByFaceRelation(Long faceId);
List<SourceEntity> listImageByFaceRelation(Long faceId);
List<MemberSourceEntity> listByFaceRelation(Long faceId, Integer type);
SourceEntity getEntity(Long id);
int deleteNotRelateSource(int type, Date endDate);
int deleteNotBuyRelations(Long scenicId, Date endDate);
int deleteNotBuyFaceRelation(Long userId, Long faceId);
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
int deleteUselessSource();
int updateMemberIdByFaceId(Long faceId, Long memberId);
/**
* 根据faceId查询type=2的source列表
* @param faceId 人脸ID
* @return type=2的source列表
*/
List<SourceEntity> listImageSourcesByFaceId(Long faceId);
/**
* 从ZT-Source消息添加素材
* @param source 素材实体
* @return 影响行数
*/
int addFromZTSource(SourceEntity source);
SourceEntity getBySampleIdAndType(Long faceSampleId, Integer type);
/**
* 统计faceId关联的不同设备数量
* @param faceId 人脸ID
* @return 设备数量
*/
Integer countDistinctDevicesByFaceId(Long faceId);
/**
* 根据faceId和设备索引获取source
* @param faceId 人脸ID
* @param deviceIndex 设备索引(从0开始)
* @param type 素材类型(1-视频,2-图片)
* @param sortStrategy 排序策略
* @return source实体
*/
SourceEntity getSourceByFaceAndDeviceIndex(Long faceId, Integer deviceIndex, Integer type, String sortStrategy);
/**
* 获取faceId关联的所有设备ID列表
* @param faceId 人脸ID
* @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);
/**
* 根据faceSampleId列表和type查询source列表
* @param faceSampleIds faceSampleId列表
* @param type 素材类型
* @return source实体列表
*/
List<SourceEntity> listByFaceSampleIdsAndType(List<Long> faceSampleIds, Integer type);
/**
* 删除指定faceId和type的member_source关联记录
* @param faceId 人脸ID
* @param type 素材类型
* @return 删除的记录数
*/
int deleteRelationsByFaceIdAndType(Long faceId, Integer type);
}