<?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.ics.admin.mapper.meeting.RoomServeByRoomMapper">
    
    <resultMap type="com.ics.admin.domain.meeting.RoomServeByRoom" id="RoomServeByRoomResult">
        <result property="id"    column="id"    />
        <result property="serveId"    column="serve_id"    />
        <result property="romeContentId"    column="rome_content_id"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectRoomServeByRoomVo">
        SELECT id, serve_id, rome_content_id, create_time FROM tb_room_serve_by_room
    </sql>

    <select id="selectRoomServeByRoomList" parameterType="RoomServeByRoom" resultMap="RoomServeByRoomResult">
        <include refid="selectRoomServeByRoomVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectRoomServeByRoomById" parameterType="Long" resultMap="RoomServeByRoomResult">
        <include refid="selectRoomServeByRoomVo"/>
        WHERE id = #{id}
    </select>
        
    <insert id="insertRoomServeByRoom" parameterType="RoomServeByRoom" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO tb_room_serve_by_room
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="serveId != null ">serve_id,</if>
            <if test="romeContentId != null ">rome_content_id,</if>
            <if test="createTime != null ">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="serveId != null ">#{serveId},</if>
            <if test="romeContentId != null ">#{romeContentId},</if>
            <if test="createTime != null ">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateRoomServeByRoom" parameterType="RoomServeByRoom">
        UPDATE tb_room_serve_by_room
        <trim prefix="SET" suffixOverrides=",">
            <if test="serveId != null ">serve_id = #{serveId},</if>
            <if test="romeContentId != null ">rome_content_id = #{romeContentId},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        WHERE id = #{id}
    </update>

    <delete id="deleteRoomServeByRoomById" parameterType="Long">
        DELETE FROM tb_room_serve_by_room WHERE id = #{id}
    </delete>

    <delete id="deleteRoomServeByRoomByIds" parameterType="String">
        DELETE FROM tb_room_serve_by_room where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>