<?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.xhkjedu.sapi.mapper.notice.NoticeTeacherMapper">
    <!--批量添加-->
    <insert id="batchSave" parameterType="com.xhkjedu.sapi.model.notice.TNotice">
        INSERT INTO t_notice_teacher (noticeid,teacherid,createtime,schoolid)
        VALUES
        <foreach collection ="notice.teachers" item="t" index= "index" separator =",">
            (#{notice.noticeid},#{t.teacherid},#{notice.createtime},#{notice.schoolid})
        </foreach>
    </insert>
    <!--删除通知对象-->
    <delete id="deleteByNoticeId">
        delete from t_notice_teacher where noticeid=#{noticeid}
    </delete>
    <!--查看-->
    <update id="reade">
        update t_notice_teacher nt set nt.readed=1,nt.readtime=#{timestamp}
        where nt.noticeid=#{noticeid} and nt.teacherid=#{teacherid}
    </update>
</mapper>
