<?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.project.zcustom.mapper.plat.PlatApiRecordMapper">
    
    <resultMap type="PlatApiRecord" id="PlatApiRecordResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="apiUrl"    column="api_url"    />
        <result property="apiResult"    column="api_result"    />
        <result property="appOrg"    column="app_org"    />
    </resultMap>

    <sql id="selectPlatApiRecordVo">
        select id, del_flag, create_by, create_time, update_by, update_time, api_url, api_result, app_org from large_plat_api_record
    </sql>

    <select id="selectPlatApiRecordList" parameterType="PlatApiRecord" resultMap="PlatApiRecordResult">
        <include refid="selectPlatApiRecordVo"/>
        <where>  
            <if test="apiUrl != null  and apiUrl != ''"> and api_url = #{apiUrl}</if>
            <if test="apiResult != null  and apiResult != ''"> and api_result = #{apiResult}</if>
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
        </where>
    </select>
    
    <select id="selectPlatApiRecordById" parameterType="Long" resultMap="PlatApiRecordResult">
        <include refid="selectPlatApiRecordVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatApiRecord" parameterType="PlatApiRecord" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_api_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="apiUrl != null">api_url,</if>
            <if test="apiResult != null">api_result,</if>
            <if test="appOrg != null">app_org,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="apiUrl != null">#{apiUrl},</if>
            <if test="apiResult != null">#{apiResult},</if>
            <if test="appOrg != null">#{appOrg},</if>
         </trim>
    </insert>

    <update id="updatePlatApiRecord" parameterType="PlatApiRecord">
        update large_plat_api_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="apiUrl != null">api_url = #{apiUrl},</if>
            <if test="apiResult != null">api_result = #{apiResult},</if>
            <if test="appOrg != null">app_org = #{appOrg},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatApiRecordById" parameterType="Long">
        delete from large_plat_api_record where id = #{id}
    </delete>

    <delete id="deletePlatApiRecordByIds" parameterType="String">
        delete from large_plat_api_record where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_api_record ${ew.customSqlSegment}
    </delete>
</mapper>