From 64c4180e4ded8e81d58a647ebebfb17aa3154d11 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 17 Jul 2025 14:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8D=E8=B4=B9=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ycwl/basic/mapper/SourceMapper.java | 1 + .../model/mobile/scenic/content/ContentPageVO.java | 1 + .../ycwl/basic/service/pc/impl/FaceServiceImpl.java | 12 ++++++++---- src/main/resources/mapper/SourceMapper.xml | 7 +++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java index 027b303..17bb9f9 100644 --- a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java +++ b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java @@ -68,6 +68,7 @@ public interface SourceMapper { List listVideoByFaceRelation(Long memberId, Long faceId); List listImageByFaceRelation(Long memberId, Long faceId); + List listByFaceRelation(Long memberId, Long faceId, Integer type); SourceEntity getEntity(Long id); diff --git a/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java b/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java index 7cbe555..93d7d66 100644 --- a/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java +++ b/src/main/java/com/ycwl/basic/model/mobile/scenic/content/ContentPageVO.java @@ -34,4 +34,5 @@ public class ContentPageVO { private Integer isBuy; private BigDecimal duration; private Integer goodsType; + private int freeCount; } diff --git a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java index 1b36ffc..5a47294 100644 --- a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java @@ -418,12 +418,14 @@ public class FaceServiceImpl implements FaceService { } else { sourceImageContent.setIsBuy(0); } - List sourceEntities = sourceMapper.listImageByFaceRelation(faceRespVO.getMemberId(), faceId); - if (!sourceEntities.isEmpty()) { + List relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 2); + if (!relations.isEmpty()) { sourceImageContent.setLockType(-1); } else { sourceImageContent.setLockType(1); } + long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count(); + sourceImageContent.setFreeCount((int) freeCount); contentList.add(sourceImageContent); } if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) { @@ -435,12 +437,14 @@ public class FaceServiceImpl implements FaceService { } else { sourceVideoContent.setIsBuy(0); } - List sourceEntities = sourceMapper.listVideoByFaceRelation(faceRespVO.getMemberId(), faceId); - if (!sourceEntities.isEmpty()) { + List relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 1); + if (!relations.isEmpty()) { sourceVideoContent.setLockType(-1); } else { sourceVideoContent.setLockType(1); } + long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count(); + sourceVideoContent.setFreeCount((int) freeCount); contentList.add(sourceVideoContent); } sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> { diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index e024d49..e76ca9a 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -227,4 +227,11 @@ and ms.type = #{type} and ms.face_id = #{faceId} +