<?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.mall.member.mapper.MemberMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.member.domain.entity.Member">
            <id column="id" property="id"/>
            <id column="level_id" property="levelId"/>
            <id column="username" property="username"/>
            <id column="password" property="password"/>
            <id column="nickname" property="nickname"/>
            <id column="mobile" property="mobile"/>
            <id column="email" property="email"/>
            <id column="header" property="header"/>
            <id column="gender" property="gender"/>
            <id column="birth" property="birth"/>
            <id column="city" property="city"/>
            <id column="job" property="job"/>
            <id column="sign" property="sign"/>
            <id column="source_type" property="sourceType"/>
            <id column="integration" property="integration"/>
            <id column="growth" property="growth"/>
            <id column="status" property="status"/>
            <id column="create_time" property="createTime"/>
            <id column="social_uid" property="socialUid"/>
            <id column="access_token" property="accessToken"/>
            <id column="expires_in" property="expiresIn"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,level_id,username,password,nickname,mobile,email,header,gender,birth,city,job,sign,source_type,integration,growth,status,create_time,social_uid,access_token,expires_in
    </sql>

    <!-- 分页查询会员内容 -->
    <select id="selectListByPage" resultType="com.mall.member.domain.vo.MemberVo">
        select
        <include refid="Base_Column_List"/>
        from ums_member
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.levelId != null and dto.levelId != ''">
                    and level_id like CONCAT('%',#{dto.levelId},'%')
                </if>
                <if test="dto.username != null and dto.username != ''">
                    and username like CONCAT('%',#{dto.username},'%')
                </if>
                <if test="dto.password != null and dto.password != ''">
                    and password like CONCAT('%',#{dto.password},'%')
                </if>
                <if test="dto.nickname != null and dto.nickname != ''">
                    and nickname like CONCAT('%',#{dto.nickname},'%')
                </if>
                <if test="dto.mobile != null and dto.mobile != ''">
                    and mobile like CONCAT('%',#{dto.mobile},'%')
                </if>
                <if test="dto.email != null and dto.email != ''">
                    and email like CONCAT('%',#{dto.email},'%')
                </if>
                <if test="dto.header != null and dto.header != ''">
                    and header like CONCAT('%',#{dto.header},'%')
                </if>
                <if test="dto.gender != null and dto.gender != ''">
                    and gender like CONCAT('%',#{dto.gender},'%')
                </if>
                <if test="dto.birth != null and dto.birth != ''">
                    and birth like CONCAT('%',#{dto.birth},'%')
                </if>
                <if test="dto.city != null and dto.city != ''">
                    and city like CONCAT('%',#{dto.city},'%')
                </if>
                <if test="dto.job != null and dto.job != ''">
                    and job like CONCAT('%',#{dto.job},'%')
                </if>
                <if test="dto.sign != null and dto.sign != ''">
                    and sign like CONCAT('%',#{dto.sign},'%')
                </if>
                <if test="dto.sourceType != null and dto.sourceType != ''">
                    and source_type like CONCAT('%',#{dto.sourceType},'%')
                </if>
                <if test="dto.integration != null and dto.integration != ''">
                    and integration like CONCAT('%',#{dto.integration},'%')
                </if>
                <if test="dto.growth != null and dto.growth != ''">
                    and growth like CONCAT('%',#{dto.growth},'%')
                </if>
                <if test="dto.status != null and dto.status != ''">
                    and status like CONCAT('%',#{dto.status},'%')
                </if>
                <if test="dto.createTime != null and dto.createTime != ''">
                    and create_time like CONCAT('%',#{dto.createTime},'%')
                </if>
                <if test="dto.socialUid != null and dto.socialUid != ''">
                    and social_uid like CONCAT('%',#{dto.socialUid},'%')
                </if>
                <if test="dto.accessToken != null and dto.accessToken != ''">
                    and access_token like CONCAT('%',#{dto.accessToken},'%')
                </if>
                <if test="dto.expiresIn != null and dto.expiresIn != ''">
                    and expires_in like CONCAT('%',#{dto.expiresIn},'%')
                </if>
        </where>
    </select>

</mapper>
