<?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.PtAppMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.interfaces.domain.PtApp">
        <id column="APP_ID" jdbcType="VARCHAR" property="appId"/>
        <result column="APP_NAME" jdbcType="VARCHAR" property="appName"/>
        <result column="APP_URL" jdbcType="VARCHAR" property="appUrl"/>
        <result column="APP_DEVELOPER" jdbcType="VARCHAR" property="appDeveloper"/>
        <result column="APP_NOTE" jdbcType="VARCHAR" property="appNote"/>
        <result column="APP_PUBLISH" jdbcType="TIMESTAMP" property="appPublish"/>
        <result column="APP_STATE" jdbcType="VARCHAR" property="appState"/>
        <result column="APP_CATE" jdbcType="VARCHAR" property="appCate"/>
        <result column="APP_SECRET" jdbcType="VARCHAR" property="appSecret"/>
        <result column="APP_TOKEN" jdbcType="VARCHAR" property="appToken"/>
        <result column="AUDIT_USER" jdbcType="VARCHAR" property="auditUser"/>
        <result column="AUDIT_TIME" jdbcType="TIMESTAMP" property="auditTime"/>
        <result column="RQ_TIME" jdbcType="TIMESTAMP" property="rqTime"/>
        <result column="RQ_TIME" jdbcType="TIMESTAMP" property="rqTime"/>
        <result column="USER_ID" jdbcType="VARCHAR" property="userId"/>
        <result column="APP_TYPE" jdbcType="VARCHAR" property="appType"/>
        <result column="APP_FIELD" jdbcType="VARCHAR" property="appField"/>
    </resultMap>
    <sql id="Base_Column_List">
        APP_ID
        , APP_NAME, APP_URL, APP_DEVELOPER, APP_NOTE, APP_PUBLISH, APP_STATE, APP_CATE, APP_TYPE, APP_FIELD,
    APP_SECRET, APP_TOKEN, AUDIT_USER, AUDIT_TIME, RQ_TIME, USER_ID
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from PT_APP
        where APP_ID = #{appId,jdbcType=VARCHAR}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        delete
        from PT_APP
        where APP_ID = #{appId,jdbcType=VARCHAR}
    </delete>
    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtApp">
        insert into PT_APP (APP_ID, APP_NAME, APP_URL,
                            APP_DEVELOPER, APP_NOTE, APP_PUBLISH,
                            APP_STATE, APP_CATE, APP_SECRET,
                            APP_TOKEN, AUDIT_USER, AUDIT_TIME,
                            RQ_TIME, USER_ID, APP_TYPE, APP_FIELD)
        values (#{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR}, #{appUrl,jdbcType=VARCHAR},
                #{appDeveloper,jdbcType=VARCHAR}, #{appNote,jdbcType=VARCHAR}, #{appPublish,jdbcType=TIMESTAMP},
                #{appState,jdbcType=VARCHAR}, #{appCate,jdbcType=VARCHAR}, #{appSecret,jdbcType=VARCHAR},
                #{appToken,jdbcType=VARCHAR}, #{auditUser,jdbcType=VARCHAR}, #{auditTime,jdbcType=TIMESTAMP},
                #{rqTime,jdbcType=TIMESTAMP}, #{userId,jdbcType=VARCHAR},
                #{appType,jdbcType=VARCHAR}, #{appField,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.ruoyi.interfaces.domain.PtApp">
        insert into PT_APP
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="appId != null">
                APP_ID,
            </if>
            <if test="appName != null">
                APP_NAME,
            </if>
            <if test="appUrl != null">
                APP_URL,
            </if>
            <if test="appDeveloper != null">
                APP_DEVELOPER,
            </if>
            <if test="appNote != null">
                APP_NOTE,
            </if>
            <if test="appPublish != null">
                APP_PUBLISH,
            </if>
            <if test="appState != null">
                APP_STATE,
            </if>
            <if test="appCate != null">
                APP_CATE,
            </if>
            <if test="appSecret != null">
                APP_SECRET,
            </if>
            <if test="appToken != null">
                APP_TOKEN,
            </if>
            <if test="auditUser != null">
                AUDIT_USER,
            </if>
            <if test="auditTime != null">
                AUDIT_TIME,
            </if>
            <if test="rqTime != null">
                RQ_TIME,
            </if>
            <if test="userId != null">
                USER_ID,
            </if>
            <if test="appType != null">
                APP_TYPE,
            </if>
            <if test="appField != null">
                APP_FIELD,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="appId != null">
                #{appId,jdbcType=VARCHAR},
            </if>
            <if test="appName != null">
                #{appName,jdbcType=VARCHAR},
            </if>
            <if test="appUrl != null">
                #{appUrl,jdbcType=VARCHAR},
            </if>
            <if test="appDeveloper != null">
                #{appDeveloper,jdbcType=VARCHAR},
            </if>
            <if test="appNote != null">
                #{appNote,jdbcType=VARCHAR},
            </if>
            <if test="appPublish != null">
                #{appPublish,jdbcType=TIMESTAMP},
            </if>
            <if test="appState != null">
                #{appState,jdbcType=VARCHAR},
            </if>
            <if test="appCate != null">
                #{appCate,jdbcType=VARCHAR},
            </if>
            <if test="appSecret != null">
                #{appSecret,jdbcType=VARCHAR},
            </if>
            <if test="appToken != null">
                #{appToken,jdbcType=VARCHAR},
            </if>
            <if test="auditUser != null">
                #{auditUser,jdbcType=VARCHAR},
            </if>
            <if test="auditTime != null">
                #{auditTime,jdbcType=TIMESTAMP},
            </if>
            <if test="rqTime != null">
                #{rqTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userId != null">
                #{userId,jdbcType=VARCHAR},
            </if>
            <if test="appType != null">
                #{appType,jdbcType=VARCHAR},
            </if>
            <if test="appField != null">
                #{appField,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.interfaces.domain.PtApp">
        update PT_APP
        <set>
            <if test="appName != null">
                APP_NAME = #{appName,jdbcType=VARCHAR},
            </if>
            <if test="appUrl != null">
                APP_URL = #{appUrl,jdbcType=VARCHAR},
            </if>
            <if test="appDeveloper != null">
                APP_DEVELOPER = #{appDeveloper,jdbcType=VARCHAR},
            </if>
            <if test="appNote != null">
                APP_NOTE = #{appNote,jdbcType=VARCHAR},
            </if>
            <if test="appPublish != null">
                APP_PUBLISH = #{appPublish,jdbcType=TIMESTAMP},
            </if>
            <if test="appState != null">
                APP_STATE = #{appState,jdbcType=VARCHAR},
            </if>
            <if test="appCate != null">
                APP_CATE = #{appCate,jdbcType=VARCHAR},
            </if>
            <if test="appSecret != null">
                APP_SECRET = #{appSecret,jdbcType=VARCHAR},
            </if>
            <if test="appToken != null">
                APP_TOKEN = #{appToken,jdbcType=VARCHAR},
            </if>
            <if test="auditUser != null">
                AUDIT_USER = #{auditUser,jdbcType=VARCHAR},
            </if>
            <if test="auditTime != null">
                AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
            </if>
            <if test="rqTime != null">
                RQ_TIME = #{rqTime,jdbcType=TIMESTAMP},
            </if>
            <if test="userId != null">
                USER_ID = #{userId,jdbcType=VARCHAR},
            </if>
            <if test="appType != null">
                APP_TYPE = #{appType,jdbcType=VARCHAR},
            </if>
            <if test="appField != null">
                APP_FIELD = #{appField,jdbcType=VARCHAR},
            </if>
        </set>
        where APP_ID = #{appId,jdbcType=VARCHAR}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.ruoyi.interfaces.domain.PtApp">
        update PT_APP
        set APP_NAME      = #{appName,jdbcType=VARCHAR},
            APP_URL       = #{appUrl,jdbcType=VARCHAR},
            APP_DEVELOPER = #{appDeveloper,jdbcType=VARCHAR},
            APP_NOTE      = #{appNote,jdbcType=VARCHAR},
            APP_PUBLISH   = #{appPublish,jdbcType=TIMESTAMP},
            APP_STATE     = #{appState,jdbcType=VARCHAR},
            APP_CATE      = #{appCate,jdbcType=VARCHAR},
            APP_SECRET    = #{appSecret,jdbcType=VARCHAR},
            APP_TOKEN     = #{appToken,jdbcType=VARCHAR},
            AUDIT_USER    = #{auditUser,jdbcType=VARCHAR},
            AUDIT_TIME    = #{auditTime,jdbcType=TIMESTAMP},
            RQ_TIME       = #{rqTime,jdbcType=TIMESTAMP},
            USER_ID       = #{userId,jdbcType=VARCHAR},
            APP_TYPE      = #{appType,jdbcType=VARCHAR},
            APP_FIELD     = #{appField,jdbcType=VARCHAR}
        where APP_ID = #{appId,jdbcType=VARCHAR}
    </update>
    <select id="selectAll" parameterType="com.ruoyi.interfaces.domain.PtApp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from PT_APP
        <where>
            <if test="appName != null and appName !=''">
                APP_NAME like CONCAT('%', CONCAT(#{appName}, '%'))
            </if>
            <if test="userId != null and userId !=''">
                AND USER_ID = #{userId}
            </if>
        </where>
    </select>
    <select id="listByIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from PT_APP
        where APP_ID IN
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
</mapper>
