<selectid="findReplyTreeByParam"parameterType="com.stonewu.blog.core.entity.custom.ReplyTree" resultMap="replyTree"> SELECT r.*, a.title article_title, m.nick_name author_name FROM reply r LEFT JOIN article a ON r.article_id = a.id LEFT JOIN menber m ON m.id = r.author_id WHERE 1 = 1 <iftest="param.id != null"> AND a.id = #{param.id} </if> <iftest="param.articleId != null"> AND article_id = #{param.articleId} </if> <iftest="param.topReplyId != null"> AND top_reply_id = #{param.topReplyId} </if> AND parent_reply_id is null <iftest="param.checkReply != null"> AND ( check_reply = #{param.checkReply} <iftest="param.authorId != null"> or m.id = #{param.authorId} </if> ) </if> <iftest="param.replyType != null"> AND reply_type = #{param.replyType} </if>
<selectid="getReplyChildren"resultMap="replyTreeChild"> SELECT r.*, a.title article_title, m.nick_name author_name FROM reply r LEFT JOIN article a ON r.article_id = a.id LEFT JOIN menber m ON m.id = r.author_id WHERE 1 = 1 AND parent_reply_id = #{id} AND ( check_reply = 1 <iftest="authorId != null"> or m.id = #{authorId} </if> ) </select>