|
|
|
@ -316,7 +316,7 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectStoreIdByUserId" resultType="java.lang.Long">
|
|
|
|
|
SELECT store_id FROM poi_store_staff WHERE user_id = #{userId} and type = 1 and status = 1 and deleted = 0
|
|
|
|
|
SELECT store_id FROM poi_store_staff WHERE user_id = #{userId} and status = 1 and deleted = 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectWxStaffDOList" resultType="com.kiisoo.ic.store.entity.StaffDO">
|
|
|
|
@ -354,37 +354,51 @@
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectStoreRankNo" resultType="com.kiisoo.ic.store.entity.StorePromotionDataDO">
|
|
|
|
|
SELECT
|
|
|
|
|
a.storeId,
|
|
|
|
|
a.newCusNum,
|
|
|
|
|
@rank := @rank + 1 AS rankNo
|
|
|
|
|
a.storeId,
|
|
|
|
|
a.newCusNum,
|
|
|
|
|
@rank := @rank + 1 AS rankNo
|
|
|
|
|
FROM
|
|
|
|
|
( SELECT count( customer_id ) AS newCusNum, store_id AS storeId FROM
|
|
|
|
|
`op_seller_customer_relation`
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
WHERE DATE_FORMAT(create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY store_id ORDER BY newCusNum DESC ) a,
|
|
|
|
|
( SELECT @rank := 0 ) b
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
count( t2.customer_id ) AS newCusNum,
|
|
|
|
|
t1.id AS storeId
|
|
|
|
|
FROM
|
|
|
|
|
poi_store t1
|
|
|
|
|
LEFT JOIN `op_seller_customer_relation` t2 ON t1.id = t2.store_id
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
WHERE
|
|
|
|
|
t1.STATUS = 1
|
|
|
|
|
GROUP BY
|
|
|
|
|
storeId
|
|
|
|
|
ORDER BY
|
|
|
|
|
newCusNum DESC
|
|
|
|
|
) a,
|
|
|
|
|
( SELECT @rank := 0 ) b
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectStaffRankNo" resultType="com.kiisoo.ic.store.entity.StorePromotionDataDO">
|
|
|
|
|
SELECT
|
|
|
|
|
a.userId,
|
|
|
|
|
a.newCusNum,
|
|
|
|
|
@rank := @rank + 1 AS rankNo
|
|
|
|
|
a.userId,
|
|
|
|
|
a.newCusNum,
|
|
|
|
|
@rank := @rank + 1 AS rankNo
|
|
|
|
|
FROM
|
|
|
|
|
( SELECT count( customer_id ) AS newCusNum, user_id AS userId FROM
|
|
|
|
|
`op_seller_customer_relation`
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
WHERE DATE_FORMAT(create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY user_id ORDER BY newCusNum DESC ) a,
|
|
|
|
|
( SELECT @rank := 0 ) b
|
|
|
|
|
( 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.user_id = t2.user_id
|
|
|
|
|
<if test="startDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
and DATE_FORMAT(t2.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
|
</if>
|
|
|
|
|
where t1.store_id = #{storeId}
|
|
|
|
|
and t1.type = 4
|
|
|
|
|
GROUP BY userId ORDER BY newCusNum DESC ) a,
|
|
|
|
|
( SELECT @rank := 0 ) b
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|