<?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="cn.lili.modules.lmk.mapper.CustomerMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="cn.lili.modules.member.entity.vo.MemberVO">
|
<id property="id" column="id"/>
|
|
<!-- 基础字段映射 -->
|
<result property="username" column="username"/>
|
<result property="nickName" column="nick_name"/>
|
<result property="sex" column="sex"/>
|
<result property="birthday" column="birthday"/>
|
<result property="regionId" column="region_id"/>
|
<result property="region" column="region"/>
|
<result property="mobile" column="mobile"/>
|
<result property="point" column="point"/>
|
<result property="totalPoint" column="total_point"/>
|
<result property="face" column="face"/>
|
<result property="disabled" column="disabled"/>
|
<result property="haveStore" column="have_store"/>
|
<result property="storeId" column="store_id"/>
|
<result property="openId" column="open_id"/>
|
<result property="clientEnum" column="client_enum"/>
|
<result property="lastLoginDate" column="last_login_date"/>
|
<result property="gradeId" column="grade_id"/>
|
<result property="experience" column="experience"/>
|
<result property="createTime" column="create_time"/>
|
<collection property="customerTagList" ofType="cn.lili.modules.lmk.domain.vo.CustomerTagVO"
|
select="selectTagByMemberId"
|
column="id"
|
/>
|
</resultMap>
|
|
<select id="getPage" resultMap="BaseResultMap">
|
SELECT
|
*
|
FROM
|
li_member lm
|
<where>
|
<!-- 用户名模糊查询 -->
|
<if test="query.username != null and query.username != ''">
|
AND lm.username LIKE CONCAT('%', #{query.username}, '%')
|
</if>
|
|
<!-- 昵称模糊查询 -->
|
<if test="query.nickName != null and query.nickName != ''">
|
AND lm.nick_name LIKE CONCAT('%', #{query.nickName}, '%')
|
</if>
|
|
<!-- 手机号码精确查询 -->
|
<if test="query.mobile != null and query.mobile != ''">
|
AND lm.mobile = #{query.mobile}
|
</if>
|
|
<!-- 会员状态转 -->
|
<if test="query.disabled != null and query.disabled != ''">
|
AND lm.disabled = #{query.disabled}
|
</if>
|
|
<!-- 商铺id -->
|
<if test="query.storeId != null and query.storeId != ''">
|
AND lm.store_id = #{query.storeId}
|
</if>
|
AND EXISTS (
|
SELECT 1
|
FROM li_order lo
|
WHERE lo.member_id = lm.id
|
)
|
</where>
|
ORDER BY lm.create_time DESC
|
</select>
|
|
<select id="selectTagByMemberId" resultType="cn.lili.modules.lmk.domain.vo.CustomerTagVO">
|
SELECT
|
LCT.id,
|
LCT.tag_name,
|
LCT.create_type
|
FROM lmk_customer_tag_ref LCTR
|
LEFT JOIN lmk_customer_tag LCT
|
ON LCTR.customer_tag_id = LCT.id
|
WHERE LCTR.customer_id =#{id}
|
</select>
|
|
|
</mapper>
|