<?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="vip.xiaonuo.disk.mapper.UserCommentMapper">
    <select id="selectCommentPid" resultType="vip.xiaonuo.disk.vo.comment.UserCommentVo">
        SELECT
            a.id,
            a.pid,
            a.comment_name commentName,
            a.user_id userId,
            a.comment_time,
            a.give_num giveNum,
            b.name  userName
        FROM
            user_comment a LEFT JOIN  sys_user b ON a. user_id=b.id
        WHERE
            resource_id=#{resourceId}
          and	pid IS NULL
    </select>


    <select id="selectCommentNoPid" resultType="vip.xiaonuo.disk.vo.comment.UserCommentVo">
        SELECT
            a.id,
            a.pid,
            a.comment_name commentName,
            a.user_id userId,
            a.comment_time,
            a.give_num giveNum,
            b.name  userName
        FROM
            user_comment a LEFT JOIN  sys_user b ON a. user_id=b.id
        WHERE
            resource_id=#{resourceId}
          and	pid IS NOT NULL
    </select>
</mapper>
