<?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.slodon.b2b2c.dao.read.member.MemberReadMapper">
    <resultMap id="resultMap" type="com.slodon.b2b2c.member.pojo.Member">
        <id column="member_id" property="memberId"/>
        <result column="member_name" property="memberName"/>
        <result column="member_nick_name" property="memberNickName"/>
        <result column="member_true_name" property="memberTrueName"/>
        <result column="member_birthday" property="memberBirthday"/>
        <result column="member_integral" property="memberIntegral"/>
        <result column="integral_frozen" property="integralFrozen"/>
        <result column="member_email" property="memberEmail"/>
        <result column="member_qq" property="memberQq"/>
        <result column="member_mobile" property="memberMobile"/>
        <result column="member_avatar" property="memberAvatar"/>
        <result column="login_pwd" property="loginPwd"/>
        <result column="pay_pwd" property="payPwd"/>
        <result column="gender" property="gender"/>
        <result column="grade" property="grade"/>
        <result column="experience_value" property="experienceValue"/>
        <result column="register_time" property="registerTime"/>
        <result column="last_login_time" property="lastLoginTime"/>
        <result column="last_login_ip" property="lastLoginIp"/>
        <result column="login_number" property="loginNumber"/>
        <result column="last_payment_code" property="lastPaymentCode"/>
        <result column="pay_error_count" property="payErrorCount"/>
        <result column="login_error_count" property="loginErrorCount"/>
        <result column="register_channel" property="registerChannel"/>
        <result column="balance_available" property="balanceAvailable"/>
        <result column="balance_frozen" property="balanceFrozen"/>
        <result column="state" property="state"/>
        <result column="is_email_verify" property="isEmailVerify"/>
        <result column="is_mobile_verify" property="isMobileVerify"/>
        <result column="is_receive_sms" property="isReceiveSms"/>
        <result column="is_receive_email" property="isReceiveEmail"/>
        <result column="is_allow_buy" property="isAllowBuy"/>
        <result column="is_allow_ask" property="isAllowAsk"/>
        <result column="is_allow_comment" property="isAllowComment"/>
        <result column="wx_unionid" property="wxUnionid"/>
        <result column="wx_avatar_img" property="wxAvatarImg"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_email_active" property="isEmailActive" />
        <result column="gp_uid" property="gpUid" />
        <result column="gp_token" property="gpToken" />
        <result column="member_company" property="memberCompany" />
        <result column="member_main_product" property="memberMainProduct" />
        <result column="country" property="country" />
        <result column="city" property="city" />
        <result column="web_site" property="webSite" />
    </resultMap>
    <!--按照主键值进行操作-->
    <sql id="pkWhere">
    WHERE `member_id` = #{primaryKey}
  </sql>
    <!--操作条件-->
    <sql id="whereCondition">
        <if test="example != null">
            <trim prefix="WHERE" prefixOverrides="AND|OR">
                <if test="example.memberIdNotEquals != null">
                    AND `member_id` != #{example.memberIdNotEquals}
                </if>
                <if test="example.memberIdIn != null">
                    AND `member_id` in (${example.memberIdIn})
                </if>
                <if test="example.memberName != null">
                    AND `member_name` = #{example.memberName}
                </if>
                <if test="example.memberNameLike != null">
                    AND `member_name` like concat('%',#{example.memberNameLike},'%')
                </if>
                <if test="example.memberNickName != null">
                    AND `member_nick_name` = #{example.memberNickName}
                </if>
                <if test="example.memberNickNameLike != null">
                    AND `member_nick_name` like concat('%',#{example.memberNickNameLike},'%')
                </if>
                <if test="example.memberTrueName != null">
                    AND `member_true_name` = #{example.memberTrueName}
                </if>
                <if test="example.memberTrueNameLike != null">
                    AND `member_true_name` like concat('%',#{example.memberTrueNameLike},'%')
                </if>
                <if test="example.memberBirthday != null">
                    AND `member_birthday` = #{example.memberBirthday}
                </if>
                <if test="example.memberIntegral != null">
                    AND `member_integral` = #{example.memberIntegral}
                </if>
                <if test="example.integralFrozen != null">
                    AND `integral_frozen` = #{example.integralFrozen}
                </if>
                <if test="example.memberEmail != null">
                    AND `member_email` = #{example.memberEmail}
                </if>
                <if test="example.memberQq != null">
                    AND `member_qq` = #{example.memberQq}
                </if>
                <if test="example.memberMobile != null">
                    AND `member_mobile` = #{example.memberMobile}
                </if>
                <if test="example.memberMobileLike != null">
                    AND `member_mobile` like concat('%',#{example.memberMobileLike},'%')
                </if>
                <if test="example.memberAvatar != null">
                    AND `member_avatar` = #{example.memberAvatar}
                </if>
                <if test="example.loginPwd != null">
                    AND `login_pwd` = #{example.loginPwd}
                </if>
                <if test="example.payPwd != null">
                    AND `pay_pwd` = #{example.payPwd}
                </if>
                <if test="example.gender != null">
                    AND `gender` = #{example.gender}
                </if>
                <if test="example.grade != null">
                    AND `grade` = #{example.grade}
                </if>
                <if test="example.experienceValue != null">
                    AND `experience_value` = #{example.experienceValue}
                </if>
                <if test="example.registerTimeAfter != null">
                    AND `register_time` <![CDATA[ >= ]]> #{example.registerTimeAfter}
                </if>
                <if test="example.registerTimeBefore != null">
                    AND `register_time` <![CDATA[ <= ]]> #{example.registerTimeBefore}
                </if>
                <if test="example.lastLoginTimeAfter != null">
                    AND `last_login_time` <![CDATA[ >= ]]> #{example.lastLoginTimeAfter}
                </if>
                <if test="example.lastLoginTimeBefore != null">
                    AND `last_login_time` <![CDATA[ <= ]]> #{example.lastLoginTimeBefore}
                </if>
                <if test="example.lastLoginIp != null">
                    AND `last_login_ip` = #{example.lastLoginIp}
                </if>
                <if test="example.loginNumber != null">
                    AND `login_number` = #{example.loginNumber}
                </if>
                <if test="example.lastPaymentCode != null">
                    AND `last_payment_code` = #{example.lastPaymentCode}
                </if>
                <if test="example.payErrorCount != null">
                    AND `pay_error_count` = #{example.payErrorCount}
                </if>
                <if test="example.loginErrorCount != null">
                    AND `login_error_count` = #{example.loginErrorCount}
                </if>
                <if test="example.registerChannel != null">
                    AND `register_channel` = #{example.registerChannel}
                </if>
                <if test="example.balanceAvailable != null">
                    AND `balance_available` = #{example.balanceAvailable}
                </if>
                <if test="example.balanceFrozen != null">
                    AND `balance_frozen` = #{example.balanceFrozen}
                </if>
                <if test="example.state != null">
                    AND `state` = #{example.state}
                </if>
                <if test="example.stateNotEquals != null">
                    AND `state` != #{example.stateNotEquals}
                </if>
                <if test="example.isEmailVerify != null">
                    AND `is_email_verify` = #{example.isEmailVerify}
                </if>
                <if test="example.isMobileVerify != null">
                    AND `is_mobile_verify` = #{example.isMobileVerify}
                </if>
                <if test="example.isReceiveSms != null">
                    AND `is_receive_sms` = #{example.isReceiveSms}
                </if>
                <if test="example.isReceiveEmail != null">
                    AND `is_receive_email` = #{example.isReceiveEmail}
                </if>
                <if test="example.isAllowBuy != null">
                    AND `is_allow_buy` = #{example.isAllowBuy}
                </if>
                <if test="example.isAllowAsk != null">
                    AND `is_allow_ask` = #{example.isAllowAsk}
                </if>
                <if test="example.isAllowComment != null">
                    AND `is_allow_comment` = #{example.isAllowComment}
                </if>
                <if test="example.wxUnionid != null">
                    AND `wx_unionid` = #{example.wxUnionid}
                </if>
                <if test="example.wxAvatarImg != null">
                    AND `wx_avatar_img` = #{example.wxAvatarImg}
                </if>
                <if test="example.updateTimeAfter != null">
                    AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
                </if>
                <if test="example.updateTimeBefore != null">
                    AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
                </if>
                <if test="example.memberNameOrMemberMobile != null">
                    AND `member_name` = #{example.memberNameOrMemberMobile} or `member_mobile` = #{example.memberNameOrMemberMobile}
                </if>
                <if test="example.isEmailActive != null">
                    AND `is_email_active` = #{example.isEmailActive}
                </if>
                <if test="example.gpUid != null">
                    AND `gp_uid` = #{example.gpUid}
                </if>
                <if test="example.gpToken != null">
                    AND `gp_token` = #{example.gpToken}
                </if>
                <if test="example.memberCompany != null">
                    AND `member_company` = #{example.memberCompany}
                </if>
                <if test="example.webSite != null">
                    AND `web_site` = #{example.webSite}
                </if>
            </trim>
        </if>
    </sql>
    <!--排序条件-->
    <sql id="orderBy">
    ORDER BY `member_id` DESC
  </sql>
    <sql id="orderByOther">
    order by ${example.orderBy}
  </sql>
    <!--分组条件-->
    <sql id="groupBy">
    group by ${example.groupBy}
  </sql>
    <!--分页条件-->
    <sql id="limit">
        <if test="size != null and size &gt; 0">
            limit #{startRow},#{size}
        </if>
    </sql>
    <!--查询符合条件的记录数-->
    <select id="countByExample" parameterType="com.slodon.b2b2c.member.example.MemberExample"
            resultType="java.lang.Integer">
        SELECT
        COUNT(*)
        FROM `member`
        <include refid="whereCondition"/>
    </select>
    <!--根据主键查询记录-->
    <select id="getByPrimaryKey" resultMap="resultMap">
        SELECT
        *
        FROM `member`
        <include refid="pkWhere"/>
    </select>
    <!--查询符合条件的记录(所有字段)-->
    <select id="listByExample" resultMap="resultMap">
        SELECT
        *
        FROM `member`
        <include refid="whereCondition"/>
        <if test="example.groupBy != null">
            <include refid="groupBy"/>
        </if>
        <choose>
            <when test="example.orderBy != null">
                <include refid="orderByOther"/>
            </when>
            <otherwise>
                <include refid="orderBy"/>
            </otherwise>
        </choose>
    </select>
    <!--分页查询符合条件的记录(所有字段)-->
    <select id="listPageByExample" resultMap="resultMap">
        SELECT
        *
        FROM `member`
        <include refid="whereCondition"/>
        <if test="example.groupBy != null">
            <include refid="groupBy"/>
        </if>
        <choose>
            <when test="example.orderBy != null">
                <include refid="orderByOther"/>
            </when>
            <otherwise>
                <include refid="orderBy"/>
            </otherwise>
        </choose>
        <include refid="limit"/>
    </select>
    <!--查询符合条件的记录(指定字段)-->
    <select id="listFieldsByExample" resultMap="resultMap">
        SELECT
        ${fields}
        FROM `member`
        <include refid="whereCondition"/>
        <if test="example.groupBy != null">
            <include refid="groupBy"/>
        </if>
        <choose>
            <when test="example.orderBy != null">
                <include refid="orderByOther"/>
            </when>
            <otherwise>
                <include refid="orderBy"/>
            </otherwise>
        </choose>
    </select>
    <!--分页查询符合条件的记录(指定字段)-->
    <select id="listFieldsPageByExample" resultMap="resultMap">
        SELECT
        ${fields}
        FROM `member`
        <include refid="whereCondition"/>
        <if test="example.groupBy != null">
            <include refid="groupBy"/>
        </if>
        <choose>
            <when test="example.orderBy != null">
                <include refid="orderByOther"/>
            </when>
            <otherwise>
                <include refid="orderBy"/>
            </otherwise>
        </choose>
        <include refid="limit"/>
    </select>
</mapper>