huliguo
2025-07-16 6727c89745faa938cc053fa67ea3b9f819f5cbfe
src/main/resources/mapper/keywordMapper.xml
@@ -50,7 +50,6 @@
        p.platform_name
        ORDER BY
        total_repetitions DESC
        LIMIT 30
    </select>
    <select id="getResultByTypeId" resultType="com.linghu.model.vo.PlatformProportionVO">
        SELECT
@@ -123,4 +122,16 @@
        ORDER BY
        r.repetition_num DESC
    </select>
    <select id="getTypeIds" resultType="java.lang.Integer">
        SELECT DISTINCT t.type_id  -- 使用 DISTINCT 去重,确保每个 type_id 只出现一次
        FROM reference r
        JOIN platform p ON r.platform_id = p.platform_id
        JOIN type t ON p.type_id = t.type_id
        WHERE r.keyword_id = #{keywordId}
        <if test="questionId != null">
            AND r.question_id = #{questionId}
        </if>
        AND r.num = #{num}
        ORDER BY t.type_id  -- 按 type_id 排序,结果更规范
    </select>
</mapper>