|
|
|
@ -294,25 +294,25 @@
|
|
|
|
|
WHERE t.store_id = #{storeId}
|
|
|
|
|
and t.customer_id = t2.id
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
and date(t.create_time) >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
and date(t.create_time) <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
group by store_id
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectWxSumCusNumByConditionStaff" resultType="java.lang.Integer">
|
|
|
|
|
SELECT count(customer_id) from op_seller_customer_relation t1, poi_store_staff t2 where t1.user_id = t2.id
|
|
|
|
|
SELECT count(customer_id) from op_seller_customer_relation t1, poi_store_staff t2, op_customer t3 where t1.customer_id = t3.id and t1.user_id = t2.id
|
|
|
|
|
and t2.type = 4
|
|
|
|
|
<if test="userId != null">
|
|
|
|
|
AND t2.user_id = #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
and date(t1.create_time) >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
and date(t1.create_time) <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
group by t1.user_id
|
|
|
|
|
</select>
|
|
|
|
@ -326,17 +326,18 @@
|
|
|
|
|
user_id AS id,
|
|
|
|
|
count( customer_id ) AS cusNum
|
|
|
|
|
FROM
|
|
|
|
|
`op_seller_customer_relation`
|
|
|
|
|
`op_seller_customer_relation` t,op_customer t2
|
|
|
|
|
WHERE
|
|
|
|
|
store_id = #{storeId}
|
|
|
|
|
t.customer_id = t2.id
|
|
|
|
|
and t. store_id = #{storeId}
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
and date(t.create_time) >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
and date(t.create_time) <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY
|
|
|
|
|
user_id
|
|
|
|
|
t.user_id
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectWxValidStaffNameList" resultType="com.kiisoo.ic.store.entity.StaffDO">
|
|
|
|
|
SELECT
|
|
|
|
@ -370,10 +371,10 @@
|
|
|
|
|
JOIN `op_seller_customer_relation` t2 ON t1.id = t2.store_id
|
|
|
|
|
JOIN op_customer t3 on t2.customer_id = t3.id
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t3.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
and date(t2.create_time) >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t3.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
and date(t2.create_time) <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
WHERE
|
|
|
|
|
t1.STATUS = 1
|
|
|
|
@ -393,15 +394,16 @@
|
|
|
|
|
( SELECT count( t2.customer_id ) AS newCusNum, t1.user_id AS userId FROM
|
|
|
|
|
poi_store_staff t1
|
|
|
|
|
LEFT JOIN `op_seller_customer_relation` t2 ON t1.id = t2.user_id
|
|
|
|
|
left join op_customer t3 on t2.customer_id = t3.id
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
and date(t2.create_time) >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
and date(t2.create_time) <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
where t1.store_id = #{storeId}
|
|
|
|
|
and t1.type = 4
|
|
|
|
|
GROUP BY userId ORDER BY newCusNum DESC, userId DESC ) a,
|
|
|
|
|
GROUP BY userId,t3.id ORDER BY newCusNum DESC, userId DESC ) a,
|
|
|
|
|
( SELECT @rank := 0 ) b
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectLatestUpdateTime" resultType="java.util.Date">
|
|
|
|
|