You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bsdgy-server/src/main/resources/mapper/OpCustomerDOMapper.xml

82 lines
3.3 KiB
XML

<?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.OpCustomerDOMapper">
<select id="selectCustomerInfoByShopIds" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
select
t2.id,t2.`name`,
t2.member_id as idCard,GROUP_CONCAT(DISTINCT t0.`name`) as shopName,
GROUP_CONCAT(DISTINCT t4.`name`) as sellerName, t3.birthday, t2.phone,
t3.name as vipName,t3.phone as vipPhone
from
poi_store t0,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id,
op_customer t2 LEFT JOIN op_vip t3 on t2.member_id = t3.id
where t0.id = t1.store_id and t1.customer_id = t2.id
<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>
GROUP BY t2.id
order by t2.id asc
</select>
<select id="selectCustomerInfoBySellerId" resultType="com.kiisoo.ic.customer.bean.OpCustomerDTO">
select
t2.id,t2.`name`,t2.member_id as idCard,GROUP_CONCAT(DISTINCT t0.`name`) as shopName, GROUP_CONCAT(DISTINCT t4.`name`) as sellerName, t3.birthday, t2.phone
,t3.name as vipName,t3.phone as vipPhone
from
poi_store t0,
op_seller_customer_relation t1 LEFT JOIN privilage_user t4 on t1.user_id = t4.id,
op_customer t2 LEFT JOIN op_vip t3 on t2.member_id = t3.id
where t0.id = t1.store_id and t1.customer_id = t2.id
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 t2.id
order by t2.id asc
</select>
<!--客户list-->
<select id="selectCustomerList" resultType="com.kiisoo.ic.customer.entity.OpCustomer">
select t1.id as id, t1.`name` as name,t1.phone as phone, t2.create_time as registerTime
from op_customer t1, op_seller_customer_relation t2
where t1.id=t2.customer_id
<if test="memberId != null">
and t1.member_id = #{memberId}
</if>
<if test="shopIds != null and shopIds.size > 0">
and t2.store_id in
<foreach collection="shopIds" separator="," item="item" index="index" close=")" open="(">
#{item}
</foreach>
</if>
<if test="sellerId != null">
and t2.user_id=#{sellerId}
</if>
<if test="startDate != null">
and t2.create_time <![CDATA[ >= ]]> #{startDate}
</if>
<if test="endDate != null">
and t2.create_time <![CDATA[ <= ]]> #{endDate}
</if>
</select>
</mapper>