<?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.yinet.system.mapper.TouchScreenNoticeMapper">
    <resultMap type="TouchScreenNotice" id="TouchScreenNoticeResult">
        <id property="tsNoticeId" column="ts_notice_id"/>
        <result property="title" column="title"/>
        <result property="description" column="description"/>
        <result property="content" column="content"/>
        <result property="imgPath" column="img_path"/>
        <result property="submitTime" column="submit_time"/>
    </resultMap>
    <select id="selectNoticeList" resultMap="TouchScreenNoticeResult">
        SELECT * from touch_screen_notice
    </select>
    <insert id="insertNotice" parameterType="com.yinet.system.domain.TouchScreenNotice">
        INSERT INTO touch_screen_notice ( ts_notice_id,title,description,content,img_path,submit_time )
        VALUES
        (
        #{touchScreenNotice.tsNoticeId},
        #{touchScreenNotice.title},
        #{touchScreenNotice.description},
        #{touchScreenNotice.content},
        #{touchScreenNotice.imgPath},
        #{touchScreenNotice.submitTime}
        )
    </insert>

    <select id="selectNoticeById" resultMap="TouchScreenNoticeResult">
        SELECT * from touch_screen_notice where ts_notice_id= #{id}
    </select>

    <update id="updateNotice" parameterType="com.yinet.system.domain.TouchScreenNotice">
        UPDATE touch_screen_notice
        SET title = #{touchScreenNotice.title}
        ,description=#{touchScreenNotice.description},content=#{touchScreenNotice.content},img_path=#{touchScreenNotice.imgPath},submit_time=#{touchScreenNotice.submitTime}
        WHERE
        ts_notice_id = #{touchScreenNotice.tsNoticeId};
    </update>
    <delete id="deletNotice" parameterType="String">
        DELETE FROM touch_screen_notice where ts_notice_id in
        <foreach collection="array" item="ids" open="(" separator="," close=")">
            #{ids}
        </foreach>
    </delete>
    <select id="selectNoticeListLimit" resultMap="TouchScreenNoticeResult">
        select * from touch_screen_notice limit #{count}
    </select>
</mapper> 