<?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.JyNotifyLogMapper">

    <select id="findByNotifyId" resultType="com.jeeplus.business.notify.domain.JyNotifyLog">
        select
            nl.id,
            nl.create_by_id,
            nl.create_time,
            nl.update_by_id,
            nl.update_time,
            nl.count,
            nl.notify_id,
            su.name as createName
        from jy_notify_log nl
        left join sys_user su on su.id = nl.create_by_id and su.del_flag = '0'
        where nl.notify_id=#{id}
        order by nl.update_time DESC limit #{size}
    </select>

    <select id="getByNotifyId" resultType="com.jeeplus.business.notify.domain.JyNotifyLog">
        select
            nl.id,
            nl.create_by_id,
            nl.create_time,
            nl.update_by_id,
            nl.update_time,
            nl.count,
            nl.notify_id,
            su.name as createName
        from jy_notify_log nl
        left join sys_user su on su.id = nl.create_by_id and su.del_flag = '0'
        where nl.notify_id=#{id} and nl.create_by_id=#{userId}
    </select>


    <select id="findLogCount" resultType="integer">
        select
           count(*)
        from jy_notify_log nl
        where nl.notify_id=#{id}
    </select>



</mapper>