1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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.huiju.estateagents.statistic.mapper.TsCustomerStatisticMonthlyMapper">
-
- <select id="getNewCustomerStatisticMonthly"
- resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
- SELECT
- org_id,
- count( customer_id ) as customer_num
- FROM
- ta_recommend_customer
- WHERE
- `STATUS` = #{status}
- AND date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
- GROUP BY
- org_id
- </select>
-
- <select id="getFollowUpStatisticMonthly"
- resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
- SELECT
- org_id,
- count( DISTINCT ( customer_id ) ) as customer_num
- FROM
- ta_customer_follow_up_record
- WHERE
- date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
- GROUP BY
- org_id
- </select>
- <select id="getVisiteStatisticMonthly"
- resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
- SELECT
- count( DISTINCT ( c.customer_id ) ) as customer_num,
- c.org_id
- FROM
- ta_activity_dynamic_enlist t
- LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
- AND t.building_id = c.building_id
- AND t.org_id = c.org_id
- WHERE
- t.is_checkin = #{checkin}
- AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
- GROUP BY
- c.org_id
- </select>
- <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
- SELECT
- *
- FROM
- ts_customer_statistic_monthly
- WHERE
- org_id = #{orgId}
- AND customer_type = #{customerType}
- AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
- AND date_format( create_date, '%Y-%m-%d' ) <= date_format( #{nowDate}, '%Y-%m-%d' )
- order by `month`
- </select>
- </mapper>
|