TdBApiSMapper.xml 2.5 KB
<?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.zteits.pay.mapper.smapper.TdBApiSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBApi">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="path" jdbcType="VARCHAR" property="path" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="api_type" jdbcType="INTEGER" property="apiType" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="uddi" jdbcType="VARCHAR" property="uddi" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, path, url, user_id, api_type, remark, uddi, data_state, create_empid, create_date, 
    modfiy_empid, modfiy_date
  </sql>
  <select id="queryApiHYCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
    
	SELECT
		count(a._count) count
	FROM
		(
			SELECT
				`code`,
				count(`code`) _count
			FROM
				td_b_api_log
			GROUP BY
				`code`
			HAVING
				_count > 10
		) a,
		td_b_api b
	WHERE
		a.`code` = b.`code`
	AND b.api_type =  #{apiType,jdbcType=INTEGER}
  </select>
  
  <select id="queryApiCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
    select 
    count(1) count
    from td_b_api
    where api_type= #{apiType,jdbcType=INTEGER}
  </select>
  
  <select id="queryApiRankingList" parameterType="java.lang.Integer" resultType="com.zteits.clouds.api.dto.pay.ApiListDTO">
    SELECT
		a.uddi uddi,
		a.url url,
		count(b.`code`) apiCount
	FROM
		td_b_api a,
		td_b_api_log b
	WHERE
		a.`code` = b.`code`
	AND a.api_type = #{apiType,jdbcType=INTEGER}
	GROUP BY
		a.uddi,
		a.url
		order by apiCount desc
  </select>
  
   <select id="queryApiList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_b_api
    where api_type = #{apiType,jdbcType=INTEGER}
  </select>
  
  
</mapper>