<?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.upyuns.platform.rs.website.mapper.ApiCustomParamsMapper">

    <resultMap id="BaseResultMap" type="com.upyuns.platform.rs.website.entity.ApiCustomParams">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="docId" column="doc_id" jdbcType="BIGINT"/>
            <result property="nodeId" column="node_id" jdbcType="BIGINT"/>
            <result property="method" column="method" jdbcType="VARCHAR"/>
            <result property="apiUrl" column="api_url" jdbcType="VARCHAR"/>
            <result property="formData" column="form_data" jdbcType="VARCHAR"/>
            <result property="bodyData" column="body_data" jdbcType="VARCHAR"/>
            <result property="headerData" column="header_data" jdbcType="VARCHAR"/>
            <result property="cookieData" column="cookie_data" jdbcType="VARCHAR"/>
            <result property="status" column="status" jdbcType="TINYINT"/>
            <result property="isDel" column="is_del" jdbcType="TINYINT"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="BIGINT"/>
            <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
            <result property="lastUpdateUser" column="last_update_user" jdbcType="BIGINT"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,doc_id,node_id,
        method,api_url,form_data,
        body_data,header_data,cookie_data,
        status,is_del,create_time,
        create_user,last_update_time,last_update_user
    </sql>
    <select id="selectList" resultType="com.upyuns.platform.rs.website.entity.ApiCustomParams">
        SELECT *
        FROM api_custom_params
        WHERE is_del = 0
        <if test="docId!= null">
            AND doc_id = #{docId}
        </if>
        <if test="nodeId!= null">
            AND node_id = #{nodeId}
        </if>
        <if test="method!= null and method!= ''">
            AND method = #{method}
        </if>
        <if test="apiUrl!= null and apiUrl!= ''">
            AND api_url = concat('%', #{apiUrl}, '%')
        </if>
        <if test="status != null">
            AND `status` = #{status}
        </if>
        ORDER BY `create_time`,`id` desc
    </select>
</mapper>
