显示一级评论和用户信息

This commit is contained in:
sjm
2023-12-24 23:07:41 +08:00
parent 65f76703b8
commit 48954ddb04
4 changed files with 116 additions and 5 deletions

View File

@@ -159,4 +159,39 @@
from ln_comment
where root_comment_id = #{rootCommentId,jdbcType=INTEGER} and comment_status = 0
</select>
<select id="queryFirstCommentList" parameterType="java.lang.Integer" resultMap="ResultMap">
SELECT * FROM ln_comment o LEFT JOIN ln_user u
ON o.user_id=u.id
WHERE o.url_id=#{urlId,jdbcType=INTEGER} AND o.root_comment_id is null
</select>
<resultMap id="ResultMap" type="com.lovenav.entity.Comment">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="url_id" jdbcType="INTEGER" property="urlId" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="root_comment_id" jdbcType="INTEGER" property="rootCommentId" />
<result column="like_count" jdbcType="BIGINT" property="likeCount" />
<result column="comment_time" jdbcType="TIMESTAMP" property="commentTime" />
<result column="comment_status" jdbcType="TINYINT" property="commentStatus" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="rating" jdbcType="INTEGER" property="rating" />
</resultMap>
<select id="querySecondCommentList" parameterType="java.lang.Integer" resultMap="ResultMap">
SELECT * FROM ln_comment o LEFT JOIN ln_user u
ON o.user_id=u.id
WHERE o.url_id=#{urlId,jdbcType=INTEGER} AND o.root_comment_id is not null
</select>
</mapper>