<?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.rwk.system.mapper.RwkMeetingStaffMapper">

    <resultMap type="RwkMeetingStaff" id="RwkMeetingStaffResult">
        <result property="id"    column="id"    />
        <result property="meetingId"    column="meeting_id"    />
        <result property="personnelName"    column="personnel_name"    />
        <result property="isSign"    column="is_sign"    />
        <result property="personnelId"    column="personnel_id"    />
        <result property="mobilePhone"    column="mobile_phone"    />
    </resultMap>

    <sql id="selectRwkMeetingStaffVo">
        select id, meeting_id, personnel_name, is_sign, personnel_id, mobile_phone from rwk_meeting_staff
    </sql>

    <select id="selectRwkMeetingStaffList" parameterType="RwkMeetingStaff" resultMap="RwkMeetingStaffResult">
        <include refid="selectRwkMeetingStaffVo"/>
        <where>
            <if test="meetingId != null "> and meeting_id = #{meetingId}</if>
            <if test="personnelName != null  and personnelName != ''"> and personnel_name like concat('%', #{personnelName}, '%')</if>
            <if test="isSign != null "> and is_sign = #{isSign}</if>
            <if test="personnelId != null  and personnelId != ''"> and personnel_id = #{personnelId}</if>
            <if test="mobilePhone != null  and mobilePhone != ''"> and mobile_phone = #{mobilePhone}</if>
        </where>
    </select>

    <select id="selectRwkMeetingStaffById" parameterType="Long" resultMap="RwkMeetingStaffResult">
        <include refid="selectRwkMeetingStaffVo"/>
        where id = #{id}
    </select>

    <insert id="insertRwkMeetingStaff" parameterType="RwkMeetingStaff" useGeneratedKeys="true" keyProperty="id">
        insert into rwk_meeting_staff
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="meetingId != null">meeting_id,</if>
            <if test="personnelName != null">personnel_name,</if>
            <if test="isSign != null">is_sign,</if>
            <if test="personnelId != null">personnel_id,</if>
            <if test="mobilePhone != null">mobile_phone,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="meetingId != null">#{meetingId},</if>
            <if test="personnelName != null">#{personnelName},</if>
            <if test="isSign != null">#{isSign},</if>
            <if test="personnelId != null">#{personnelId},</if>
            <if test="mobilePhone != null">#{mobilePhone},</if>
        </trim>
    </insert>

    <update id="updateRwkMeetingStaff" parameterType="RwkMeetingStaff">
        update rwk_meeting_staff
        <trim prefix="SET" suffixOverrides=",">
            <if test="meetingId != null">meeting_id = #{meetingId},</if>
            <if test="personnelName != null">personnel_name = #{personnelName},</if>
            <if test="isSign != null">is_sign = #{isSign},</if>
            <if test="personnelId != null">personnel_id = #{personnelId},</if>
            <if test="mobilePhone != null">mobile_phone = #{mobilePhone},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRwkMeetingStaffById" parameterType="Long">
        delete from rwk_meeting_staff where id = #{id}
    </delete>

    <delete id="deleteRwkMeetingStaffByIds" parameterType="String">
        delete from rwk_meeting_staff where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>