<?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.ApiCustomNodeMapper">

    <resultMap id="BaseResultMap" type="com.upyuns.platform.rs.website.entity.ApiCustomNode">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="docId" column="doc_id" jdbcType="BIGINT"/>
            <result property="parentId" column="parent_id" jdbcType="BIGINT"/>
            <result property="nodeType" column="node_type" jdbcType="TINYINT"/>
            <result property="nodeName" column="node_name" jdbcType="VARCHAR"/>
            <result property="nodeDesc" column="node_desc" jdbcType="VARCHAR"/>
            <result property="seqNo" column="seq_no" jdbcType="INTEGER"/>
            <result property="respondJson" column="respond_json" 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,parent_id,
        node_type,node_name,node_desc,
        seq_no,respond_json,status,
        is_del,create_time,create_user,
        last_update_time,last_update_user
    </sql>
    <select id="selectList" resultType="com.upyuns.platform.rs.website.entity.ApiCustomNode">
        SELECT *
        FROM api_custom_node
        WHERE is_del = 0
        <if test="docId!= null">
            AND doc_id = #{docId}
        </if>
        <if test="parentId!= null">
            AND parent_id = #{parentId}
        </if>
        <if test="nodeType!= null">
            AND node_type = #{nodeType}
        </if>
        <if test="nodeName!= null and nodeName!= ''">
            AND node_name LIKE CONCAT('%', #{nodeName}, '%')
        </if>
        <if test="nodeDesc!= null and nodeDesc!= ''">
            AND node_desc LIKE CONCAT('%', #{nodeDesc}, '%')
        </if>
        <if test="path != null and path != ''">
            AND `path` LIKE CONCAT('%',#{path}, '%')
        </if>
        <if test="status != null">
            AND `status` = #{status}
        </if>
        ORDER BY seq_no DESC
    </select>
</mapper>
