<?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.write.member.MemberWriteMapper">
  <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="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="state" property="state" />
    <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" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="memberName != null">
        `member_name`,
      </if>
      <if test="memberNickName != null">
        `member_nick_name`,
      </if>
      <if test="memberTrueName != null">
        `member_true_name`,
      </if>
      <if test="memberBirthday != null">
        `member_birthday`,
      </if>
      <if test="memberIntegral != null">
        `member_integral`,
      </if>
      <if test="integralFrozen != null">
        `integral_frozen`,
      </if>
      <if test="memberEmail != null">
        `member_email`,
      </if>
      <if test="memberQq != null">
        `member_qq`,
      </if>
      <if test="memberMobile != null">
        `member_mobile`,
      </if>
      <if test="memberAvatar != null">
        `member_avatar`,
      </if>
      <if test="loginPwd != null">
        `login_pwd`,
      </if>
      <if test="payPwd != null">
        `pay_pwd`,
      </if>
      <if test="gender != null">
        `gender`,
      </if>
      <if test="grade != null">
        `grade`,
      </if>
      <if test="experienceValue != null">
        `experience_value`,
      </if>
      <if test="registerTime != null">
        `register_time`,
      </if>
      <if test="lastLoginTime != null">
        `last_login_time`,
      </if>
      <if test="lastLoginIp != null">
        `last_login_ip`,
      </if>
      <if test="loginNumber != null">
        `login_number`,
      </if>
      <if test="lastPaymentCode != null">
        `last_payment_code`,
      </if>
      <if test="payErrorCount != null">
        `pay_error_count`,
      </if>
      <if test="loginErrorCount != null">
        `login_error_count`,
      </if>
      <if test="registerChannel != null">
        `register_channel`,
      </if>
      <if test="balanceAvailable != null">
        `balance_available`,
      </if>
      <if test="balanceFrozen != null">
        `balance_frozen`,
      </if>
      <if test="isEmailVerify != null">
        `is_email_verify`,
      </if>
      <if test="isMobileVerify != null">
        `is_mobile_verify`,
      </if>
      <if test="isReceiveSms != null">
        `is_receive_sms`,
      </if>
      <if test="isReceiveEmail != null">
        `is_receive_email`,
      </if>
      <if test="state != null">
        `state`,
      </if>
      <if test="isAllowBuy != null">
        `is_allow_buy`,
      </if>
      <if test="isAllowAsk != null">
        `is_allow_ask`,
      </if>
      <if test="isAllowComment != null">
        `is_allow_comment`,
      </if>
      <if test="wxUnionid != null">
        `wx_unionid`,
      </if>
      <if test="wxAvatarImg != null">
        `wx_avatar_img`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <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.memberId != null">
          AND `member_id` = #{example.memberId}
        </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.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.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.state != null">
          AND `state` = #{example.state}
        </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>
      </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>
  <!--根据条件删除记录，可多条删除-->
  <delete id="deleteByExample">
    DELETE FROM `member`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `member`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="member_id" keyProperty="memberId" parameterType="com.slodon.b2b2c.member.pojo.Member" useGeneratedKeys="true">
    INSERT INTO `member`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="memberName != null">
        #{memberName},
      </if>
      <if test="memberNickName != null">
        #{memberNickName},
      </if>
      <if test="memberTrueName != null">
        #{memberTrueName},
      </if>
      <if test="memberBirthday != null">
        #{memberBirthday},
      </if>
      <if test="memberIntegral != null">
        #{memberIntegral},
      </if>
      <if test="integralFrozen != null">
        #{integralFrozen},
      </if>
      <if test="memberEmail != null">
        #{memberEmail},
      </if>
      <if test="memberQq != null">
        #{memberQq},
      </if>
      <if test="memberMobile != null">
        #{memberMobile},
      </if>
      <if test="memberAvatar != null">
        #{memberAvatar},
      </if>
      <if test="loginPwd != null">
        #{loginPwd},
      </if>
      <if test="payPwd != null">
        #{payPwd},
      </if>
      <if test="gender != null">
        #{gender},
      </if>
      <if test="grade != null">
        #{grade},
      </if>
      <if test="experienceValue != null">
        #{experienceValue},
      </if>
      <if test="registerTime != null">
        #{registerTime},
      </if>
      <if test="lastLoginTime != null">
        #{lastLoginTime},
      </if>
      <if test="lastLoginIp != null">
        #{lastLoginIp},
      </if>
      <if test="loginNumber != null">
        #{loginNumber},
      </if>
      <if test="lastPaymentCode != null">
        #{lastPaymentCode},
      </if>
      <if test="payErrorCount != null">
        #{payErrorCount},
      </if>
      <if test="loginErrorCount != null">
        #{loginErrorCount},
      </if>
      <if test="registerChannel != null">
        #{registerChannel},
      </if>
      <if test="balanceAvailable != null">
        #{balanceAvailable},
      </if>
      <if test="balanceFrozen != null">
        #{balanceFrozen},
      </if>
      <if test="isEmailVerify != null">
        #{isEmailVerify},
      </if>
      <if test="isMobileVerify != null">
        #{isMobileVerify},
      </if>
      <if test="isReceiveSms != null">
        #{isReceiveSms},
      </if>
      <if test="isReceiveEmail != null">
        #{isReceiveEmail},
      </if>
      <if test="state != null">
        #{state},
      </if>
      <if test="isAllowBuy != null">
        #{isAllowBuy},
      </if>
      <if test="isAllowAsk != null">
        #{isAllowAsk},
      </if>
      <if test="isAllowComment != null">
        #{isAllowComment},
      </if>
      <if test="wxUnionid != null">
        #{wxUnionid},
      </if>
      <if test="wxAvatarImg != null">
        #{wxAvatarImg},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `member`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.memberName != null">
        `member_name` = #{record.memberName},
      </if>
      <if test="record.memberNickName != null">
        `member_nick_name` = #{record.memberNickName},
      </if>
      <if test="record.memberTrueName != null">
        `member_true_name` = #{record.memberTrueName},
      </if>
      <if test="record.memberBirthday != null">
        `member_birthday` = #{record.memberBirthday},
      </if>
      <if test="record.memberIntegral != null">
        `member_integral` = #{record.memberIntegral},
      </if>
      <if test="record.integralFrozen != null">
        `integral_frozen` = #{record.integralFrozen},
      </if>
      <if test="record.memberEmail != null">
        `member_email` = #{record.memberEmail},
      </if>
      <if test="record.memberQq != null">
        `member_qq` = #{record.memberQq},
      </if>
      <if test="record.memberMobile != null">
        `member_mobile` = #{record.memberMobile},
      </if>
      <if test="record.memberAvatar != null">
        `member_avatar` = #{record.memberAvatar},
      </if>
      <if test="record.loginPwd != null">
        `login_pwd` = #{record.loginPwd},
      </if>
      <if test="record.payPwd != null">
        `pay_pwd` = #{record.payPwd},
      </if>
      <if test="record.gender != null">
        `gender` = #{record.gender},
      </if>
      <if test="record.grade != null">
        `grade` = #{record.grade},
      </if>
      <if test="record.experienceValue != null">
        `experience_value` = #{record.experienceValue},
      </if>
      <if test="record.registerTime != null">
        `register_time` = #{record.registerTime},
      </if>
      <if test="record.lastLoginTime != null">
        `last_login_time` = #{record.lastLoginTime},
      </if>
      <if test="record.lastLoginIp != null">
        `last_login_ip` = #{record.lastLoginIp},
      </if>
      <if test="record.loginNumber != null">
        `login_number` = #{record.loginNumber},
      </if>
      <if test="record.lastPaymentCode != null">
        `last_payment_code` = #{record.lastPaymentCode},
      </if>
      <if test="record.payErrorCount != null">
        `pay_error_count` = #{record.payErrorCount},
      </if>
      <if test="record.loginErrorCount != null">
        `login_error_count` = #{record.loginErrorCount},
      </if>
      <if test="record.registerChannel != null">
        `register_channel` = #{record.registerChannel},
      </if>
      <if test="record.balanceAvailable != null">
        `balance_available` = #{record.balanceAvailable},
      </if>
      <if test="record.balanceFrozen != null">
        `balance_frozen` = #{record.balanceFrozen},
      </if>
      <if test="record.isEmailVerify != null">
        `is_email_verify` = #{record.isEmailVerify},
      </if>
      <if test="record.isMobileVerify != null">
        `is_mobile_verify` = #{record.isMobileVerify},
      </if>
      <if test="record.isReceiveSms != null">
        `is_receive_sms` = #{record.isReceiveSms},
      </if>
      <if test="record.isReceiveEmail != null">
        `is_receive_email` = #{record.isReceiveEmail},
      </if>
      <if test="record.state != null">
        `state` = #{record.state},
      </if>
      <if test="record.isAllowBuy != null">
        `is_allow_buy` = #{record.isAllowBuy},
      </if>
      <if test="record.isAllowAsk != null">
        `is_allow_ask` = #{record.isAllowAsk},
      </if>
      <if test="record.isAllowComment != null">
        `is_allow_comment` = #{record.isAllowComment},
      </if>
      <if test="record.wxUnionid != null">
        `wx_unionid` = #{record.wxUnionid},
      </if>
      <if test="record.wxAvatarImg != null">
        `wx_avatar_img` = #{record.wxAvatarImg},
      </if>
      <if test="record.updateTime != null">
        `update_time` = #{record.updateTime},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `member`
    <trim prefix="SET" suffixOverrides=",">
      <if test="memberName != null">
        `member_name` = #{memberName},
      </if>
      <if test="memberNickName != null">
        `member_nick_name` = #{memberNickName},
      </if>
      <if test="memberTrueName != null">
        `member_true_name` = #{memberTrueName},
      </if>
      <if test="memberBirthday != null">
        `member_birthday` = #{memberBirthday},
      </if>
      <if test="memberIntegral != null">
        `member_integral` = #{memberIntegral},
      </if>
      <if test="integralFrozen != null">
        `integral_frozen` = #{integralFrozen},
      </if>
      <if test="memberEmail != null">
        `member_email` = #{memberEmail},
      </if>
      <if test="memberQq != null">
        `member_qq` = #{memberQq},
      </if>
      <if test="memberMobile != null">
        `member_mobile` = #{memberMobile},
      </if>
      <if test="memberAvatar != null">
        `member_avatar` = #{memberAvatar},
      </if>
      <if test="loginPwd != null">
        `login_pwd` = #{loginPwd},
      </if>
      <if test="payPwd != null">
        `pay_pwd` = #{payPwd},
      </if>
      <if test="gender != null">
        `gender` = #{gender},
      </if>
      <if test="grade != null">
        `grade` = #{grade},
      </if>
      <if test="experienceValue != null">
        `experience_value` = #{experienceValue},
      </if>
      <if test="registerTime != null">
        `register_time` = #{registerTime},
      </if>
      <if test="lastLoginTime != null">
        `last_login_time` = #{lastLoginTime},
      </if>
      <if test="lastLoginIp != null">
        `last_login_ip` = #{lastLoginIp},
      </if>
      <if test="loginNumber != null">
        `login_number` = #{loginNumber},
      </if>
      <if test="lastPaymentCode != null">
        `last_payment_code` = #{lastPaymentCode},
      </if>
      <if test="payErrorCount != null">
        `pay_error_count` = #{payErrorCount},
      </if>
      <if test="loginErrorCount != null">
        `login_error_count` = #{loginErrorCount},
      </if>
      <if test="registerChannel != null">
        `register_channel` = #{registerChannel},
      </if>
      <if test="balanceAvailable != null">
        `balance_available` = #{balanceAvailable},
      </if>
      <if test="balanceFrozen != null">
        `balance_frozen` = #{balanceFrozen},
      </if>
      <if test="isEmailVerify != null">
        `is_email_verify` = #{isEmailVerify},
      </if>
      <if test="isMobileVerify != null">
        `is_mobile_verify` = #{isMobileVerify},
      </if>
      <if test="isReceiveSms != null">
        `is_receive_sms` = #{isReceiveSms},
      </if>
      <if test="isReceiveEmail != null">
        `is_receive_email` = #{isReceiveEmail},
      </if>
      <if test="state != null">
        `state` = #{state},
      </if>
      <if test="isAllowBuy != null">
        `is_allow_buy` = #{isAllowBuy},
      </if>
      <if test="isAllowAsk != null">
        `is_allow_ask` = #{isAllowAsk},
      </if>
      <if test="isAllowComment != null">
        `is_allow_comment` = #{isAllowComment},
      </if>
      <if test="wxUnionid != null">
        `wx_unionid` = #{wxUnionid},
      </if>
      <if test="wxAvatarImg != null">
        `wx_avatar_img` = #{wxAvatarImg},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
    </trim>
    WHERE `member_id` = #{memberId}
  </update>
</mapper>