This commit is contained in:
sjm 2023-12-27 00:59:00 +08:00
parent 8b6b6a6b7a
commit 03350aea09
2 changed files with 28 additions and 27 deletions

View File

@ -14,6 +14,31 @@
<result column="rating" jdbcType="INTEGER" property="rating" />
</resultMap>
<resultMap id="Map" type="com.lovenav.entity.CommentNode">
<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" />
<association property="user" javaType="com.lovenav.entity.User">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_login" jdbcType="VARCHAR" property="userLogin" />
<result column="user_password" jdbcType="VARCHAR" property="userPassword" />
<result column="phone" jdbcType="BIGINT" property="phone" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="user_email" jdbcType="VARCHAR" property="userEmail" />
<result column="user_status" jdbcType="TINYINT" property="userStatus" />
<result column="user_registered" jdbcType="TIMESTAMP" property="userRegistered" />
<result column="role_id" jdbcType="TINYINT" property="roleId" />
</association>
</resultMap>
<sql id="Base_Column_List">
@ -165,16 +190,16 @@
<!-- com.lovenav.dao.mybaits.-->
<select id="queryFirstCommentList" parameterType="java.lang.Integer" resultMap="com.lovenav.dao.mybaits.Map">
<select id="queryFirstCommentList" parameterType="java.lang.Integer" resultMap="Map">
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 = 0
</select>
<select id="querySecondCommentList" parameterType="java.lang.Integer" resultMap="com.lovenav.dao.mybaits.Map">
<select id="querySecondCommentList" parameterType="java.lang.Integer" resultMap="Map">
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 != 0

View File

@ -1,29 +1,5 @@
<?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.lovenav.dao.mybaits">
<resultMap id="Map" 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" />
<association property="user" javaType="com.lovenav.entity.User">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_login" jdbcType="VARCHAR" property="userLogin" />
<result column="user_password" jdbcType="VARCHAR" property="userPassword" />
<result column="phone" jdbcType="BIGINT" property="phone" />
<result column="avatar" jdbcType="VARCHAR" property="avatar" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="user_email" jdbcType="VARCHAR" property="userEmail" />
<result column="user_status" jdbcType="TINYINT" property="userStatus" />
<result column="user_registered" jdbcType="TIMESTAMP" property="userRegistered" />
<result column="role_id" jdbcType="TINYINT" property="roleId" />
</association>
</resultMap>
</mapper>