<?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.ruoyi.config.mapper.MeetingConfigMapper">

    <resultMap type="MeetingConfig" id="MeetingConfigResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="ky"    column="ky"    />
        <result property="val"    column="val"    />
    </resultMap>

    <sql id="selectMeetingConfigVo">
        select id, name, ky, val from meeting_config
    </sql>

    <select id="selectMeetingConfigList" parameterType="MeetingConfig" resultMap="MeetingConfigResult">
        <include refid="selectMeetingConfigVo"/>
        <where>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="ky != null  and ky != ''"> and ky = #{ky}</if>
            <if test="val != null  and val != ''"> and val = #{val}</if>
        </where>
    </select>

    <select id="selectMeetingConfigById" parameterType="Long" resultMap="MeetingConfigResult">
        <include refid="selectMeetingConfigVo"/>
        where id = #{id}
    </select>

    <insert id="insertMeetingConfig" parameterType="MeetingConfig">
        insert into meeting_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="name != null">name,</if>
            <if test="ky != null">ky,</if>
            <if test="val != null">val,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="ky != null">#{ky},</if>
            <if test="val != null">#{val},</if>
         </trim>
    </insert>

    <update id="updateMeetingConfig" parameterType="MeetingConfig">
        update meeting_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="ky != null">ky = #{ky},</if>
            <if test="val != null">val = #{val},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMeetingConfigById" parameterType="Long">
        delete from meeting_config where id = #{id}
    </delete>

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

</mapper>
