<?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="cn.fateverse.workflow.mapper.ProcessFileMapper">


    <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
        insert into wk_process_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fileName != null and fileName != ''">file_name,</if>
            <if test="originalFilename != null and originalFilename != ''">original_filename,</if>
            <if test="url != null and url != ''">url,</if>
            <if test="uri != null and uri != ''">uri,</if>
            <if test="fileType != null and fileType != ''">file_type,</if>
            <if test="size != null ">size,</if>
            <if test="isImage != null ">is_images,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fileName != null and fileName != ''">#{fileName},</if>
            <if test="originalFilename != null and originalFilename != ''">#{originalFilename},</if>
            <if test="url != null and url != ''">#{url},</if>
            <if test="uri != null and uri != ''">#{uri},</if>
            <if test="fileType != null and fileType != ''">#{fileType},</if>
            <if test="size != null ">#{size},</if>
            <if test="isImage != null ">#{isImage},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
        </trim>
    </insert>
    <delete id="delete">
        delete
        from wk_process_file
        where id = #{fileId}
    </delete>
    <select id="selectById" resultType="cn.fateverse.workflow.entity.ProcessFile">
        select id, file_name, original_filename, url, uri, file_type, size, is_images, create_by, create_time
        from wk_process_file
        where id = #{fileId}
    </select>


</mapper>