<?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="org.agt.module.license.dal.mysql.comment.CommentMapper">

    <select id="getCommentList" resultType="org.agt.module.license.controller.admin.comment.vo.CommentTreeRespVO">
        SELECT
            c.*,
            u.nickname author,
            u.avatar,
            pc.user_id reply_user_id,
            pu.nickname reply_user
        FROM
            crm_comment c
                LEFT JOIN system_users u ON c.user_id = u.id
                AND u.deleted = 0
                LEFT JOIN crm_comment pc ON c.parent_id = pc.id
                AND pc.deleted = 0
                LEFT JOIN system_users pu ON pc.user_id = pu.id
                AND pu.deleted = 0
        WHERE
            c.deleted = 0
            AND c.project_id = #{projectId}
        ORDER BY
            c.update_time DESC
    </select>


</mapper>