MemberMapper.xml
2.63 KB
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
71
72
73
74
75
76
<?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.lframework.xingyun.basedata.mappers.MemberMapper">
    <resultMap id="Member" type="com.lframework.xingyun.basedata.entity.Member">
        <id column="id" property="id"/>
        <result column="code" property="code"/>
        <result column="name" property="name"/>
        <result column="gender" property="gender"/>
        <result column="telephone" property="telephone"/>
        <result column="email" property="email"/>
        <result column="birthday" property="birthday"/>
        <result column="join_day" property="joinDay"/>
        <result column="available" property="available"/>
        <result column="description" property="description"/>
        <result column="create_by" property="createBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_by" property="updateBy"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>
    <sql id="MemberDto_sql">
        SELECT
            id,
            code,
            name,
            gender,
            telephone,
            email,
            birthday,
            join_day,
            available,
            description,
            create_by,
            create_time,
            update_by,
            update_time
        FROM base_data_member
    </sql>
    <select id="query" resultMap="Member">
        <include refid="MemberDto_sql"/>
        <where>
            <if test="vo != null">
                <if test="vo.code != null and vo.code != ''">
                    AND code = #{vo.code}
                </if>
                <if test="vo.name != null and vo.name != ''">
                    AND name LIKE CONCAT('%', #{vo.name}, '%')
                </if>
                <if test="vo.available != null">
                    AND available = #{vo.available}
                </if>
            </if>
        </where>
        ORDER BY code
    </select>
    <select id="selector" resultMap="Member">
        <include refid="MemberDto_sql"/>
        <where>
            <if test="vo != null">
                <if test="vo.code != null and vo.code != ''">
                    AND code = #{vo.code}
                </if>
                <if test="vo.name != null and vo.name != ''">
                    AND name LIKE CONCAT('%', #{vo.name}, '%')
                </if>
                <if test="vo.available != null">
                    AND available = #{vo.available}
                </if>
            </if>
        </where>
        ORDER BY code
    </select>
</mapper>