<?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.java2nb.novel.mapper.FrontBookCommentMapper">

    <select id="listCommentByPage"  resultType="com.java2nb.novel.vo.BookCommentVO">
        select t1.id,t1.book_id,t1.comment_content,t1.reply_count,t1.create_time,t2.username create_user_name,t2.user_photo create_user_photo
        from book_comment t1 inner join user t2 on t1.create_user_id = t2.id
        <trim>
            <if test="bookId != null">
                and t1.book_id = #{bookId}
            </if>
            <if test="userId != null">
                and t1.create_user_id = #{userId}
            </if>
        </trim>


    </select>



</mapper>