<?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.iit.mapper.IitFileImageMapper">

    <resultMap type="IitFileImage" id="IitFileImageResult">
        <result property="id"    column="id"    />
        <result property="fileId"    column="file_id"    />
        <result property="imageUrl"    column="image_url"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectIitFileImageVo">
        select id, file_id, image_url, create_time from iit_file_image
    </sql>

    <select id="selectIitFileImageList" parameterType="IitFileImage" resultMap="IitFileImageResult">
        <include refid="selectIitFileImageVo"/>
        <where>
            <if test="fileId != null "> and file_id = #{fileId}</if>
        </where>
    </select>

    <select id="selectIitFileImageById" parameterType="Long" resultMap="IitFileImageResult">
        <include refid="selectIitFileImageVo"/>
        where id = #{id}
    </select>

    <insert id="insertIitFileImage" parameterType="IitFileImage">
        insert into iit_file_image
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="fileId != null">file_id,</if>
            <if test="imageUrl != null">image_url,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="fileId != null">#{fileId},</if>
            <if test="imageUrl != null">#{imageUrl},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateIitFileImage" parameterType="IitFileImage">
        update iit_file_image
        <trim prefix="SET" suffixOverrides=",">
            <if test="fileId != null">file_id = #{fileId},</if>
            <if test="imageUrl != null">image_url = #{imageUrl},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIitFileImageById" parameterType="Long">
        delete from iit_file_image where id = #{id}
    </delete>

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