<?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.IitMyselfFileMapper">

    <resultMap type="IitMyselfFile" id="IitMyselfFileResult">
        <result property="id"    column="id"    />
        <result property="fileId"    column="file_id"    />
        <result property="userId"    column="user_id"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectIitMyselfFileVo">
        select id, file_id, user_id, create_time from iit_myself_file
    </sql>

    <select id="selectIitMyselfFileList" parameterType="IitMyselfFile" resultMap="IitMyselfFileResult">
        <include refid="selectIitMyselfFileVo"/>
        <where>
        </where>
    </select>

    <select id="selectIitMyselfFileById" parameterType="Long" resultMap="IitMyselfFileResult">
        <include refid="selectIitMyselfFileVo"/>
        where id = #{id}
    </select>

    <insert id="insertIitMyselfFile" parameterType="IitMyselfFile" useGeneratedKeys="true" keyProperty="id">
        insert into iit_myself_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fileId != null">file_id,</if>
            <if test="userId != null">user_id,</if>
            <if test="createTime != null">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fileId != null">#{fileId},</if>
            <if test="userId != null">#{userId},</if>
            <if test="createTime != null">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateIitMyselfFile" parameterType="IitMyselfFile">
        update iit_myself_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="fileId != null">file_id = #{fileId},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIitMyselfFileById" parameterType="Long">
        delete from iit_myself_file where id = #{id}
    </delete>

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

    <select id="selectCountByUserId" parameterType="Long" resultType="Integer">
        select count(*) from iit_myself_file where user_id = #{userId}
    </select>
</mapper>
