|
|
@ -45,29 +45,41 @@
|
|
|
|
</update>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countTradedClients" resultType="java.lang.Integer">
|
|
|
|
<select id="countTradedClients" resultType="java.lang.Integer">
|
|
|
|
select COUNT(DISTINCT client_id) traded_clients
|
|
|
|
select COUNT(DISTINCT s.client_id) traded_clients
|
|
|
|
FROM sys_clients_customers
|
|
|
|
FROM sys_clients_customers s
|
|
|
|
|
|
|
|
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="begin!=null">and last_payment_time >= #{begin}</if>
|
|
|
|
<if test="begin!=null">and s.last_payment_time >= #{begin}</if>
|
|
|
|
<if test="end!=null">and last_payment_time <= #{end}</if>
|
|
|
|
<if test="end!=null">and s.last_payment_time <= #{end}</if>
|
|
|
|
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
|
|
|
|
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countTotalCustomers" resultType="java.lang.Integer">
|
|
|
|
<select id="countTotalCustomers" resultType="java.lang.Integer">
|
|
|
|
select COUNT(DISTINCT customer_id) total_customers
|
|
|
|
select COUNT(DISTINCT s.customer_id) total_customers
|
|
|
|
FROM sys_clients_customers
|
|
|
|
FROM sys_clients_customers s
|
|
|
|
|
|
|
|
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="begin!=null">and last_payment_time >= #{begin}</if>
|
|
|
|
<if test="begin!=null">and s.last_payment_time >= #{begin}</if>
|
|
|
|
<if test="end!=null">and last_payment_time <= #{end}</if>
|
|
|
|
<if test="end!=null">and s.last_payment_time <= #{end}</if>
|
|
|
|
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
|
|
|
|
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="countTotalOldCustomers" resultType="java.lang.Integer">
|
|
|
|
<select id="countTotalOldCustomers" resultType="java.lang.Integer">
|
|
|
|
select COUNT(DISTINCT customer_id) total_old_customers
|
|
|
|
select COUNT(DISTINCT s.customer_id) total_old_customers
|
|
|
|
FROM sys_clients_customers
|
|
|
|
FROM sys_clients_customers s
|
|
|
|
|
|
|
|
LEFT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="begin!=null">and update_time < #{begin} AND last_payment_time > #{begin}</if>
|
|
|
|
<if test="begin!=null">and s.update_time < #{begin} AND s.last_payment_time > #{begin}</if>
|
|
|
|
<if test="end!=null">and last_payment_time < #{end}</if>
|
|
|
|
<if test="end!=null">and s.last_payment_time < #{end}</if>
|
|
|
|
|
|
|
|
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
|
|
|
|
|
|
|
|
<if test="org_ids!=null">and c.org_id in
|
|
|
|
|
|
|
|
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
</mapper>
|
|
|
|
</mapper>
|