<?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.mall.mapper.MallUploadFileMapper">
    
    <resultMap type="MallUploadFile" id="MallUploadFileResult">
        <result property="id"    column="id"    />
        <result property="filePath"    column="file_path"    />
        <result property="fileRealPath"    column="file_real_path"    />
        <result property="resId"    column="res_id"    />
    </resultMap>

    <sql id="selectMallUploadFileVo">
        select id, file_path, file_real_path, res_id from mall_upload_file
    </sql>

    <select id="selectMallUploadFileList" parameterType="MallUploadFile" resultMap="MallUploadFileResult">
        <include refid="selectMallUploadFileVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectMallUploadFileById" parameterType="String" resultMap="MallUploadFileResult">
        <include refid="selectMallUploadFileVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMallUploadFile" parameterType="MallUploadFile">
        insert into mall_upload_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="filePath != null">file_path,</if>
            <if test="fileRealPath != null">file_real_path,</if>
            <if test="resId != null">res_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="filePath != null">#{filePath},</if>
            <if test="fileRealPath != null">#{fileRealPath},</if>
            <if test="resId != null">#{resId},</if>
         </trim>
    </insert>

    <update id="updateMallUploadFile" parameterType="MallUploadFile">
        update mall_upload_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="filePath != null">file_path = #{filePath},</if>
            <if test="fileRealPath != null">file_real_path = #{fileRealPath},</if>
            <if test="resId != null">res_id = #{resId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMallUploadFileById" parameterType="String">
        delete from mall_upload_file where id = #{id}
    </delete>

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