|
|
@ -12,7 +12,8 @@
|
|
|
|
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
|
|
|
|
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
|
|
|
|
LEFT JOIN op_customer t2 ON t2.id = t1.customer_id
|
|
|
|
LEFT JOIN op_customer t2 ON t2.id = t1.customer_id
|
|
|
|
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
|
|
|
|
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
|
|
|
|
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1
|
|
|
|
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id
|
|
|
|
|
|
|
|
where t1.id > 0
|
|
|
|
<choose>
|
|
|
|
<choose>
|
|
|
|
<when test="shopId != null and shopId.size > 0 ">
|
|
|
|
<when test="shopId != null and shopId.size > 0 ">
|
|
|
|
and t1.store_id in
|
|
|
|
and t1.store_id in
|
|
|
@ -25,13 +26,37 @@
|
|
|
|
</otherwise>
|
|
|
|
</otherwise>
|
|
|
|
</choose>
|
|
|
|
</choose>
|
|
|
|
<if test="startDate != null">
|
|
|
|
<if test="startDate != null">
|
|
|
|
and t2.create_time >= #{startDate}
|
|
|
|
and t1.create_time >= #{startDate}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="endDate != null">
|
|
|
|
<if test="endDate != null">
|
|
|
|
and t2.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
and t1.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
order by t2.create_time desc,t2.id desc,t1.user_id desc
|
|
|
|
order by t1.create_time desc,t1.customer_id desc,t1.user_id desc
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectCustomerInfoByShopIds_COUNT" resultType="Long">
|
|
|
|
|
|
|
|
SELECT count(t1.id)
|
|
|
|
|
|
|
|
from op_seller_customer_relation t1
|
|
|
|
|
|
|
|
where t1.id > 0
|
|
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
|
|
<when test="shopId != null and shopId.size > 0 ">
|
|
|
|
|
|
|
|
and t1.store_id in
|
|
|
|
|
|
|
|
<foreach collection="shopId" index="index" item="item" open="(" separator="," close=")">
|
|
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
|
|
and 1 = 0
|
|
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
|
|
|
and t1.create_time >= #{startDate}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
|
|
|
and t1.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
|
|
|
|
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
|
|
|
|
SELECT t2.id,t2.`name`,
|
|
|
|
SELECT t2.id,t2.`name`,
|
|
|
|
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
|
|
|
|
t2.member_id as idCard,t0.name as shopName,t0.code as shopCode,
|
|
|
@ -40,18 +65,33 @@
|
|
|
|
from op_seller_customer_relation t1
|
|
|
|
from op_seller_customer_relation t1
|
|
|
|
left join poi_store t0 on t0.id = t1.store_id
|
|
|
|
left join poi_store t0 on t0.id = t1.store_id
|
|
|
|
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
|
|
|
|
left join poi_store_staff t5 ON t5.store_id = t0.id and t1.user_id = t5.id
|
|
|
|
LEFT JOIN op_customer t2 ON t2.id = t1.customer_id
|
|
|
|
JOIN op_customer t2 ON t2.id = t1.customer_id
|
|
|
|
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
|
|
|
|
LEFT JOIN op_vip t3 ON t3.id = t2.member_id
|
|
|
|
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id where 1 =1
|
|
|
|
LEFT JOIN privilage_user t4 ON t4.id = t5.user_id
|
|
|
|
|
|
|
|
where t1.id > 0
|
|
|
|
|
|
|
|
and t1.user_id = #{sellerId}
|
|
|
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
|
|
|
and t1.create_time >= #{startDate}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
|
|
|
and t1.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
GROUP BY t1.customer_id
|
|
|
|
|
|
|
|
order by t1.create_time desc,t2.id desc
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 获取总数 -->
|
|
|
|
|
|
|
|
<select id="selectCustomerInfoBySellerId_COUNT" resultType="Long">
|
|
|
|
|
|
|
|
SELECT count(DISTINCT t1.customer_id)
|
|
|
|
|
|
|
|
from op_seller_customer_relation t1
|
|
|
|
|
|
|
|
where t1.id > 0
|
|
|
|
and t1.user_id = #{sellerId}
|
|
|
|
and t1.user_id = #{sellerId}
|
|
|
|
<if test="startDate != null">
|
|
|
|
<if test="startDate != null">
|
|
|
|
and t2.create_time >= #{startDate}
|
|
|
|
and t1.create_time >= #{startDate}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="endDate != null">
|
|
|
|
<if test="endDate != null">
|
|
|
|
and t2.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
and t1.create_time <![CDATA[ < ]]> #{endDate}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
GROUP BY t2.id
|
|
|
|
|
|
|
|
order by t2.create_time desc,t2.id desc
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<!--客户list-->
|
|
|
|
<!--客户list-->
|
|
|
|