<?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.hanserwei.hannote.data.align.domain.mapper.SelectRecordMapper">
    <select id="selectBatchFromDataAlignFollowingCountTempTable" resultType="long" parameterType="map">
        select user_id
        from `t_data_align_following_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectCountFromFollowingTableByUserId" parameterType="map" resultType="int">
        select count(*)
        from t_following
        where user_id = #{userId}
    </select>

    <select id="selectBatchFromDataAlignFansCountTempTable" resultType="long" parameterType="map">
        select user_id
        from `t_data_align_fans_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectCountFromFansTableByUserId" parameterType="map" resultType="int">
        select count(*)
        from t_fans
        where user_id = #{userId}
    </select>

    <select id="selectBatchFromDataAlignNotePublishCountTempTable" resultType="long" parameterType="map">
        select user_id
        from `t_data_align_note_publish_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectCountFromNoteTableByUserId" parameterType="map" resultType="int">
        select count(*)
        from t_note
        where creator_id = #{userId}
        and status = 1
    </select>


    <select id="selectBatchFromDataAlignNoteLikeCountTempTable" resultType="long" parameterType="map">
        select note_id
        from `t_data_align_note_like_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectCountFromNoteLikeTableByNoteId" parameterType="map" resultType="int">
        select count(*)
        from t_note_like
        where note_id = #{noteId}
          and status = 1
    </select>

    <select id="selectBatchFromDataAlignNoteCollectCountTempTable" resultType="long" parameterType="map">
        select note_id
        from `t_data_align_note_collect_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectCountFromNoteCollectTableByNoteId" resultType="int" parameterType="map">
        select count(*)
        from t_note_collection
        where note_id = #{noteId}
          and status = 1
    </select>

    <select id="selectBatchFromDataAlignUserCollectCountTempTable" resultType="long" parameterType="map">
        select user_id
        from `t_data_align_user_collect_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectUserCollectCountFromNoteCollectionTableByUserId" resultType="int" parameterType="map">
        select count(*)
        from t_note_collection
        where user_id = #{userId}
          and status = 1
    </select>

    <select id="selectBatchFromDataAlignUserLikeCountTempTable" resultType="long" parameterType="map">
        select user_id
        from `t_data_align_user_like_count_temp_${tableNameSuffix}`
        order by id
        limit #{batchSize}
    </select>

    <select id="selectUserLikeCountFromNoteLikeTableByUserId" resultType="int" parameterType="map">
        select count(*)
        from t_note_like
        where user_id = #{userId}
          and status = 1
    </select>
</mapper>