<?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.PtChartMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.interfaces.domain.PtChart">
        <id column="CODE" jdbcType="VARCHAR" property="code"/>
        <result column="TITLE" jdbcType="VARCHAR" property="title"/>
        <result column="TYPE" jdbcType="VARCHAR" property="type"/>
        <result column="URL" jdbcType="VARCHAR" property="url"/>
        <result column="METHOD" jdbcType="VARCHAR" property="method"/>
        <result column="THUMB" jdbcType="VARCHAR" property="thumb"/>
        <result column="STATUS" jdbcType="VARCHAR" property="status"/>
        <result column="SUPPLY" jdbcType="VARCHAR" property="supply"/>
        <result column="PUB_USER" jdbcType="VARCHAR" property="pubUser"/>
        <result column="PUB_TIME" jdbcType="TIMESTAMP" property="pubTime"/>
        <result column="COMPONENT" jdbcType="VARCHAR" property="component"/>
        <result column="CHART_MESS" jdbcType="VARCHAR" property="chartMess"/>
        <result column="NOTE" jdbcType="CLOB" property="note"/>
        <result column="CATE_CODE" jdbcType="VARCHAR" property="cateCode"/>
    </resultMap>
    <sql id="Base_Column_List">
        CODE
        , TITLE, TYPE, URL, METHOD, THUMB, STATUS, SUPPLY, PUB_USER, PUB_TIME,COMPONENT,CHART_MESS,CATE_CODE
    </sql>
    <sql id="Blob_Column_List">
        NOTE
    </sql>

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

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

    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtChart">
        insert into PT_CHART (CODE, TITLE, TYPE,
                              URL, METHOD, THUMB,
                              STATUS, SUPPLY, PUB_USER,
                              PUB_TIME, NOTE, COMPONENT, CHART_MESS, CATE_CODE)
        values (#{code,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
                #{url,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{thumb,jdbcType=VARCHAR},
                #{status,jdbcType=VARCHAR}, #{supply,jdbcType=VARCHAR}, #{pubUser,jdbcType=VARCHAR},
                #{pubTime,jdbcType=TIMESTAMP}, #{note,jdbcType=CLOB}, #{component,jdbcType=VARCHAR},
                #{chartMess}，#{cateCode})
    </insert>

    <update id="updateByPrimaryKey" parameterType="com.ruoyi.interfaces.domain.PtChart">
        update PT_CHART
        <set>
            <if test="title != null">
                TITLE = #{title,jdbcType=VARCHAR},
            </if>
            <if test="type != null">
                TYPE = #{type,jdbcType=VARCHAR},
            </if>
            <if test="url != null">
                URL = #{url,jdbcType=VARCHAR},
            </if>
            <if test="method != null">
                METHOD = #{method,jdbcType=VARCHAR},
            </if>
            <if test="thumb != null">
                THUMB = #{thumb,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                STATUS = #{status,jdbcType=VARCHAR},
            </if>
            <if test="supply != null">
                SUPPLY = #{supply,jdbcType=VARCHAR},
            </if>
            <if test="pubUser != null">
                PUB_USER = #{pubUser,jdbcType=VARCHAR},
            </if>
            <if test="component != null">
                COMPONENT = #{component,jdbcType=VARCHAR},
            </if>
            <if test="pubTime != null">
                PUB_TIME = #{pubTime,jdbcType=TIMESTAMP},
            </if>
            <if test="note != null">
                NOTE = #{note,jdbcType=CLOB},
            </if>
            <if test="chartMess != null">
                CHART_MESS = #{chartMess,jdbcType=CLOB},
            </if>
            <if test="cateCode != null">
                CATE_CODE = #{cateCode,jdbcType=CLOB},
            </if>
        </set>
        where CODE = #{code,jdbcType=VARCHAR}
    </update>

    <select id="selectAll" resultMap="BaseResultMap" parameterType="com.ruoyi.interfaces.domain.PtChart">
        select
        <include refid="Base_Column_List"/>
        ,
        <include refid="Blob_Column_List"/>
        from PT_CHART
        <if test="cateCode !=null and cateCode !=''">
            where CATE_CODE = #{cateCode}
        </if>
    </select>
    <cache/>


    <select id="findById" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>

        from PT_CHART where CODE = #{code,jdbcType=VARCHAR}
    </select>
</mapper>
