<?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.sys.appApi.dao.impl.AppApiMapperImpl">

	<resultMap id="get-entity-result" type="com.hzya.frame.sys.appApi.entity.AppApi">
		<!--主键ID -->
		<result property="id" column="id" />
		<!--api从属系统 -->
		<result property="appId" column="app_id" />
		<!--中文名称 -->
		<result property="apiName" column="api_name" />
		<!--api名称 -->
		<result property="apiCode" column="api_code" />
		<!--api描述 -->
		<result property="apiRemark" column="api_remark" />
		<!--是否需要登录 1、是 2、否 -->
		<result property="needLogin" column="need_Login" />
		<!--认证接口 -->
		<result property="authenticationPort" column="authentication_port" />
		<!--传参方式 1、query 2、data -->
		<result property="parameterPassingMode" column="parameter_passing_mode" />
		<!--允许访问入口 1、app 2、H5 -->
		<result property="enableAccessEntry" column="enable_access_entry" />
		<!--服务接入协议 1、HTTP 2、HTTPS -->
		<result property="serviceAccessProtocol" column="service_access_protocol" />
		<!--目标地址 -->
		<result property="destinationAddress" column="destination_address" />
		<!--请求编码 1、UTF-8 -->
		<result property="requestCoding" column="request_coding" />
		<!--请求方法 1、POST 2、GET -->
		<result property="requestMethod" column="request_method" />
		<!--超时时间 6000 ms -->
		<result property="timeoutPeriod" column="timeout_period" />
		<!--限流 6000 ms -->
		<result property="currentLimiting" column="current_limiting" />
		<!--Header入参 JSON -->
		<result property="headerIn" column="header_in" />
		<!--Query入参 JSON -->
		<result property="queryIn" column="query_in" />
		<!--Body 入参类型 1、Application/json -->
		<result property="bodyInType" column="body_in_type" />
		<!--Body 入参 JSON -->
		<result property="bodyIn" column="body_in" />
		<!--Body 出参 JSON -->
		<result property="bodyOut" column="body_out" />
		<!--排序 -->
		<result property="sorts" column="sorts" />
		<!--创建人id -->
		<result property="createUserId" column="create_user_id" />
		<!--创建时间 -->
		<result property="createTime" column="create_time" />
		<!--修改人id -->
		<result property="modifyUserId" column="modify_user_id" />
		<!--修改时间 -->
		<result property="modifyTime" column="modify_time" />
		<!--状态(Y正常N删除) -->
		<result property="sts" column="sts" />
		<!--组织机构ID -->
		<result property="orgId" column="org_id" />
		<result property="appName" column="app_name" />
		<result property="createUser" column="create_user" />
	</resultMap>

	<sql id="Base_Column_List">
		id,
		app_id,
		api_name,
		api_code,
		api_remark,
		need_Login,
		authentication_port,
		parameter_passing_mode,
		enable_access_entry,
		service_access_protocol,
		destination_address,
		request_coding,
		request_method,
		timeout_period,
		current_limiting,
		header_in,
		query_in,
		body_in_type,
		body_in,
		body_out,
		sorts,
		create_user_id,
		create_time,
		modify_user_id,
		modify_time,
		sts,
		org_id
	</sql>
	<sql id="Base_Column_List_entity">
		a.id,
		a.app_id,
		a.api_name,
		a.api_code,
		a.api_remark,
		a.need_Login,
		a.authentication_port,
		a.parameter_passing_mode,
		a.enable_access_entry,
		a.service_access_protocol,
		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.sorts,
		a.create_user_id,
		a.create_time,
		a.modify_user_id,
		a.modify_time,
		a.sts,
		a.org_id,
		b.name as app_name,
		c.login_code as create_user
	</sql>
		<sql id="Base_Column_List_join_dictionaryshop">
		a.id,
		a.app_id,
		a.api_name,
		a.api_code,
		a.api_remark,
		a.need_Login,
		a.authentication_port,
		a.parameter_passing_mode,
		a.enable_access_entry,
		a.service_access_protocol,
		a.destination_address,
		a.request_coding,
		d.column_content as 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.sorts,
		a.create_user_id,
		a.create_time,
		a.modify_user_id,
		a.modify_time,
		a.sts,
		a.org_id
	</sql>
	<!--通过ID获取数据 -->
	<select id="entity_get" resultMap="get-entity-result">
		select
		<include refid="Base_Column_List_entity" />
		from sys_app_api a
		left join sys_app b on a.app_id = b.id and b.sts = 'Y'
		left join sys_user c on a.create_user_id = c.id and c.sts = 'Y'
		where a.id = #{ id } and a.sts='Y'

	</select>
	<!--关联查询-->
    <select id="entity_get_join_dictionary" parameterType="java.lang.String" resultMap="get-entity-result">
		select
		<include refid="Base_Column_List_join_dictionaryshop" />
		from sys_app_api a
		left join sys_dictionaryshop_new d on  d.column_value = a.request_method and d.tab_name = 'sys_app_api' and d.column_name = 'request_method'
		where a.id = #{ id } and a.sts='Y'
	</select>
	<!-- 查询 采用==查询 -->
	<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		select
		<include refid="Base_Column_List" />
		from sys_app_api
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="appId != null and appId !='' "> and app_id = #{appId}</if>
			<if test="apiName != null and apiName !='' "> and api_name = #{apiName}</if>
			<if test="apiCode != null and apiCode !='' "> and api_code = #{apiCode}</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="enableAccessEntry != null and enableAccessEntry !='' "> and enable_access_entry = #{enableAccessEntry}</if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> and service_access_protocol = #{serviceAccessProtocol}</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="sorts != null "> and sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id = #{createUserId}</if>
			<if test="createTime != null "> and create_time = #{createTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id = #{modifyUserId}</if>
			<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="orgId != null and orgId !='' "> and org_id = #{orgId}</if>
		</trim>
		<if test=" sort =='' "> order by sorts desc</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.sys.appApi.entity.AppApi">
		select count(1) from sys_app_api
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="appId != null and appId !='' "> and app_id = #{appId}</if>
			<if test="apiName != null and apiName !='' "> and api_name = #{apiName}</if>
			<if test="apiCode != null and apiCode !='' "> and api_code = #{apiCode}</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="enableAccessEntry != null and enableAccessEntry !='' "> and enable_access_entry = #{enableAccessEntry}</if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> and service_access_protocol = #{serviceAccessProtocol}</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="sorts != null "> and sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id = #{createUserId}</if>
			<if test="createTime != null "> and create_time = #{createTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id = #{modifyUserId}</if>
			<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="orgId != null and orgId !='' "> and org_id = #{orgId}</if>
		</trim>
	</select>
	<select id="entity_count_not_id" resultType="Integer" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		select count(1) from sys_app_api
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id != #{id} </if>
			<if test="appId != null and appId !='' "> and app_id = #{appId}</if>
			<if test="apiName != null and apiName !='' "> and api_name = #{apiName}</if>
			<if test="apiCode != null and apiCode !='' "> and api_code = #{apiCode}</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="enableAccessEntry != null and enableAccessEntry !='' "> and enable_access_entry = #{enableAccessEntry}</if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> and service_access_protocol = #{serviceAccessProtocol}</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="sorts != null "> and sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id = #{createUserId}</if>
			<if test="createTime != null "> and create_time = #{createTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id = #{modifyUserId}</if>
			<if test="modifyTime != null "> and modify_time = #{modifyTime}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="orgId != null and orgId !='' "> and org_id = #{orgId}</if>
		</trim>
	</select>

	<!-- 分页查询列表 采用like格式 -->
	<select id="entity_list_like" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		select
		<include refid="Base_Column_List" />
		from sys_app_api
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' "> id like concat('%',#{id},'%') </if>
			<if test="appId != null and appId !='' "> and app_id like concat('%',#{appId},'%') </if>
			<if test="apiName != null and apiName !='' "> and api_name like concat('%',#{apiName},'%') </if>
			<if test="apiCode != null and apiCode !='' "> and api_code like concat('%',#{apiCode},'%') </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="enableAccessEntry != null and enableAccessEntry !='' "> and enable_access_entry like concat('%',#{enableAccessEntry},'%') </if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> and service_access_protocol like concat('%',#{serviceAccessProtocol},'%') </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="sorts != null "> and sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id like concat('%',#{createUserId},'%') </if>
			<if test="createTime != null and createTime !='' "> and create_time like concat('%',#{createTime},'%') </if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id like concat('%',#{modifyUserId},'%') </if>
			<if test="modifyTime != null and modifyTime !='' "> and modify_time like concat('%',#{modifyTime},'%') </if>
			<if test="sts != null and sts !='' "> and sts like concat('%',#{sts},'%') </if>
			<if test="orgId != null and orgId !='' "> and org_id like concat('%',#{orgId},'%') </if>
		</trim>
		<if test=" sort =='' "> order by sorts desc</if>
		<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by  ${sort} ${order}</if>
	</select>

	<!-- 查询列表 字段采用or格式 -->
	<select id="entity_list_or" resultMap="get-entity-result" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		select
		<include refid="Base_Column_List" />
		from sys_app_api
		<trim prefix="where" prefixOverrides="or">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="appId != null and appId !='' "> or app_id = #{appId} </if>
			<if test="apiName != null and apiName !='' "> or api_name = #{apiName} </if>
			<if test="apiCode != null and apiCode !='' "> or api_code = #{apiCode} </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="enableAccessEntry != null and enableAccessEntry !='' "> or enable_access_entry = #{enableAccessEntry} </if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> or service_access_protocol = #{serviceAccessProtocol} </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="sorts != null "> or sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> or create_user_id = #{createUserId} </if>
			<if test="createTime != null and createTime !='' "> or create_time = #{createTime} </if>
			<if test="modifyUserId != null and modifyUserId !='' "> or modify_user_id = #{modifyUserId} </if>
			<if test="modifyTime != null and modifyTime !='' "> or modify_time = #{modifyTime} </if>
			<if test="sts != null and sts !='' "> or sts = #{sts} </if>
			<if test="orgId != null and orgId !='' "> or org_id = #{orgId} </if>
		</trim>
		<if test=" sort =='' "> order by sorts desc</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.sys.appApi.entity.AppApi">
		insert into sys_app_api(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null and id !='' "> id, </if>
			<if test="appId != null and appId !='' "> app_id, </if>
			<if test="apiName != null and apiName !='' "> api_name, </if>
			<if test="apiCode != null and apiCode !='' "> api_code, </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="enableAccessEntry != null and enableAccessEntry !='' "> enable_access_entry, </if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> service_access_protocol, </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="sorts != null ">sorts,</if>
			<if test="sorts == null ">sorts,</if>
			<if test="createUserId != null and createUserId !='' "> create_user_id, </if>
			<if test="createTime != null ">create_time,</if>
			<if test="modifyUserId != null and modifyUserId !='' "> modify_user_id, </if>
			<if test="modifyTime != null ">modify_time,</if>
			<if test="sts != null and sts !='' "> sts, </if>
			<if test="orgId != null and orgId !='' "> org_id, </if>
		</trim>
		)values
		(
		<trim suffix="" suffixOverrides=",">
			<if test="id != null and id !='' "> #{id}, </if>
			<if test="appId != null and appId !='' "> #{appId}, </if>
			<if test="apiName != null and apiName !='' "> #{apiName}, </if>
			<if test="apiCode != null and apiCode !='' "> #{apiCode}, </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="enableAccessEntry != null and enableAccessEntry !='' "> #{enableAccessEntry}, </if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> #{serviceAccessProtocol}, </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="sorts != null ">#{sorts},</if>
			<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_app_api a WHERE a.sts = 'Y' ),</if>
			<if test="createUserId != null and createUserId !='' "> #{createUserId}, </if>
			<if test="createTime != null ">#{createTime},</if>
			<if test="modifyUserId != null and modifyUserId !='' "> #{modifyUserId}, </if>
			<if test="modifyTime != null ">#{modifyTime},</if>
			<if test="sts != null and sts !='' "> #{sts}, </if>
			<if test="orgId != null and orgId !='' "> #{orgId}, </if>
		</trim>
		)
	</insert>

	<!-- 修改 -->
	<update id="entity_update" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		update sys_app_api set
		<trim suffix="" suffixOverrides=",">
			<if test="appId != null and appId !='' "> app_id = #{appId},</if>
			<if test="apiName != null and apiName !='' "> api_name = #{apiName},</if>
			<if test="apiCode != null and apiCode !='' "> api_code = #{apiCode},</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="enableAccessEntry != null and enableAccessEntry !='' "> enable_access_entry = #{enableAccessEntry},</if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> service_access_protocol = #{serviceAccessProtocol},</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="sorts != null ">sorts = #{sorts},</if>
			<if test="createUserId != null and createUserId !='' "> create_user_id = #{createUserId},</if>
			<if test="createTime != null ">create_time = #{createTime},</if>
			<if test="modifyUserId != null and modifyUserId !='' "> modify_user_id = #{modifyUserId},</if>
			<if test="modifyTime != null ">modify_time = #{modifyTime},</if>
			<if test="sts != null and sts !='' "> sts = #{sts},</if>
			<if test="orgId != null and orgId !='' "> org_id = #{orgId},</if>
		</trim>
		where id = #{id}
	</update>

	<!-- 逻辑删除 -->
	<update id="entity_logicDelete" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		update sys_app_api set
		sts='N',modify_time = now(),modify_user_id = #{modifyUserId} where
		id = #{id}
	</update>

	<!-- 逻辑删除多条件 -->
	<update id="entity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		update sys_app_api set
		sts='N',modify_time = now(),modify_user_id = #{modifyUserId}
		<trim prefix="where" prefixOverrides="and">
			<if test="id != null and id !='' ">id = #{id} </if>
			<if test="appId != null and appId !='' "> and app_id = #{appId}</if>
			<if test="apiName != null and apiName !='' "> and api_name = #{apiName}</if>
			<if test="apiCode != null and apiCode !='' "> and api_code = #{apiCode}</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="enableAccessEntry != null and enableAccessEntry !='' "> and enable_access_entry = #{enableAccessEntry}</if>
			<if test="serviceAccessProtocol != null and serviceAccessProtocol !='' "> and service_access_protocol = #{serviceAccessProtocol}</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="sorts != null "> and sorts = #{sorts}</if>
			<if test="createUserId != null and createUserId !='' "> and create_user_id = #{createUserId}</if>
			<if test="createTime != null and createTime !='' "> and create_time = #{createTime}</if>
			<if test="modifyUserId != null and modifyUserId !='' "> and modify_user_id = #{modifyUserId}</if>
			<if test="modifyTime != null and modifyTime !='' "> and modify_time = #{modifyTime}</if>
			<if test="sts != null and sts !='' "> and sts = #{sts}</if>
			<if test="orgId != null and orgId !='' "> and org_id = #{orgId}</if>
		</trim>
	</update>

	<!-- 物理删除 -->
	<delete id="entity_delete" parameterType="com.hzya.frame.sys.appApi.entity.AppApi">
		delete from sys_app_api where id =#{id}
	</delete>

	<resultMap id="get-entity-list-result" type="com.hzya.frame.sys.appApi.entity.AppApiListVo">
		<!--主键ID -->
		<result property="id" column="id" />
		<!--应用id(应用表主键) -->
		<result property="appName" column="app_name" />
		<!--接口名称 -->
		<result property="apiName" column="api_name" />
		<!--接口编码 -->
		<result property="apiCode" column="api_code" />
		<!--创建人id -->
		<result property="createUserId" column="create_user_id" />
		<!--创建时间 -->
		<result property="createTime" column="create_time" />
		<result property="createUser" column="create_user" />
	</resultMap>
	<!-- 分页查询列表 采用like格式 -->
	<select id="queryList" resultMap="get-entity-list-result" parameterType="com.hzya.frame.sys.appApi.entity.AppApiDto">
		select
		a.id,
		b.name as app_name,
		a.api_name,
		a.api_code,
		a.create_user_id,
		c.login_code as create_user,
		a.create_time
		from
		sys_app_api a
		left join sys_app b on a.app_id = b.id and b.sts = 'Y'
		left join sys_user c on a.create_user_id = c.id and c.sts = 'Y'
		<trim prefix="where" prefixOverrides="and">
			and a.sts = 'Y'
			<if test="appId != null and appId !='' "> and a.app_id like concat('%',#{appId},'%') </if>
			<if test="apiName != null and apiName !='' "> and a.api_name like concat('%',#{apiName},'%') </if>
			<if test="apiCode != null and apiCode !='' "> and a.api_code like concat('%',#{apiCode},'%') </if>
		</trim>
		 order by a.sorts asc
	</select>
</mapper>
