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

    <resultMap type="LcdInfoUserRelation" id="LcdInfoUserRelationResult">
        <result property="id"    column="id"    />
        <result property="lcdInfoId"    column="lcd_info_id"    />
        <result property="lcdReceiveUserId"    column="lcd_receive_user_id"    />
        <result property="createAt"    column="create_at"    />
        <result property="updateAt"    column="update_at"    />
    </resultMap>

    <sql id="selectLcdInfoUserRelationVo">
        select id, lcd_info_id, lcd_receive_user_id, create_at, update_at from lcd_info_user_relation
    </sql>

    <select id="selectLcdInfoUserRelationList" parameterType="LcdInfoUserRelation" resultMap="LcdInfoUserRelationResult">
        <include refid="selectLcdInfoUserRelationVo"/>
        <where>
            <if test="lcdInfoId != null "> and lcd_info_id = #{lcdInfoId}</if>
            <if test="lcdReceiveUserId != null "> and lcd_receive_user_id = #{lcdReceiveUserId}</if>
            <if test="createAt != null "> and create_at = #{createAt}</if>
            <if test="updateAt != null "> and update_at = #{updateAt}</if>
        </where>
    </select>

    <select id="selectLcdInfoUserRelationById" parameterType="Long" resultMap="LcdInfoUserRelationResult">
        <include refid="selectLcdInfoUserRelationVo"/>
        where id = #{id}
    </select>

    <insert id="insertLcdInfoUserRelation" parameterType="LcdInfoUserRelation" useGeneratedKeys="true" keyProperty="id">
        insert into lcd_info_user_relation
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="lcdInfoId != null">lcd_info_id,</if>
            <if test="lcdReceiveUserId != null">lcd_receive_user_id,</if>
            <if test="createAt != null">create_at,</if>
            <if test="updateAt != null">update_at,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="lcdInfoId != null">#{lcdInfoId},</if>
            <if test="lcdReceiveUserId != null">#{lcdReceiveUserId},</if>
            <if test="createAt != null">#{createAt},</if>
            <if test="updateAt != null">#{updateAt},</if>
        </trim>
    </insert>

    <update id="updateLcdInfoUserRelation" parameterType="LcdInfoUserRelation">
        update lcd_info_user_relation
        <trim prefix="SET" suffixOverrides=",">
            <if test="lcdInfoId != null">lcd_info_id = #{lcdInfoId},</if>
            <if test="lcdReceiveUserId != null">lcd_receive_user_id = #{lcdReceiveUserId},</if>
            <if test="createAt != null">create_at = #{createAt},</if>
            <if test="updateAt != null">update_at = #{updateAt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLcdInfoUserRelationById" parameterType="Long">
        delete from lcd_info_user_relation where lcd_info_id = #{id}
    </delete>

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