<?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.interfaces.mapper.PtServiceFileDao">
    <resultMap type="com.ruoyi.interfaces.domain.PtServiceFile" id="ptServiceFileResultMap">
        <result property="fileId" column="FILE_ID" jdbcType="VARCHAR"/>
        <result property="code" column="CODE" jdbcType="VARCHAR"/>
        <result property="relId" column="REL_ID" jdbcType="VARCHAR"/>
        <result property="fileType" column="FILE_TYPE" jdbcType="VARCHAR"/>
        <result property="filePath" column="FILE_PATH" jdbcType="VARCHAR"/>
        <result property="fileSavename" column="FILE_SAVENAME" jdbcType="VARCHAR"/>
        <result property="fileViewname" column="FILE_VIEWNAME" jdbcType="VARCHAR"/>
        <result property="fileTime" column="FILE_TIME" jdbcType="TIMESTAMP"/>
        <result property="fileSize" column="FILE_SIZE" jdbcType="VARCHAR"/>
        <result property="fileStatus" column="FILE_STATUS" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="table_columns">
        FILE_ID
        ,
		CODE,
		REL_ID,
		FILE_TYPE,
		FILE_PATH,
		FILE_SAVENAME,
		FILE_VIEWNAME,
		FILE_TIME,
		FILE_SIZE,
		FILE_STATUS
    </sql>
    <sql id="entity_properties">
        #{fileId,jdbcType=VARCHAR}
        ,
        #{code,jdbcType=VARCHAR},
        #{relId,jdbcType=VARCHAR},
        #{fileType,jdbcType=VARCHAR},
        #{filePath,jdbcType=VARCHAR},
        #{fileSavename,jdbcType=VARCHAR},
        #{fileViewname,jdbcType=VARCHAR},
        #{fileTime,jdbcType=TIMESTAMP},
        #{fileSize,jdbcType=VARCHAR},
        #{fileStatus,jdbcType=VARCHAR}
    </sql>


    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtServiceFile">
        insert into PT_SERVICE_FILE(
        <include refid="table_columns"/>
        )
        values (
        <include refid="entity_properties"/>
        )
    </insert>

    <select id="selectByPrimaryKey" resultMap="ptServiceFileResultMap" parameterType="java.lang.String">
        select
        <include refid="table_columns"/>
        from PT_SERVICE_FILE
        <where>
            <if test="fileId != null and fileId !=''">
                and FILE_ID = #{fileId,jdbcType=VARCHAR}
            </if>
            <if test="relId != null and relId !=''">
                and REL_ID = #{relId,jdbcType=VARCHAR}
            </if>
        </where>
    </select>

    <select id="selectAll" resultMap="ptServiceFileResultMap" parameterType="java.lang.String">
        select
        <include refid="table_columns"/>
        from PT_SERVICE_FILE
        where REL_ID = #{relId,jdbcType=VARCHAR}
    </select>

    <update id="updateByPrimaryKey" parameterType="com.ruoyi.interfaces.domain.PtServiceFile">
        update PT_SERVICE_FILE
        <set>
            <if test="code != null and code !=''">
                CODE = #{code,jdbcType=VARCHAR},
            </if>
            <if test="relId != null and relId !=''">
                REL_ID = #{relId,jdbcType=VARCHAR},
            </if>
            <if test="fileType != null and fileType !=''">
                FILE_TYPE = #{fileType,jdbcType=VARCHAR},
            </if>
            <if test="filePath != null and filePath !=''">
                FILE_PATH = #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="fileSavename != null and fileSavename !=''">
                FILE_SAVENAME = #{fileSavename,jdbcType=VARCHAR},
            </if>
            <if test="fileViewname != null and fileViewname !=''">
                FILE_VIEWNAME = #{fileViewname,jdbcType=VARCHAR},
            </if>
            <if test="fileTime != null and fileTime !=''">
                FILE_TIME = #{fileTime,jdbcType=VARCHAR},
            </if>
            <if test="fileSize != null and fileSize !=''">
                FILE_SIZE = #{fileSize,jdbcType=VARCHAR},
            </if>
            <if test="fileStatus != null and fileStatus !=''">
                FILE_STATUS = #{fileStatus,jdbcType=VARCHAR},
            </if>
        </set>
        where FILE_ID = #{id,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        delete
        from PT_SERVICE_FILE
        where FILE_ID = #{id,jdbcType=VARCHAR}
    </delete>

</mapper>
