<?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.PtChartFileMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.interfaces.domain.PtChartFile">
        <id column="FILE_ID" jdbcType="VARCHAR" property="fileId"/>
        <result column="CODE" jdbcType="VARCHAR" property="code"/>
        <result column="REL_ID" jdbcType="VARCHAR" property="relId"/>
        <result column="FILE_TYPE" jdbcType="VARCHAR" property="fileType"/>
        <result column="FILE_PATH" jdbcType="VARCHAR" property="filePath"/>
        <result column="FILE_SAVENAME" jdbcType="VARCHAR" property="fileSavename"/>
        <result column="FILE_VIEWNAME" jdbcType="VARCHAR" property="fileViewname"/>
        <result column="FILE_TIME" jdbcType="TIMESTAMP" property="fileTime"/>
    </resultMap>
    <sql id="Example_Where_Clause">
        <where>
            <foreach collection="oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
                                             separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Base_Column_List">
        FILE_ID
        , CODE, REL_ID, FILE_TYPE, FILE_PATH, FILE_SAVENAME, FILE_VIEWNAME, FILE_TIME
    </sql>

    <select id="selectByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from PT_CHART_FILE
        where CODE = #{code,jdbcType=VARCHAR}
    </select>

    <select id="selectByExample" parameterType="com.ruoyi.interfaces.domain.PtChartFileCriteria"
            resultMap="BaseResultMap">
        select
        <if test="distinct">
            distinct
        </if>
        'false' as QUERYID,
        <include refid="Base_Column_List"/>
        from PT_CHART_FILE
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from PT_CHART_FILE
        where FILE_ID = #{fileId,jdbcType=VARCHAR}
    </select>

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

    <delete id="deleteByCode" parameterType="java.lang.String">
        delete
        from PT_CHART_FILE
        where CODE = #{code,jdbcType=VARCHAR}
    </delete>

    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtChartFile">
        insert into PT_CHART_FILE (FILE_ID, CODE, REL_ID,
                                   FILE_TYPE, FILE_PATH, FILE_SAVENAME,
                                   FILE_VIEWNAME, FILE_TIME)
        values (#{fileId,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{relId,jdbcType=VARCHAR},
                #{fileType,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, #{fileSavename,jdbcType=VARCHAR},
                #{fileViewname,jdbcType=VARCHAR}, #{fileTime,jdbcType=TIMESTAMP})
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.interfaces.domain.PtChartFile">
        update PT_CHART_FILE
        <set>
            <if test="code != null">
                CODE = #{code,jdbcType=VARCHAR},
            </if>
            <if test="relId != null">
                REL_ID = #{relId,jdbcType=VARCHAR},
            </if>
            <if test="fileType != null">
                FILE_TYPE = #{fileType,jdbcType=VARCHAR},
            </if>
            <if test="filePath != null">
                FILE_PATH = #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="fileSavename != null">
                FILE_SAVENAME = #{fileSavename,jdbcType=VARCHAR},
            </if>
            <if test="fileViewname != null">
                FILE_VIEWNAME = #{fileViewname,jdbcType=VARCHAR},
            </if>
            <if test="fileTime != null">
                FILE_TIME = #{fileTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where FILE_ID = #{fileId,jdbcType=VARCHAR}
    </update>

    <!--
      <update id="updateByCode" parameterType="com.ruoyi.interfaces.domain.PtChartFile">
        update PT_CHART_FILE
        <set>
          <if test="code != null">
            CODE = #{code,jdbcType=VARCHAR},
          </if>
          <if test="relId != null">
            REL_ID = #{relId,jdbcType=VARCHAR},
          </if>
          <if test="fileType != null">
            FILE_TYPE = #{fileType,jdbcType=VARCHAR},
          </if>
          <if test="filePath != null">
            FILE_PATH = #{filePath,jdbcType=VARCHAR},
          </if>
          <if test="fileSavename != null">
            FILE_SAVENAME = #{fileSavename,jdbcType=VARCHAR},
          </if>
          <if test="fileViewname != null">
            FILE_VIEWNAME = #{fileViewname,jdbcType=VARCHAR},
          </if>
          <if test="fileTime != null">
            FILE_TIME = #{fileTime,jdbcType=TIMESTAMP},
          </if>
        </set>
        where CODE = #{code,jdbcType=VARCHAR}
      </update>
    -->


    <cache/>
</mapper>
