<?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.hzya.frame.sysnew.application.api.dao.impl.SysApplicationApiDaoImpl">

    <resultMap id="get-SysApplicationApiEntity-result"
               type="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="apiStatus" column="api_status" jdbcType="VARCHAR"/>
        <result property="apiCode" column="api_code"/>
        <result property="appCode" column="app_code"/>
        <result property="apiPath" column="api_path" jdbcType="VARCHAR"/>
        <result property="appId" column="app_id" jdbcType="VARCHAR"/>
        <result property="appName" column="app_name" jdbcType="VARCHAR"/>
        <result property="appUrl" column="app_url" jdbcType="VARCHAR"/>
        <result property="catalogueId" column="catalogue_id" jdbcType="VARCHAR"/>
        <result property="catalogueName" column="catalogue_name" jdbcType="VARCHAR"/>
        <result property="apiName" column="api_name" jdbcType="VARCHAR"/>
        <result property="apiRemark" column="api_remark" jdbcType="VARCHAR"/>
        <result property="needLogin" column="need_Login" jdbcType="VARCHAR"/>
        <result property="authenticationPort" column="authentication_port" jdbcType="VARCHAR"/>
        <result property="parameterPassingMode" column="parameter_passing_mode" jdbcType="VARCHAR"/>
        <result property="destinationAddress" column="destination_address" jdbcType="VARCHAR"/>
        <result property="requestCoding" column="request_coding" jdbcType="VARCHAR"/>
        <result property="requestMethod" column="request_method" jdbcType="VARCHAR"/>
        <result property="timeoutPeriod" column="timeout_period" jdbcType="VARCHAR"/>
        <result property="currentLimiting" column="current_limiting" jdbcType="VARCHAR"/>
        <result property="headerIn" column="header_in" jdbcType="VARCHAR"/>
        <result property="queryIn" column="query_in" jdbcType="VARCHAR"/>
        <result property="bodyInType" column="body_in_type" jdbcType="VARCHAR"/>
        <result property="bodyIn" column="body_in" jdbcType="VARCHAR"/>
        <result property="bodyOut" column="body_out" jdbcType="VARCHAR"/>
        <result property="beanName" column="bean_name" jdbcType="VARCHAR"/>
        <result property="returnSuccessField" column="return_success_field" jdbcType="VARCHAR"/>
        <result property="returnSuccessValue" column="return_success_value" jdbcType="VARCHAR"/>
        <result property="returnMsg" column="return_msg" jdbcType="VARCHAR"/>
        <result property="funName" column="fun_name" jdbcType="VARCHAR"/>
        <result property="extensionApi" column="extension_api" jdbcType="VARCHAR"/>
        <result property="sorts" column="sorts" jdbcType="INTEGER"/>
        <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
        <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
        <result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
        <result property="sts" column="sts" jdbcType="VARCHAR"/>
        <result property="org_id" column="org_id" jdbcType="VARCHAR"/>
        <result property="appName" column="app_name" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 查询的字段-->
    <sql id="SysApplicationApiEntity_Base_Column_List">
        id
       ,api_status
       ,api_code
       ,api_path
        ,app_id
        ,catalogue_id 
        ,api_name 
        ,api_remark 
        ,need_Login 
        ,authentication_port 
        ,parameter_passing_mode 
        ,destination_address 
        ,request_coding 
        ,request_method 
        ,timeout_period 
        ,current_limiting 
        ,header_in 
        ,query_in 
        ,body_in_type 
        ,body_in 
        ,body_out 
        ,bean_name
        ,return_msg
        ,return_success_field
        ,return_success_value
        ,fun_name
        ,extension_api
        ,sorts
        ,create_user_id 
        ,create_time 
        ,modify_user_id 
        ,modify_time 
        ,sts 
        ,org_id 
     </sql>
    <!--api联查应用表，like查询 -->
    <sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
    sys_application_api.id,
	sys_application.app_id as app_code,
	sys_application_api.api_code,
	sys_application_api.api_name,
	sys_application_api.api_remark,
	sys_application_api.destination_address,
	sys_application_api.header_in,
	sys_application_api.query_in,
	sys_application_api.body_in_type,
	sys_application_api.body_in,
	sys_application_api.body_out,
	sys_application_api.body_in_type,
	sys_application_api.sorts,
	sys_application_api.bean_name,
	sys_application_api.fun_name,
	sys_application_api.extension_api,
	sys_application_api.return_success_field,
	sys_application_api.return_success_value,
	sys_application_api.return_msg
    </sql>
    <!--通过ID获取数据 -->
    <select id="entity_get" resultMap="get-SysApplicationApiEntity-result">
        SELECT
	a.id,
	a.api_status,
	b.name as app_name,
	b.interface_address as app_url,
	a.app_id,
	a.catalogue_id,
	c.name as catalogue_name,
	a.api_name,
	a.api_code,
	a.api_path,
	a.api_remark,
	a.need_Login,
	a.authentication_port,
	a.parameter_passing_mode,
	a.destination_address,
	a.request_coding,
	a.request_method,
	a.timeout_period,
	a.current_limiting,
	a.header_in,
	a.query_in,
	a.body_in_type,
	a.body_in,
	a.body_out,
	a.bean_name,
	a.return_msg,
	a.return_success_field,
	a.return_success_value,
	a.fun_name,
	a.extension_api,
	a.sorts,
	a.create_user_id,
	a.create_time,
	a.modify_user_id,
	a.modify_time,
	a.sts,
	a.org_id
FROM
	sys_application_api a
	LEFT JOIN sys_application b ON a.app_id = b.id
	AND b.sts = 'Y'
	LEFT JOIN sys_application_api_type c ON a.catalogue_id = c.id
	AND c.sts = 'Y'
WHERE
	a.sts = 'Y'
	AND a.id =  #{id}
    </select>
    <!-- 查询 采用==查询 -->
    <select id="entity_list_base" resultMap="get-SysApplicationApiEntity-result"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        api.id
        ,api.api_status
        ,api.api_code
        ,api.api_path
        ,api.app_id
        ,api.catalogue_id
        ,api.api_name
        ,api.api_remark
        ,api.need_Login
        ,api.authentication_port
        ,api.parameter_passing_mode
        ,api.destination_address
        ,api.request_coding
        ,api.request_method
        ,api.timeout_period
        ,api.current_limiting
        ,api.header_in
        ,api.query_in
        ,api.body_in_type
        ,api.body_in
        ,api.body_out
        ,api.bean_name
        ,api.return_msg
        ,api.return_success_field
        ,api.return_success_value
        ,api.fun_name
        ,api.extension_api
        ,api.sorts
        ,api.create_user_id
        ,api.create_time
        ,api.modify_user_id
        ,api.modify_time
        ,api.sts
        ,api.org_id
        ,app.name as app_name
        from sys_application_api api
        left join sys_application app on api.app_id = app.id
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and api.id = #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">and api.api_status = #{apiStatus}</if>
            <if test="apiCode != null ">and api.api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">and api.api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">and api.app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and api.catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">and api.api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">and api.api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">and api.need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">and api.authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and api.parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and api.destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">and api.request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">and api.request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and api.timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">and api.current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">and api.header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">and api.query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">and api.body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">and api.body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">and api.body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">and api.bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">and api.return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and api.return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and api.return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">and api.fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">and api.extension_api = #{extensionApi}</if>
            <if test="sorts != null">and api.sorts = #{sorts}</if>
            <if test="create_user_id != null and create_user_id != ''">and api.create_user_id = #{create_user_id}</if>
            <if test="create_time != null">and api.create_time = #{create_time}</if>
            <if test="modify_user_id != null and modify_user_id != ''">and api.modify_user_id = #{modify_user_id}</if>
            <if test="modify_time != null">and api.modify_time = #{modify_time}</if>
            <if test="sts != null and sts != ''">and api.sts = #{sts}</if>
            <if test="org_id != null and org_id != ''">and api.org_id = #{org_id}</if>
            and api.sts='Y'
        </trim>
        <if test=" sort == null or sort == ''.toString() ">order by api.sorts asc</if>
        <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
    </select>

    <!-- 查询符合条件的数量 -->
    <select id="entity_count" resultType="Integer"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select count(1) from sys_application_api
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and id = #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">and api_status = #{apiStatus}</if>
            <if test="apiCode != null ">and api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">and app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">and need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">and authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">and request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">and request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">and current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">and header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">and query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">and body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">and body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">and body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">and bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">and return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">and fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">and extension_api = #{extensionApi}</if>
            <if test="sorts != null">and sorts = #{sorts}</if>
            <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
            <if test="create_time != null">and create_time = #{create_time}</if>
            <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
            <if test="modify_time != null">and modify_time = #{modify_time}</if>
            <if test="sts != null and sts != ''">and sts = #{sts}</if>
            <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
            and sts='Y'
        </trim>
        <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
        <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
    <select id="entity_list_like" resultMap="get-SysApplicationApiEntity-result"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        <include refid="SysApplicationApiEntity_Base_Column_List"/>
        from sys_application_api
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
            <if test="apiStatus != null and apiStatus != ''">and api_status like concat('%',#{apiStatus},'%')</if>
            <if test="apiCode != null ">and api_code like concat('%',#{apiCode},'%')</if>
            <if test="apiPath != null and apiPath != ''">and api_path like concat('%',#{apiPath},'%')</if>
            <if test="appId != null and appId != ''">and app_id like concat('%',#{appId},'%')</if>
            <if test="catalogueId != null and catalogueId != ''">and catalogue_id like concat('%',#{catalogueId},'%')
            </if>
            <if test="apiName != null and apiName != ''">and api_name like concat('%',#{apiName},'%')</if>
            <if test="apiRemark != null and apiRemark != ''">and api_remark like concat('%',#{apiRemark},'%')</if>
            <if test="needLogin != null and needLogin != ''">and need_Login like concat('%',#{needLogin},'%')</if>
            <if test="authenticationPort != null and authenticationPort != ''">and authentication_port like
                concat('%',#{authenticationPort},'%')
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and parameter_passing_mode like
                concat('%',#{parameterPassingMode},'%')
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and destination_address like
                concat('%',#{destinationAddress},'%')
            </if>
            <if test="requestCoding != null and requestCoding != ''">and request_coding like
                concat('%',#{requestCoding},'%')
            </if>
            <if test="requestMethod != null and requestMethod != ''">and request_method like
                concat('%',#{requestMethod},'%')
            </if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and timeout_period like
                concat('%',#{timeoutPeriod},'%')
            </if>
            <if test="currentLimiting != null and currentLimiting != ''">and current_limiting like
                concat('%',#{currentLimiting},'%')
            </if>
            <if test="headerIn != null and headerIn != ''">and header_in like concat('%',#{headerIn},'%')</if>
            <if test="queryIn != null and queryIn != ''">and query_in like concat('%',#{queryIn},'%')</if>
            <if test="bodyInType != null and bodyInType != ''">and body_in_type like concat('%',#{bodyInType},'%')</if>
            <if test="bodyIn != null and bodyIn != ''">and body_in like concat('%',#{bodyIn},'%')</if>
            <if test="bodyOut != null and bodyOut != ''">and body_out like concat('%',#{bodyOut},'%')</if>
            <if test="beanName != null and beanName != ''">and bean_name like concat('%',#{beanName},'%')</if>
            <if test="returnMsg != null and returnMsg != ''">and return_msg like concat('%',#{returnMsg},'%')</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and return_success_field like concat('%',#{returnSuccessField},'%')</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and return_success_value like concat('%',#{returnSuccessValue},'%')</if>
            <if test="funName != null and funName != ''">and fun_name like concat('%',#{funName},'%')</if>
            <if test="extensionApi != null and extensionApi != ''">and extension_api like concat('%',#{extensionApi},'%')</if>
            <if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
            <if test="create_user_id != null and create_user_id != ''">and create_user_id like
                concat('%',#{create_user_id},'%')
            </if>
            <if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
            <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
                concat('%',#{modify_user_id},'%')
            </if>
            <if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
            <if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
            <if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
            and sts='Y'
        </trim>
        <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
        <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
    </select>


    <!-- 关联查询 sys_app -->
    <select id="entity_list_like_join_sysApp" resultMap="get-SysApplicationApiEntity-result"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        <include refid="SysApplicationApiEntity_join_sysApp_like_Column_Lis"/>
        from sys_application_api
        LEFT JOIN sys_application on sys_application.id = sys_application_api.app_id
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and sys_application_api.id like concat('%',#{id},'%')</if>
            <if test="apiStatus != null and apiStatus != ''">and sys_application_api.api_status like concat('%',#{apiStatus},'%')</if>
            <if test="apiCode != null ">and sys_application_api.api_code like concat('%',#{apiCode},'%')</if>
            <if test="apiPath != null and apiPath != ''">and sys_application_api.api_path like concat('%',#{apiPath},'%')</if>
            <if test="appId != null and appId != ''">and sys_application_api.app_id like concat('%',#{appId},'%')</if>
            <if test="catalogueId != null and catalogueId != ''">and sys_application_api.catalogue_id like concat('%',#{catalogueId},'%')
            </if>
            <if test="apiName != null and apiName != ''">and sys_application_api.api_name like concat('%',#{apiName},'%')</if>
            <if test="apiRemark != null and apiRemark != ''">and sys_application_api.api_remark like concat('%',#{apiRemark},'%')</if>
            <if test="needLogin != null and needLogin != ''">and sys_application_api.need_Login like concat('%',#{needLogin},'%')</if>
            <if test="authenticationPort != null and authenticationPort != ''">and sys_application_api.authentication_port like
                concat('%',#{authenticationPort},'%')
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and sys_application_api.parameter_passing_mode like
                concat('%',#{parameterPassingMode},'%')
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and sys_application_api.destination_address like
                concat('%',#{destinationAddress},'%')
            </if>
            <if test="requestCoding != null and requestCoding != ''">and sys_application_api.request_coding like
                concat('%',#{requestCoding},'%')
            </if>
            <if test="requestMethod != null and requestMethod != ''">and sys_application_api.request_method like
                concat('%',#{requestMethod},'%')
            </if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and sys_application_api.timeout_period like
                concat('%',#{timeoutPeriod},'%')
            </if>
            <if test="currentLimiting != null and currentLimiting != ''">and sys_application_api.current_limiting like
                concat('%',#{currentLimiting},'%')
            </if>
            <if test="headerIn != null and headerIn != ''">and sys_application_api.header_in like concat('%',#{headerIn},'%')</if>
            <if test="queryIn != null and queryIn != ''">and sys_application_api.query_in like concat('%',#{queryIn},'%')</if>
            <if test="bodyInType != null and bodyInType != ''">and sys_application_api.body_in_type like concat('%',#{bodyInType},'%')</if>
            <if test="bodyIn != null and bodyIn != ''">and sys_application_api.body_in like concat('%',#{bodyIn},'%')</if>
            <if test="bodyOut != null and bodyOut != ''">and sys_application_api.body_out like concat('%',#{bodyOut},'%')</if>
            <if test="beanName != null and beanName != ''">and sys_application_api.bean_name like concat('%',#{beanName},'%')</if>
            <if test="returnMsg != null and returnMsg != ''">and sys_application_api.return_msg like concat('%',#{returnMsg},'%')</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and sys_application_api.return_success_field like concat('%',#{returnSuccessField},'%')</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and sys_application_api.return_success_value like concat('%',#{returnSuccessValue},'%')</if>
            <if test="funName != null and funName != ''">and sys_application_api.fun_name like concat('%',#{funName},'%')</if>
            <if test="extensionApi != null and extensionApi != ''">and sys_application_api.extension_api like concat('%',#{extensionApi},'%')</if>
            <if test="sorts != null">and sys_application_api.sorts like concat('%',#{sorts},'%')</if>
            <if test="create_user_id != null and create_user_id != ''">and sys_application_api.create_user_id like
                concat('%',#{create_user_id},'%')
            </if>
            <if test="create_time != null">and sys_application_api.create_time like concat('%',#{create_time},'%')</if>
            <if test="modify_user_id != null and modify_user_id != ''">and sys_application_api.modify_user_id like
                concat('%',#{modify_user_id},'%')
            </if>
            <if test="modify_time != null">and sys_application_api.modify_time like concat('%',#{modify_time},'%')</if>
            <if test="sts != null and sts != ''">and sys_application_api.sts like concat('%',#{sts},'%')</if>
            <if test="org_id != null and org_id != ''">and sys_application_api.org_id like concat('%',#{org_id},'%')</if>
            and sys_application_api.sts = 'Y'
            and sys_application.sts = 'Y'
        </trim>
        order by sys_application.app_id, sys_application_api.sorts
    </select>

    <!-- 查询列表 字段采用or格式 -->
    <select id="SysApplicationApientity_list_or" resultMap="get-SysApplicationApiEntity-result"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        <include refid="SysApplicationApiEntity_Base_Column_List"/>
        from sys_application_api
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">or id = #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">or api_status = #{apiStatus}</if>
            <if test="apiCode != null ">or api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">or api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">or app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">or catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">or api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">or api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">or need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">or authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">or parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">or destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">or request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">or request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">or timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">or current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">or header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">or query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">or body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">or body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">or body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">or bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">or return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">or return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">or return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">or fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">or extension_api = #{extensionApi}</if>
            <if test="sorts != null">or sorts = #{sorts}</if>
            <if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if>
            <if test="create_time != null">or create_time = #{create_time}</if>
            <if test="modify_user_id != null and modify_user_id != ''">or modify_user_id = #{modify_user_id}</if>
            <if test="modify_time != null">or modify_time = #{modify_time}</if>
            <if test="sts != null and sts != ''">or sts = #{sts}</if>
            <if test="org_id != null and org_id != ''">or org_id = #{org_id}</if>
            and sts='Y'
        </trim>
        <if test=" sort == null or sort == ''.toString()  ">order by sorts asc</if>
        <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
    </select>

    <!--新增所有列-->
    <insert id="entity_insert" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity"
            >
        insert into sys_application_api(
        <trim suffix="" suffixOverrides=",">
            <if test="id != null and id != ''">id ,</if>
            <if test="apiStatus != null and apiStatus != ''">api_status ,</if>
            <if test="apiCode != null ">api_code ,</if>
            <if test="apiCode == null ">api_code ,</if>
            <if test="apiPath != null and apiPath != ''">api_path ,</if>
            <if test="appId != null and appId != ''">app_id ,</if>
            <if test="catalogueId != null and catalogueId != ''">catalogue_id ,</if>
            <if test="apiName != null and apiName != ''">api_name ,</if>
            <if test="apiRemark != null and apiRemark != ''">api_remark ,</if>
            <if test="needLogin != null and needLogin != ''">need_Login ,</if>
            <if test="authenticationPort != null and authenticationPort != ''">authentication_port ,</if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">parameter_passing_mode ,</if>
            <if test="destinationAddress != null and destinationAddress != ''">destination_address ,</if>
            <if test="requestCoding != null and requestCoding != ''">request_coding ,</if>
            <if test="requestMethod != null and requestMethod != ''">request_method ,</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">timeout_period ,</if>
            <if test="currentLimiting != null and currentLimiting != ''">current_limiting ,</if>
            <if test="headerIn != null and headerIn != ''">header_in ,</if>
            <if test="queryIn != null and queryIn != ''">query_in ,</if>
            <if test="bodyInType != null and bodyInType != ''">body_in_type ,</if>
            <if test="bodyIn != null and bodyIn != ''">body_in ,</if>
            <if test="bodyOut != null and bodyOut != ''">body_out ,</if>
            <if test="beanName != null and beanName != ''">bean_name ,</if>
            <if test="returnMsg != null and returnMsg != ''">return_msg ,</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">return_success_field ,</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">return_success_value ,</if>
            <if test="funName != null and funName != ''">fun_name ,</if>
            <if test="extensionApi != null and extensionApi != ''">extension_api ,</if>
            <if test="sorts != null">sorts ,</if>
            <if test="create_user_id != null and create_user_id != ''">create_user_id ,</if>
            <if test="create_time != null">create_time ,</if>
            <if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if>
            <if test="modify_time != null">modify_time ,</if>
            <if test="sts != null and sts != ''">sts ,</if>
            <if test="org_id != null and org_id != ''">org_id ,</if>
            <if test="sts == null ">sts,</if>
        </trim>
        )values(
        <trim suffix="" suffixOverrides=",">
            <if test="id != null and id != ''">#{id} ,</if>
            <if test="apiStatus != null and apiStatus != ''">#{apiStatus} ,</if>
            <if test="apiCode != null ">#{apiCode} ,</if>
            <if test="apiCode == null ">(SELECT IFNULL(MAX(b.api_code)+1,(SELECT CONCAT(app_id,'0000') FROM
                sys_application WHERE id=#{appId})) AS appId FROM sys_application_api b WHERE b.app_id=#{appId}) ,
            </if>
            <if test="apiPath != null and apiPath != ''">#{apiPath} ,</if>
            <if test="appId != null and appId != ''">#{appId} ,</if>
            <if test="catalogueId != null and catalogueId != ''">#{catalogueId} ,</if>
            <if test="apiName != null and apiName != ''">#{apiName} ,</if>
            <if test="apiRemark != null and apiRemark != ''">#{apiRemark} ,</if>
            <if test="needLogin != null and needLogin != ''">#{needLogin} ,</if>
            <if test="authenticationPort != null and authenticationPort != ''">#{authenticationPort} ,</if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">#{parameterPassingMode} ,</if>
            <if test="destinationAddress != null and destinationAddress != ''">#{destinationAddress} ,</if>
            <if test="requestCoding != null and requestCoding != ''">#{requestCoding} ,</if>
            <if test="requestMethod != null and requestMethod != ''">#{requestMethod} ,</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">#{timeoutPeriod} ,</if>
            <if test="currentLimiting != null and currentLimiting != ''">#{currentLimiting} ,</if>
            <if test="headerIn != null and headerIn != ''">#{headerIn} ,</if>
            <if test="queryIn != null and queryIn != ''">#{queryIn} ,</if>
            <if test="bodyInType != null and bodyInType != ''">#{bodyInType} ,</if>
            <if test="bodyIn != null and bodyIn != ''">#{bodyIn} ,</if>
            <if test="bodyOut != null and bodyOut != ''">#{bodyOut} ,</if>
            <if test="beanName != null and beanName != ''">#{beanName} ,</if>
            <if test="returnMsg != null and returnMsg != ''">#{returnMsg} ,</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">#{returnSuccessField} ,</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">#{returnSuccessValue} ,</if>
            <if test="funName != null and funName != ''">#{funName} ,</if>
            <if test="extensionApi != null and extensionApi != ''">#{extensionApi} ,</if>
            <if test="sorts != null">#{sorts} ,</if>
            <if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if>
            <if test="create_time != null">#{create_time} ,</if>
            <if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if>
            <if test="modify_time != null">#{modify_time} ,</if>
            <if test="sts != null and sts != ''">#{sts} ,</if>
            <if test="org_id != null and org_id != ''">#{org_id} ,</if>

            <if test="sts == null ">'Y',</if>
        </trim>
        )
    </insert>
    <!-- 批量新增 -->
    <insert id="entityInsertBatch" >
        insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark,
        need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method,
        timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, bean_name,return_msg,return_success_field,return_success_value, fun_name, extension_api, sorts, create_user_id,
        create_time, modify_user_id, modify_time, sts, org_id, sts)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
            'Y')
        </foreach>
    </insert>
    <!-- 批量新增或者修改-->
    <insert id="entityInsertOrUpdateBatch" >
        insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark,
        need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method,
        timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out,bean_name,return_msg,return_success_field,return_success_value,fun_name,extension_api, sorts, create_user_id,
        create_time, modify_user_id, modify_time, sts, org_id)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
        </foreach>
        on duplicate key update
        api_status = values(api_status),
        api_code = values(api_code),
        api_path = values(api_path),
        app_id = values(app_id),
        catalogue_id = values(catalogue_id),
        api_name = values(api_name),
        api_remark = values(api_remark),
        need_Login = values(need_Login),
        authentication_port = values(authentication_port),
        parameter_passing_mode = values(parameter_passing_mode),
        destination_address = values(destination_address),
        request_coding = values(request_coding),
        request_method = values(request_method),
        timeout_period = values(timeout_period),
        current_limiting = values(current_limiting),
        header_in = values(header_in),
        query_in = values(query_in),
        body_in_type = values(body_in_type),
        body_in = values(body_in),
        body_out = values(extension_api),
        bean_name = values(bean_name),
        return_msg = values(return_msg),
        return_success_field = values(return_success_field),
        return_success_value = values(return_success_value),
        fun_name = values(fun_name),
        extension_api = values(extension_api),
        sorts = values(sorts),
        create_user_id = values(create_user_id),
        create_time = values(create_time),
        modify_user_id = values(modify_user_id),
        modify_time = values(modify_time),
        sts = values(sts),
        org_id = values(org_id)
    </insert>
    <!--通过主键修改方法-->
    <update id="entity_update" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        update sys_application_api set
        <trim suffix="" suffixOverrides=",">
            <if test="apiStatus != null and apiStatus != ''">api_status = #{apiStatus},</if>
            <if test="apiCode != null ">api_code = #{apiCode},</if>
            <if test="apiPath != null and apiPath != ''">api_path = #{apiPath},</if>
            <if test="appId != null and appId != ''">app_id = #{appId},</if>
            <if test="catalogueId != null and catalogueId != ''">catalogue_id = #{catalogueId},</if>
            <if test="apiName != null and apiName != ''">api_name = #{apiName},</if>
            <if test="apiRemark != null and apiRemark != ''">api_remark = #{apiRemark},</if>
            <if test="needLogin != null and needLogin != ''">need_Login = #{needLogin},</if>
            <if test="authenticationPort != null and authenticationPort != ''">authentication_port =
                #{authenticationPort},
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">parameter_passing_mode =
                #{parameterPassingMode},
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">destination_address =
                #{destinationAddress},
            </if>
            <if test="requestCoding != null and requestCoding != ''">request_coding = #{requestCoding},</if>
            <if test="requestMethod != null and requestMethod != ''">request_method = #{requestMethod},</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">timeout_period = #{timeoutPeriod},</if>
            <if test="currentLimiting != null and currentLimiting != ''">current_limiting = #{currentLimiting},</if>
            <if test="headerIn != null and headerIn != ''">header_in = #{headerIn},</if>
            <if test="queryIn != null and queryIn != ''">query_in = #{queryIn},</if>
            <if test="bodyInType != null and bodyInType != ''">body_in_type = #{bodyInType},</if>
            <if test="bodyIn != null and bodyIn != ''">body_in = #{bodyIn},</if>
            <if test="bodyOut != null and bodyOut != ''">body_out = #{bodyOut},</if>
            <if test="beanName != null and beanName != ''">bean_name = #{beanName},</if>
            <if test="returnMsg != null and returnMsg != ''">return_msg = #{returnMsg},</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">return_success_field = #{returnSuccessField},</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">return_success_value = #{returnSuccessValue},</if>
            <if test="funName != null and funName != ''">fun_name = #{funName},</if>
            <if test="extensionApi != null and extensionApi != ''">extension_api = #{extensionApi},</if>
            <if test="sorts != null">sorts = #{sorts},</if>
            <if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if>
            <if test="create_time != null">create_time = #{create_time},</if>
            <if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if>
            <if test="modify_time != null">modify_time = #{modify_time},</if>
            <if test="sts != null and sts != ''">sts = #{sts},</if>
            <if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
        </trim>
        where id = #{id}
    </update>
    <!-- 逻辑删除 -->
    <update id="entity_logicDelete" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
update sys_application_api  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
    <!-- 多条件逻辑删除 -->
    <update id="entity_logicDelete_Multi_Condition"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        update sys_application_api set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and id = #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">and api_status = #{apiStatus}</if>
            <if test="apiCode != null ">and api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">and app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">and need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">and authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">and request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">and request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">and current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">and header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">and query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">and body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">and body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">and body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">and bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">and return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">and fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">and extension_api = #{extensionApi}</if>
            <if test="sorts != null">and sorts = #{sorts}</if>
            <if test="sts != null and sts != ''">and sts = #{sts}</if>
            and sts='Y'
        </trim>
    </update>
    <!--通过主键删除-->
    <delete id="entity_delete">
    delete from sys_application_api where id = #{id}
</delete>

    <select id="queryVoList11" databaseId="dm" resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        a.id,
        a.catalogue_id AS catalogueId,
        (
        SELECT
        b.NAME
        FROM
        sys_application_api_type b
        WHERE
        b.sts = 'Y'
        AND b.id = a.catalogue_id
        ) AS catalogueName,
        a.api_name AS apiName,
        a.api_code AS apiCode,
        a.api_path AS apiPath,
        a.destination_address AS destinationAddress,
        a.api_remark AS apiRemark,
        (
        SELECT
        count(c.id)
        FROM
        sys_message_manage_log c
        WHERE
        c.sts = 'Y'
        AND c.STATUS = '4'
        AND c.error_status != '2'
        AND c.receive_app = a.app_id
        AND c.receive_api = a.id
        ) AS errorCount,
        a.api_status AS apiStatus,
        (
        SELECT
        replace(WM_CONCAT(d.tripartite_system_id ),',', ',')
        FROM
        sys_application_api_auth_detail d
        WHERE
        d.app_id = a.app_id
        AND d.api_id = a.id
        and d.sts = 'Y'
        ) as authDetail
        FROM
        sys_application_api a
        <trim prefix="where" prefixOverrides="and">
            <if test="appId != null and appId != ''">and a.app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and a.catalogue_id = #{catalogueId}</if>
            <if test="nameOrRemark != null and nameOrRemark != ''">and (a.api_name like concat('%',#{nameOrRemark},'%')
                or a.api_remark like concat('%',#{nameOrRemark},'%') )
            </if>
            and a.sts='Y'
        </trim>
        order by a.sorts asc
    </select>
<!--    <select id="queryVoList"  resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo"  parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">-->
<!--        select-->
<!--        a.id,-->
<!--        a.catalogue_id AS catalogueId,-->
<!--        (-->
<!--        SELECT-->
<!--        b.NAME-->
<!--        FROM-->
<!--        sys_application_api_type b-->
<!--        WHERE-->
<!--        b.sts = 'Y'-->
<!--        AND b.id = a.catalogue_id-->
<!--        ) AS catalogueName,-->
<!--        a.api_name AS apiName,-->
<!--        a.api_code AS apiCode,-->
<!--        a.api_path AS apiPath,-->
<!--        a.destination_address AS destinationAddress,-->
<!--        a.api_remark AS apiRemark,-->
<!--        (-->
<!--        SELECT-->
<!--        count(c.id)-->
<!--        FROM-->
<!--        sys_message_manage_log c-->
<!--        WHERE-->
<!--        c.sts = 'Y'-->
<!--        AND c.STATUS = '4'-->
<!--        AND c.error_status != '2'-->
<!--        AND c.receive_app = a.app_id-->
<!--        AND c.receive_api = a.id-->
<!--        ) AS errorCount,-->
<!--        a.api_status AS apiStatus,-->
<!--        (-->
<!--        SELECT-->
<!--        GROUP_CONCAT( d.tripartite_system_id )-->
<!--        FROM-->
<!--        sys_application_api_auth_detail d-->
<!--        WHERE-->
<!--        d.app_id = a.app_id-->
<!--        AND d.api_id = a.id-->
<!--        and d.sts = 'Y'-->
<!--        ) as authDetail-->
<!--        FROM-->
<!--        sys_application_api a-->
<!--        <trim prefix="where" prefixOverrides="and">-->
<!--            <if test="appId != null and appId != ''">and a.app_id = #{appId}</if>-->
<!--            <if test="catalogueId != null and catalogueId != ''">and a.catalogue_id = #{catalogueId}</if>-->
<!--            <if test="nameOrRemark != null and nameOrRemark != ''">and (a.api_name like concat('%',#{nameOrRemark},'%')-->
<!--                or a.api_remark like concat('%',#{nameOrRemark},'%') )-->
<!--            </if>-->
<!--            and a.sts='Y'-->
<!--        </trim>-->
<!--        order by a.sorts asc-->
<!--    </select>-->
    <select id="queryVoList"   resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo"  parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        a.id,
        a.catalogue_id AS catalogueId,
        (
        SELECT
        b.NAME
        FROM
        sys_application_api_type b
        WHERE
        b.sts = 'Y'
        AND b.id = a.catalogue_id
        ) AS catalogueName,
        a.api_name AS apiName,
        a.api_code AS apiCode,
        a.api_path AS apiPath,
        a.destination_address AS destinationAddress,
        a.api_remark AS apiRemark,
        0 AS errorCount,
        a.api_status AS apiStatus,
        (
        SELECT
        GROUP_CONCAT( d.tripartite_system_id )
        FROM
        sys_application_api_auth_detail d
        WHERE
        d.app_id = a.app_id
        AND d.api_id = a.id
        and d.sts = 'Y'
        ) as authDetail
        FROM
        sys_application_api a
        <trim prefix="where" prefixOverrides="and">
            <if test="appId != null and appId != ''">and a.app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and a.catalogue_id = #{catalogueId}</if>
            <if test="nameOrRemark != null and nameOrRemark != ''">and (a.api_name like concat('%',#{nameOrRemark},'%')
                or a.api_remark like concat('%',#{nameOrRemark},'%') )
            </if>
            and a.sts='Y'
        </trim>
        order by a.sorts asc
    </select>
    <select id="queryVoList" databaseId="oracle"  resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo"  parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        a.id,
        a.catalogue_id AS catalogueId,
        (
        SELECT
        b.NAME
        FROM
        sys_application_api_type b
        WHERE
        b.sts = 'Y'
        AND b.id = a.catalogue_id
        ) AS catalogueName,
        a.api_name AS apiName,
        a.api_code AS apiCode,
        a.api_path AS apiPath,
        a.destination_address AS destinationAddress,
        a.api_remark AS apiRemark,
        0 AS errorCount,
        a.api_status AS apiStatus,
        (
        SELECT
        WM_CONCAT( d.tripartite_system_id )
        FROM
        sys_application_api_auth_detail d
        WHERE
        d.app_id = a.app_id
        AND d.api_id = a.id
        and d.sts = 'Y'
        ) as authDetail
        FROM
        sys_application_api a
        <trim prefix="where" prefixOverrides="and">
            <if test="appId != null and appId != ''">and a.app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and a.catalogue_id = #{catalogueId}</if>
            <if test="nameOrRemark != null and nameOrRemark != ''">and (a.api_name like concat('%',#{nameOrRemark},'%')
                or a.api_remark like concat('%',#{nameOrRemark},'%') )
            </if>
            and a.sts='Y'
        </trim>
        order by a.sorts asc
    </select>

    <!-- 查询 采用==查询 -->
    <select id="queryBaseName" resultMap="get-SysApplicationApiEntity-result"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select
        id
        ,app_id
        ,api_name
        from sys_application_api
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and id = #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">and api_status = #{apiStatus}</if>
            <if test="apiCode != null ">and api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">and app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">and need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">and authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">and request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">and request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">and current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">and header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">and query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">and body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">and body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">and body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">and bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">and return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">and fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">and extension_api = #{extensionApi}</if>
            <if test="sorts != null">and sorts = #{sorts}</if>
            <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
            <if test="create_time != null">and create_time = #{create_time}</if>
            <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
            <if test="modify_time != null">and modify_time = #{modify_time}</if>
            <if test="sts != null and sts != ''">and sts = #{sts}</if>
            <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
            and sts='Y'
        </trim>
        <if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
        <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
    </select>
    <!-- 查询符合条件的数量 -->
    <select id="entity_count_not_id" resultType="Integer"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
        select count(1) from sys_application_api
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">and id != #{id}</if>
            <if test="apiStatus != null and apiStatus != ''">and api_status = #{apiStatus}</if>
            <if test="apiCode != null ">and api_code = #{apiCode}</if>
            <if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
            <if test="appId != null and appId != ''">and app_id = #{appId}</if>
            <if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
            <if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
            <if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
            <if test="needLogin != null and needLogin != ''">and need_Login = #{needLogin}</if>
            <if test="authenticationPort != null and authenticationPort != ''">and authentication_port =
                #{authenticationPort}
            </if>
            <if test="parameterPassingMode != null and parameterPassingMode != ''">and parameter_passing_mode =
                #{parameterPassingMode}
            </if>
            <if test="destinationAddress != null and destinationAddress != ''">and destination_address =
                #{destinationAddress}
            </if>
            <if test="requestCoding != null and requestCoding != ''">and request_coding = #{requestCoding}</if>
            <if test="requestMethod != null and requestMethod != ''">and request_method = #{requestMethod}</if>
            <if test="timeoutPeriod != null and timeoutPeriod != ''">and timeout_period = #{timeoutPeriod}</if>
            <if test="currentLimiting != null and currentLimiting != ''">and current_limiting = #{currentLimiting}</if>
            <if test="headerIn != null and headerIn != ''">and header_in = #{headerIn}</if>
            <if test="queryIn != null and queryIn != ''">and query_in = #{queryIn}</if>
            <if test="bodyInType != null and bodyInType != ''">and body_in_type = #{bodyInType}</if>
            <if test="bodyIn != null and bodyIn != ''">and body_in = #{bodyIn}</if>
            <if test="bodyOut != null and bodyOut != ''">and body_out = #{bodyOut}</if>
            <if test="beanName != null and beanName != ''">and bean_name = #{beanName}</if>
            <if test="returnMsg != null and returnMsg != ''">and return_msg = #{returnMsg}</if>
            <if test="returnSuccessField != null and returnSuccessField != ''">and return_success_field = #{returnSuccessField}</if>
            <if test="returnSuccessValue != null and returnSuccessValue != ''">and return_success_value = #{returnSuccessValue}</if>
            <if test="funName != null and funName != ''">and fun_name = #{funName}</if>
            <if test="extensionApi != null and extensionApi != ''">and extension_api = #{extensionApi}</if>
            <if test="sorts != null">and sorts = #{sorts}</if>
            <if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
            <if test="create_time != null">and create_time = #{create_time}</if>
            <if test="modify_user_id != null and modify_user_id != ''">and modify_user_id = #{modify_user_id}</if>
            <if test="modify_time != null">and modify_time = #{modify_time}</if>
            <if test="sts != null and sts != ''">and sts = #{sts}</if>
            <if test="org_id != null and org_id != ''">and org_id = #{org_id}</if>
            and sts='Y'
        </trim>
    </select>
    <!-- 查询符合条件的数量 -->
    <select id="checkCatalogue" resultType="Integer"
            parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
            SELECT count(*) from
            sys_application_api
            WHERE
            sts = 'Y'
            and app_id = #{appId}
            and catalogue_id != #{catalogueId}
            and authentication_port in (
            SELECT
                id
            FROM
                sys_application_api
            WHERE
             sts = 'Y'
               and catalogue_id = #{catalogueId} and app_id = #{appId}
            )

    </select>
</mapper>

