huliguo
2025-07-16 d95fe2f1ffa6b6bd07410abd2108bd2ed8f141c3
src/main/resources/mapper/keywordMapper.xml
@@ -131,7 +131,20 @@
        <if test="questionId != null">
            AND r.question_id = #{questionId}
        </if>
        AND r.num = #{num}
        <if test="isNow != null">
            <!-- 当 isNow=1 时使用 keyword.num,否则使用 1 -->
            AND r.num =
            <choose>
                <when test="isNow == 1">
                    #{keyword.num}
                </when>
                <otherwise>
                    1
                </otherwise>
            </choose>
        </if>
        ORDER BY t.type_id  -- 按 type_id 排序,结果更规范
    </select>
</mapper>