|
|
|
<?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.kiisoo.ic.customer.mapper.OpSellerCustomerRelationDOMapper">
|
|
|
|
<select id="selectShopListByDate" resultType="com.kiisoo.ic.customer.bean.FriendDTO">
|
|
|
|
SELECT
|
|
|
|
t2.NAME AS customerName,
|
|
|
|
t2.id AS customerId,
|
|
|
|
t2.phone AS mobile,
|
|
|
|
t5.NAME AS inviteSellerName,
|
|
|
|
t4.id AS inviteSellerId,
|
|
|
|
t1.create_time AS addTime,
|
|
|
|
t6.avatar,
|
|
|
|
t3.id as vipFlag
|
|
|
|
FROM
|
|
|
|
op_seller_customer_relation t1,
|
|
|
|
op_customer t2 left join op_vip t3 on t2.member_id = t3.id and t3.status = 1,
|
|
|
|
poi_store_staff t4,
|
|
|
|
privilage_user t5,
|
|
|
|
op_customer_enterprise_wechat t6
|
|
|
|
WHERE
|
|
|
|
t1.customer_id = t2.id
|
|
|
|
AND t1.user_id = t5.id
|
|
|
|
AND t1.user_id = t4.user_id
|
|
|
|
AND t1.store_id = t4.store_id
|
|
|
|
and t2.id = t6.customer_id
|
|
|
|
<if test="type == 1">
|
|
|
|
and t3.id is not null
|
|
|
|
</if>
|
|
|
|
<if test="type == 2">
|
|
|
|
and t3.id is null
|
|
|
|
</if>
|
|
|
|
<if test="userId != null">
|
|
|
|
and t1.user_id = #{userId}
|
|
|
|
</if>
|
|
|
|
<if test="shopId != null">
|
|
|
|
and t1.store_id = #{shopId}
|
|
|
|
</if>
|
|
|
|
<if test="sellerId != null and sellerId != 0">
|
|
|
|
and t4.id = #{sellerId}
|
|
|
|
</if>
|
|
|
|
<if test="search != null and search !=''">
|
|
|
|
and
|
|
|
|
CONCAT(IFNULL(t2.name,''),IFNULL(t2.phone,''))
|
|
|
|
LIKE CONCAT('%',#{search},'%')
|
|
|
|
</if>
|
|
|
|
<if test="startDate != null">
|
|
|
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
|
|
|
|
</if>
|
|
|
|
<if test="endDate != null">
|
|
|
|
and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</mapper>
|