zxl
4 天以前 8063ee7eee51bfe25a09428e6efc60f828b270c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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.CustomerBlackMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.CustomerBlackVO">
        <result column="store_id" property="storeId" />
        <result column="user_id" property="userId" />
        <result column="create_time" property="createTime" />
        <result column="create_by" property="createBy" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="username" property="username" />
        <result column="nickName" property="nick_name" />
        <result property="region" column="region"/>
        <result property="storeId" column="store_id"/>
    </resultMap>
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LCB.store_id,
            LCB.user_id,
            LCB.create_time,
            LCB.create_by,
            LCB.update_by,
            LCB.update_time,
            LCB.id
        FROM
            lmk_customer_black LCB
        WHERE
            LCB.id = #{id} AND LCB.delete_flag = 0
    </select>
 
 
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LCB.store_id,
            LCB.user_id,
            LCB.create_time,
            LCB.create_by,
            LCB.update_by,
            LCB.update_time,
            LCB.id,
            lm.username,
            lm.nick_name,
            lm.region
        FROM
            lmk_customer_black LCB
        LEFT JOIN
            li_member lm ON LCB.user_id = lm.id
        <where>
            LCB.delete_flag = 0
            <!-- 用户名模糊查询 -->
            <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>
            <!-- 商铺id -->
            <if test="query.storeId != null and query.storeId != ''">
                AND lm.store_id = #{query.storeId}
            </if>
        </where>
 
    </select>
 
</mapper>