<?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.yunzhi.marketing.mapper.TaCustomerFromMapper">

    <select id="countPerson" resultType="java.util.HashMap">
        SELECT
            count( 1 ) AS orgCount,
            IFNULL( sum( IF ( t.building_id = #{buildingId}, 1, 0 ) ), 0 ) AS projectCount
        FROM
            ta_customer_from t
        WHERE
            t.org_id = #{orgId}
        AND t.person_id = #{personId}
    </select>
</mapper>
