<?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="cn.reghao.tnb.sb.multi.mybatis.mapper.two.ImagePostMapper">
    <update id="updateUserId">
        update image_post
        set user_id=#{newUser}
        where user_id=#{oldUser}
    </update>

    <select id="findAll" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.ImagePost">
        select *
        from image_post
        where deleted=1
    </select>
    <select id="findImagePost" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.ImagePost">
        select *
        from image_post
        where album_id=#{albumId}
    </select>
    <select id="findImagePostByUserId" resultType="cn.reghao.tnb.sb.multi.mybatis.model.two.ImagePost">
        select *
        from image_post
        where user_id=#{userId}
    </select>

    <select id="findImageUser" resultType="java.lang.Long">
        select user_id
        from image_post
        where user_id not in
        (
        select publish_by
        from vod_video_post
        where category_pid=11 and `status`=2
        group by publish_by
        )
        group by user_id
        order by user_id asc
    </select>
    <select id="findVideoUser" resultType="java.lang.Long">
        select publish_by
        from vod_video_post
        where category_pid=11 and `status`=2
        group by publish_by
        order by publish_by asc;
    </select>
</mapper>
