<?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.PtAppApplyDao">
    <resultMap type="com.ruoyi.interfaces.domain.PtAppApply" id="ptAppApplyResultMap">
        <result property="userId" column="USER_ID" jdbcType="VARCHAR"/>
        <result property="appId" column="APP_ID" jdbcType="VARCHAR"/>
        <result property="appName" column="APP_NAME" jdbcType="VARCHAR"/>
        <result property="appSecret" column="APP_SECRET" jdbcType="VARCHAR"/>
        <result property="rqTime" column="RQ_TIME" jdbcType="TIMESTAMP"/>
        <result property="rqUnit" column="RQ_UNIT" jdbcType="VARCHAR"/>
        <result property="rqName" column="RQ_NAME" jdbcType="VARCHAR"/>
        <result property="rqCity" column="RQ_CITY" jdbcType="VARCHAR"/>
        <result property="rqTele" column="RQ_TELE" jdbcType="VARCHAR"/>
        <result property="rqMail" column="RQ_MAIL" jdbcType="VARCHAR"/>
        <result property="rqAddr" column="RQ_ADDR" jdbcType="VARCHAR"/>
        <result property="state" column="STATE" jdbcType="VARCHAR"/>
        <result property="adTime" column="AD_TIME" jdbcType="TIMESTAMP"/>
        <result property="adUser" column="AD_USER" jdbcType="VARCHAR"/>
        <result property="adId" column="AD_ID" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="table_columns">
        USER_ID
        ,
		APP_ID,
		APP_NAME,
		APP_SECRET,
		RQ_TIME,
		RQ_UNIT,
		RQ_NAME,
		RQ_CITY,
		RQ_TELE,
		RQ_MAIL,
		RQ_ADDR,
		STATE,
		AD_TIME,
		AD_USER,
		AD_ID
    </sql>
    <sql id="entity_properties">
        #{userId,jdbcType=VARCHAR}
        ,
        #{appId,jdbcType=VARCHAR},
        #{appName,jdbcType=VARCHAR},
        #{appSecret,jdbcType=VARCHAR},
        #{rqTime,jdbcType=VARCHAR},
        #{rqUnit,jdbcType=VARCHAR},
        #{rqName,jdbcType=VARCHAR},
        #{rqCity,jdbcType=VARCHAR},
        #{rqTele,jdbcType=VARCHAR},
        #{rqMail,jdbcType=VARCHAR},
        #{rqAddr,jdbcType=VARCHAR},
        #{state,jdbcType=VARCHAR},
        #{adTime,jdbcType=VARCHAR},
        #{adUser,jdbcType=VARCHAR},
        #{adId,jdbcType=VARCHAR}
    </sql>


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

    <select id="selectByPrimaryKey" resultMap="ptAppApplyResultMap"
            parameterType="com.ruoyi.interfaces.domain.PtAppApply">
        select
        <include refid="table_columns"/>
        from PT_APP_APPLY
        where 1=1
        <if test="userId != null and userId !=''">
            and USER_ID = #{userId,jdbcType=VARCHAR}
        </if>
        <if test="appId != null and appId !=''">
            and APP_ID = #{appId,jdbcType=VARCHAR}
        </if>
    </select>

    <update id="updateByPrimaryKey" parameterType="com.ruoyi.interfaces.domain.PtAppApply">
        update PT_APP_APPLY
        <set>
            <if test="appName != null and appName !=''">
                APP_NAME = #{appName,jdbcType=VARCHAR},
            </if>
            <if test="appSecret != null and appSecret !=''">
                APP_SECRET = #{appSecret,jdbcType=VARCHAR},
            </if>
            <if test="rqTime != null and rqTime !=''">
                RQ_TIME = #{rqTime,jdbcType=TIMESTAMP},
            </if>
            <if test="rqUnit != null and rqUnit !=''">
                RQ_UNIT = #{rqUnit,jdbcType=VARCHAR},
            </if>
            <if test="rqName != null and rqName !=''">
                RQ_NAME = #{rqName,jdbcType=VARCHAR},
            </if>
            <if test="rqCity != null and rqCity !=''">
                RQ_CITY = #{rqCity,jdbcType=VARCHAR},
            </if>
            <if test="rqTele != null and rqTele !=''">
                RQ_TELE = #{rqTele,jdbcType=VARCHAR},
            </if>
            <if test="rqMail != null and rqMail !=''">
                RQ_MAIL = #{rqMail,jdbcType=VARCHAR},
            </if>
            <if test="rqAddr != null and rqAddr !=''">
                RQ_ADDR = #{rqAddr,jdbcType=VARCHAR},
            </if>
            <if test="state != null and state !=''">
                STATE = #{state,jdbcType=VARCHAR},
            </if>
            <if test="adTime != null and adTime !=''">
                AD_TIME = #{adTime,jdbcType=TIMESTAMP},
            </if>
            <if test="adUser != null and adUser !=''">
                AD_USER = #{adUser,jdbcType=VARCHAR},
            </if>
            <if test="adId != null and adId !=''">
                AD_ID = #{adId,jdbcType=VARCHAR},
            </if>
        </set>
        where USER_ID = #{userId,jdbcType=VARCHAR} and APP_ID = #{appId,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByPrimaryKey" parameterType="com.ruoyi.interfaces.domain.PtAppApply">
        delete
        from PT_APP_APPLY
        where USER_ID = #{userId,jdbcType=VARCHAR}
          and APP_ID = #{appId,jdbcType=VARCHAR}
    </delete>

</mapper>
