<?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.jeeplus.business.notify.mapper.PluginNotifyCommentsMapper">

    <resultMap id="BaseResultMap" type="com.jeeplus.business.notify.service.dto.PluginNotifyCommentsDTO">
            <id property="id" column="id" jdbcType="VARCHAR"/>
            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
            <result property="notifyId" column="notify_id" jdbcType="VARCHAR"/>
            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
            <result property="comments" column="comments" jdbcType="VARCHAR"/>
            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Comments_Column_List">
        pnc.id,
        pnc.create_by_id,
        pnc.create_time,
        pnc.update_by_id,
        pnc.update_time,
        pnc.notify_id,
        pnc.user_id,
        pnc.comments,
        pnc.del_flag
    </sql>


    <select id="findNotifyAll" resultType="com.jeeplus.business.notify.service.dto.PluginNotifyCommentsDTO">
        select
        pnc.id,
        pnc.create_by_id as create_id,
        pnc.create_time,
        pnc.update_by_id,
        pnc.update_time,
        pnc.notify_id,
        pnc.user_id,
        pnc.comments,
        pnc.del_flag ,
        su.name as user_name
        from jy_plugin_notify_comments pnc
        left join sys_user su on su.id = pnc.user_id and su.del_flag = '0'
        where pnc.del_flag = '0' and pnc.notify_id = #{id}
        order by pnc.create_time desc
    </select>

</mapper>
