From 8899a3a6bba9b71a4dfe2e25f043a5e5e4222c37 Mon Sep 17 00:00:00 2001 From: xupei Date: Fri, 4 Oct 2024 11:45:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?SketchStyle=20=E5=8E=BB=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/model/enums/SketchStyle.java | 4 +--- src/main/resources/messages_en.properties | 1 - src/main/resources/messages_zh.properties | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/ai/da/model/enums/SketchStyle.java b/src/main/java/com/ai/da/model/enums/SketchStyle.java index f4ca7894..475b3a01 100644 --- a/src/main/java/com/ai/da/model/enums/SketchStyle.java +++ b/src/main/java/com/ai/da/model/enums/SketchStyle.java @@ -6,9 +6,7 @@ public enum SketchStyle implements IEnumDisplay{ MEDIUM("2"), - THIN("3"), - - CUSTOM("Custom"); + THIN("3"); private String value; diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties index dd1beb67..f2a2f5d7 100644 --- a/src/main/resources/messages_en.properties +++ b/src/main/resources/messages_en.properties @@ -214,7 +214,6 @@ POCKET=Pocket THICK=Thick Lines MEDIUM=Medium Lines THIN=Thin lines -CUSTOM=Custom GENERATE=Generate Sketch EXTRACT=Extract Sketch \ No newline at end of file diff --git a/src/main/resources/messages_zh.properties b/src/main/resources/messages_zh.properties index 92d5e58a..d2a15ec6 100644 --- a/src/main/resources/messages_zh.properties +++ b/src/main/resources/messages_zh.properties @@ -207,7 +207,6 @@ POCKET=口袋 THICK=粗线条 MEDIUM=中线条 THIN=细线条 -CUSTOM=自定义 GENERATE=生成线稿 EXTRACT=提取线稿 \ No newline at end of file From b8d64f1f282c360fb9c7a4d890bbf1107bf27ba3 Mon Sep 17 00:00:00 2001 From: xupei Date: Sun, 6 Oct 2024 14:27:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/PortfolioServiceImpl.java | 91 ++++++++++--------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java index acf06ff3..518a90ec 100644 --- a/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/PortfolioServiceImpl.java @@ -430,7 +430,7 @@ public class PortfolioServiceImpl extends ServiceImpl topThree = new ArrayList<>(); - List excludeIds = new ArrayList<>(); // 存放需要排除的 ID 列表 - - // 获取前三点赞和前三浏览的作品集,并将其排除在分页查询之外 - if (query.getPage() == 1 && (query.getGetMyPortfolio() != 1 && query.getGetLikePortfolio() != 1)) { - // 获取前三点赞的作品集 ID - List topThreeLike = getTopThreeLikeFromRedis(RedisUtil.PORTFOLIO_LIKE_KEY); - List topThreeView = getTopThreeViewFromRedis(RedisUtil.PORTFOLIO_VIEW_KEY, topThreeLike); - - // 获取前三点赞的作品集 - if (!CollectionUtils.isEmpty(topThreeLike)) { - QueryWrapper queryLike = new QueryWrapper<>(); - queryLike.in("id", topThreeLike); - List topThreeLikePortfolio = baseMapper.selectList(queryLike); - topThree.addAll(topThreeLikePortfolio); - excludeIds.addAll(topThreeLike); // 添加到排除 ID 列表 - } - - // 获取前三浏览的作品集 - if (!CollectionUtils.isEmpty(topThreeView)) { - QueryWrapper queryView = new QueryWrapper<>(); - queryView.in("id", topThreeView); - List topThreeViewPortfolio = baseMapper.selectList(queryView); - topThree.addAll(topThreeViewPortfolio); - excludeIds.addAll(topThreeView); // 添加到排除 ID 列表 - } - } - - // 在正常分页查询中排除前三点赞和前三浏览的作品集 - if (!CollectionUtils.isEmpty(excludeIds)) { - qw.lambda().notIn(Portfolio::getId, excludeIds); - } - // 按更新时间排序 qw.lambda().orderByDesc(Portfolio::getUpdateDate); + IPage page; + if (Objects.isNull(query.getAccountId()) && query.getGetMyPortfolio() != 1 && query.getGetLikePortfolio() != 1) { + List topThree = new ArrayList<>(); + List excludeIds = new ArrayList<>(); // 存放需要排除的 ID 列表 - // 执行分页查询 - IPage page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw); + // 获取前三点赞和前三浏览的作品集,并将其排除在分页查询之外 + if (query.getPage() == 1 && (query.getGetMyPortfolio() != 1 && query.getGetLikePortfolio() != 1)) { + // 获取前三点赞的作品集 ID + List topThreeLike = getTopThreeLikeFromRedis(RedisUtil.PORTFOLIO_LIKE_KEY); + List topThreeView = getTopThreeViewFromRedis(RedisUtil.PORTFOLIO_VIEW_KEY, topThreeLike); - // 如果前三点赞和浏览不为空,将它们添加到分页查询的结果最前面 - if (!topThree.isEmpty() && (query.getGetMyPortfolio() != 1 && query.getGetLikePortfolio() != 1)) { - List records = page.getRecords(); - records.addAll(0, topThree); // 添加到查询结果的开头 - page.setRecords(records); + // 获取前三点赞的作品集 + if (!CollectionUtils.isEmpty(topThreeLike)) { + QueryWrapper queryLike = new QueryWrapper<>(); + queryLike.in("id", topThreeLike); + List topThreeLikePortfolio = baseMapper.selectList(queryLike); + topThree.addAll(topThreeLikePortfolio); + excludeIds.addAll(topThreeLike); // 添加到排除 ID 列表 + } + + // 获取前三浏览的作品集 + if (!CollectionUtils.isEmpty(topThreeView)) { + QueryWrapper queryView = new QueryWrapper<>(); + queryView.in("id", topThreeView); + List topThreeViewPortfolio = baseMapper.selectList(queryView); + topThree.addAll(topThreeViewPortfolio); + excludeIds.addAll(topThreeView); // 添加到排除 ID 列表 + } + } + + // 在正常分页查询中排除前三点赞和前三浏览的作品集 + if (!CollectionUtils.isEmpty(excludeIds)) { + qw.lambda().notIn(Portfolio::getId, excludeIds); + } + + // 执行分页查询 + page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw); + + // 如果前三点赞和浏览不为空,将它们添加到分页查询的结果最前面 + if (!topThree.isEmpty()) { + List records = page.getRecords(); + if (!CollectionUtils.isEmpty(records)) { + records.addAll(0, topThree); // 添加到查询结果的开头 + }else { + records = topThree; + } + page.setRecords(records); + } + }else { + // 执行分页查询 + page = portfolioMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw); } // 将 Portfolio 转换为 PortfolioVO 并进行相关处理