From cb17ea527b20260027d8c232e797d5a448137ee3 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Wed, 19 Nov 2025 15:08:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(SourceMapper):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E5=8A=A8=E6=80=81=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用标签替换原有静态where条件 - 添加对scenicId、isBuy、type、faceId参数的动态判断 - 确保只有非空参数参与SQL查询条件构建 - 提高SQL语句可读性和维护性 - 避免因缺少条件导致的语法错误风险 --- src/main/resources/mapper/SourceMapper.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/SourceMapper.xml b/src/main/resources/mapper/SourceMapper.xml index ce65a36e..3697dccc 100644 --- a/src/main/resources/mapper/SourceMapper.xml +++ b/src/main/resources/mapper/SourceMapper.xml @@ -244,13 +244,12 @@ select so.id, ms.scenic_id, device_id, thumb_url, url, ms.is_free, so.create_time, so.update_time, ms.is_buy, video_url from member_source ms left join source so on ms.source_id = so.id - - where - ms.member_id = #{memberId} and so.id is not null + and ms.scenic_id = #{scenicId} and ms.is_buy = #{isBuy} and ms.type = #{type} and ms.face_id = #{faceId} + order by ms.is_free desc, so.create_time asc