<?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.engine.organization.mapper.config.ConfigMapper">
    <resultMap id="BaseResultMap" type="com.engine.organization.entity.config.po.QTXConfigPO">
        <result column="id" property="id"/>
        <result column="app_secret" property="appSecret"/>
        <result column="url" property="url"/>
        <result column="pc_address" property="pcAddress"/>
        <result column="mobile_address" property="mobileAddress"/>
        <result column="second_url" property="secondUrl"/>
        <result column="creator" property="creator"/>
        <result column="createdate" property="createDate"/>
    </resultMap>


    <!-- 表字段 -->
    <sql id="baseColumns">
        t.id
        , t.app_secret
        , t.url
        , t.pc_address
        , t.mobile_address
        , t.second_url
        , t.creator
        , t.createdate
    </sql>


    <select id="selectConfigInfo" parameterType="com.engine.organization.entity.config.po.QTXConfigPO"
            resultMap="BaseResultMap">
        select
        <include refid="baseColumns"/>
        from JCL_ORG_QTXCONFIG t
    </select>

    <insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.config.po.QTXConfigPO" keyProperty="id"
            keyColumn="id" useGeneratedKeys="true">
        INSERT INTO JCL_ORG_QTXCONFIG
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="appSecret != null">
                app_secret,
            </if>
            <if test="url != null">
                url,
            </if>
            <if test="pcAddress != null">
                pc_address,
            </if>
            <if test="mobileAddress != null">
                mobile_address,
            </if>
            <if test="secondUrl != null ">
                second_url,
            </if>
            <if test="creator != null ">
                creator,
            </if>
            <if test="createDate != null ">
                createdate,
            </if>
        </trim>
        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
            <if test="appSecret != null">
                #{appSecret},
            </if>
            <if test="url != null">
                #{url},
            </if>
            <if test="pcAddress != null">
                #{pcAddress},
            </if>
            <if test="mobileAddress != null">
                #{mobileAddress},
            </if>
            <if test="secondUrl != null ">
                #{secondUrl},
            </if>
            <if test="creator != null ">
                #{creator},
            </if>
            <if test="createDate != null ">
                #{createDate},
            </if>
        </trim>
    </insert>

    <insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.config.po.QTXConfigPO" databaseId="oracle">
        <selectKey keyProperty="id" resultType="long" order="AFTER">
            select JCL_ORG_QTXCONFIG_ID.currval from dual
        </selectKey>
        INSERT INTO JCL_ORG_QTXCONFIG
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="appSecret != null">
                app_secret,
            </if>
            <if test="url != null">
                url,
            </if>
            <if test="pcAddress != null">
                pc_address,
            </if>
            <if test="mobileAddress != null">
                mobile_address,
            </if>
            <if test="secondUrl != null ">
                second_url,
            </if>
            <if test="creator != null ">
                creator,
            </if>
            <if test="createDate != null ">
                createdate,
            </if>
        </trim>
        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
            <if test="appSecret != null">
                #{appSecret},
            </if>
            <if test="url != null">
                #{url},
            </if>
            <if test="pcAddress != null">
                #{pcAddress},
            </if>
            <if test="mobileAddress != null">
                #{mobileAddress},
            </if>
            <if test="secondUrl != null ">
                #{secondUrl},
            </if>
            <if test="creator != null ">
                #{creator},
            </if>
            <if test="createDate != null ">
                #{createDate},
            </if>
        </trim>
    </insert>


    <delete id="deleteAll">
        delete from JCL_ORG_QTXCONFIG
    </delete>

</mapper>