<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.quinn.mapper.StarMapper">

    <select id="listStars" resultType="com.quinn.pojo.StarWithTopic">
        select * from
        (
        select a.*,b.title as topicName from qn_star a,qn_blog b
        where a.topic_id = b.bid
        and a.topic_category = 'BLOG'
        and a.user_id = #{userId}
        union all
        select a.*,c.source_name as topicName from qn_star a,qn_source c
        where a.topic_id = c.sid
        and a.topic_category = 'SOURCE'
        and a.user_id = #{userId}) t
        order by t.gmt_create desc
        limit #{myPageParam.pageNum},#{myPageParam.size}
    </select>

</mapper>
