<?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="org.hzhub.erp.mapper.ErpApiConfigMapper">

    <resultMap id="ErpApiConfigResult" type="org.hzhub.erp.domain.entity.ErpApiConfig">
        <id property="apiId" column="api_id"/>
        <result property="apiName" column="api_name"/>
        <result property="apiPath" column="api_path"/>
        <result property="apiMethod" column="api_method"/>
        <result property="apiDesc" column="api_desc"/>
        <result property="apiVersion" column="api_version"/>
        <result property="dataSource" column="data_source"/>
        <result property="sqlTemplate" column="sql_template"/>
        <result property="resultType" column="result_type"/>
        <result property="supportPagination" column="support_pagination"/>
        <result property="pageParamName" column="page_param_name"/>
        <result property="sizeParamName" column="size_param_name"/>
        <result property="requireAuth" column="require_auth"/>
        <result property="permissionCode" column="permission_code"/>
        <result property="enableCache" column="enable_cache"/>
        <result property="cacheKeyTemplate" column="cache_key_template"/>
        <result property="cacheTtl" column="cache_ttl"/>
        <result property="sourceTable" column="source_table"/>
        <result property="sourceTableComment" column="source_table_comment"/>
        <result property="status" column="status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectErpApiConfigVo">
        select api_id, api_name, api_path, api_method, api_desc, api_version, data_source,
               sql_template, result_type, support_pagination, page_param_name, size_param_name,
               require_auth, permission_code, enable_cache, cache_key_template, cache_ttl,
               source_table, source_table_comment, status, create_time, update_time, create_by, update_by, remark
        from erp_api_config
    </sql>

    <select id="selectByPathAndMethod" parameterType="String" resultMap="ErpApiConfigResult">
        <include refid="selectErpApiConfigVo"/>
        where api_path = #{apiPath} and api_method = #{apiMethod} and api_version = #{apiVersion} and status = 1
    </select>

</mapper>