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

    <resultMap type="com.ruoyi.interfaces.domain.PtHelpFile" id="ptHelpFileResultMap">
        <result property="id" column="ID" jdbcType="VARCHAR"/>
        <result property="code" column="CODE" jdbcType="VARCHAR"/>
        <result property="relId" column="REL_ID" jdbcType="VARCHAR"/>
        <result property="type" column="TYPE" jdbcType="VARCHAR"/>
        <result property="path" column="PATH" jdbcType="VARCHAR"/>
        <result property="saveName" column="SAVE_NAME" jdbcType="VARCHAR"/>
        <result property="name" column="NAME" jdbcType="VARCHAR"/>
        <result property="intm" column="INTM" jdbcType="DATE"/>
        <result property="size" column="SIZE" jdbcType="VARCHAR"/>
        <result property="status" column="STATUS" jdbcType="VARCHAR"/>
        <result property="viewNum" column="VIEW_NUM" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="table_columns">
        ID
        ,
            CODE,
            REL_ID,
            `TYPE`,
            PATH,
            SAVE_NAME,
            `NAME`,
            INTM,
            `SIZE`,
            STATUS,
            VIEW_NUM
    </sql>
    <sql id="entity_properties">
        #{id,jdbcType=VARCHAR}
        ,
        #{code,jdbcType=VARCHAR},
        #{relId,jdbcType=VARCHAR},
        #{type,jdbcType=VARCHAR},
        #{path,jdbcType=VARCHAR},
        #{saveName,jdbcType=VARCHAR},
        #{name,jdbcType=VARCHAR},
        #{intm,jdbcType=DATE},
        #{size,jdbcType=VARCHAR},
        #{status,jdbcType=VARCHAR},
        #{viewNum,jdbcType=BIGINT}
    </sql>

    <!-- 使用like用法：columnName like concat('%',#columnName#,'%') -->
    <sql id="page_where">
        <trim prefix="where" prefixOverrides="and | or ">
            <if test="code != null and code != ''">and CODE = #{code}</if>
            <if test="relId != null and relId != ''">and REL_ID = #{relId}</if>
            <if test="type != null and type != ''">and TYPE = #{type}</if>
            <if test="path != null and path != ''">and PATH = #{path}</if>
            <if test="saveName != null and saveName != ''">and SAVE_NAME = #{saveName}</if>
            <if test="name != null and name != ''">and NAME = #{name}</if>
            <if test="intm != null">and INTM = #{intm}</if>
            <if test="size != null and size != ''">and SIZE = #{size}</if>
            <if test="status != null and status != ''">and STATUS = #{status}</if>
            <if test="viewNum != null and viewNum != ''">and VIEW_NUM = #{viewNum}</if>
        </trim>
    </sql>


    <select id="get" resultMap="ptHelpFileResultMap" parameterType="String">
        select
        <include refid="table_columns"/>
        from PT_HELP_FILE where ID = #{id}
    </select>

    <select id="getBy" resultMap="ptHelpFileResultMap">
        select
        <include refid="table_columns"/>
        from PT_HELP_FILE
        <include refid="page_where"/>
    </select>

    <select id="findList" resultMap="ptHelpFileResultMap">
        select
        <include refid="table_columns"/>
        from PT_HELP_FILE
        <include refid="page_where"/>
    </select>

    <select id="list" resultMap="ptHelpFileResultMap">
        select
        <include refid="table_columns"/>
        from PT_HELP_FILE
        <include refid="page_where"/>
    </select>

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

    <delete id="delete" parameterType="java.lang.String">
        delete
        from PT_HELP_FILE
        where ID = #{id}
    </delete>

    <update id="update" parameterType="com.ruoyi.interfaces.domain.PtHelpFile">
        update PT_HELP_FILE
        <trim prefix="set" suffixOverrides=",">
            <if test="code != null and code != ''">CODE = #{code},</if>
            <if test="relId != null and relId != ''">REL_ID = #{relId},</if>
            <if test="type != null and type != ''">TYPE = #{type},</if>
            <if test="path != null and path != ''">PATH = #{path},</if>
            <if test="saveName != null and saveName != ''">SAVE_NAME = #{saveName},</if>
            <if test="name != null and name != ''">NAME = #{name},</if>
            <if test="intm != null">INTM = #{intm},</if>
            <if test="size != null and size != ''">SIZE = #{size},</if>
            <if test="status != null and status != ''">STATUS = #{status},</if>
            <if test="viewNum != null and viewNum != ''">VIEW_NUM = #{viewNum},</if>
        </trim>
        <where>ID = #{id}</where>
    </update>

</mapper>
