<?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.fjhx.mapper.tda.TdaApplicationMapper">

    <select id="getDetails" resultType="java.util.Map">
        select (
                   select count(0)
                   from tda_product tp
                   where tp.tda_application_id = #{id}
               ) productCount,
               (
                   select count(0)
                   from tda_product tp
                            inner join tda_device td on td.tda_product_id = tp.id
                   where tp.tda_application_id = #{id}
               ) deviceCount
    </select>

</mapper>
