<?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.yd.dal.mapper.customer.AclCustomerMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomer">
    <!--@mbg.generated-->
    <!--@Table ag_acl_customer-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="role" jdbcType="INTEGER" property="role" />
    <result column="account_id" jdbcType="VARCHAR" property="accountId" />
    <result column="login" jdbcType="VARCHAR" property="login" />
    <result column="mobile_no" jdbcType="VARCHAR" property="mobileNo" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
    <result column="authen_code" jdbcType="VARCHAR" property="authenCode" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="province_id" jdbcType="BIGINT" property="provinceId" />
    <result column="city_id" jdbcType="BIGINT" property="cityId" />
    <result column="district_id" jdbcType="BIGINT" property="districtId" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="occupation_id" jdbcType="BIGINT" property="occupationId" />
    <result column="cus_level" jdbcType="INTEGER" property="cusLevel" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="nickname_modify" jdbcType="VARCHAR" property="nicknameModify" />
    <result column="en_firstname" jdbcType="VARCHAR" property="enFirstname" />
    <result column="en_lastname" jdbcType="VARCHAR" property="enLastname" />
    <result column="id_type_id" jdbcType="BIGINT" property="idTypeId" />
    <result column="id_no" jdbcType="VARCHAR" property="idNo" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
    <result column="gender" jdbcType="INTEGER" property="gender" />
    <result column="birth_date" jdbcType="DATE" property="birthDate" />
    <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <result column="withdraw_type" jdbcType="INTEGER" property="withdrawType" />
    <result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
    <result column="referral_total_amount" jdbcType="DECIMAL" property="referralTotalAmount" />
    <result column="channel_referral_rate_id" jdbcType="BIGINT" property="channelReferralRateId" />
    <result column="image_path" jdbcType="LONGVARCHAR" property="imagePath" />
    <result column="wechat_openid" jdbcType="VARCHAR" property="wechatOpenid" />
    <result column="yd_wechat_openid" jdbcType="VARCHAR" property="ydWechatOpenid" />
    <result column="nickname" jdbcType="LONGVARCHAR" property="nickname" />
    <result column="dept_id" jdbcType="BIGINT" property="deptId" />
    <result column="role_id" jdbcType="BIGINT" property="roleId" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
    <result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
    <result column="referral_level" jdbcType="INTEGER" property="referralLevel" />
    <result column="practitioner_reg_no" jdbcType="VARCHAR" property="practitionerRegNo" />
    <result column="practitioner_reg_company" jdbcType="VARCHAR" property="practitionerRegCompany" />
    <result column="practitioner_reg_expirydate" jdbcType="DATE" property="practitionerRegExpirydate" />
    <result column="practitioner_reg_status" jdbcType="INTEGER" property="practitionerRegStatus" />
    <result column="practitioner_reg_education_level" jdbcType="INTEGER" property="practitionerRegEducationLevel" />
    <result column="practitioner_reg_name" jdbcType="VARCHAR" property="practitionerRegName" />
    <result column="practitioner_id_type_id" jdbcType="INTEGER" property="practitionerIdTypeId" />
    <result column="practitioner_id_no" jdbcType="VARCHAR" property="practitionerIdNo" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
    <result column="practitioner_birthdate" jdbcType="DATE" property="practitionerBirthdate" />
    <result column="practitioner_gender" jdbcType="INTEGER" property="practitionerGender" />
    <result column="practitioner_portait_url" jdbcType="LONGVARCHAR" property="practitionerPortaitUrl" />
    <result column="source_channel" jdbcType="VARCHAR" property="sourceChannel" />
    <result column="zodiac_type_id" jdbcType="INTEGER" property="zodiacTypeId" />
    <result column="blood_type_id" jdbcType="INTEGER" property="bloodTypeId" />
    <result column="mkt_campaign" jdbcType="VARCHAR" property="mktCampaign" />
    <result column="mkt_task" jdbcType="VARCHAR" property="mktTask" />
    <result column="source_plan_name" jdbcType="VARCHAR" property="sourcePlanName" />
    <result column="source_publishdate" jdbcType="VARCHAR" property="sourcePublishdate" />
    <result column="source_article" jdbcType="VARCHAR" property="sourceArticle" />
    <result column="wechat_no" jdbcType="VARCHAR" property="wechatNo" />
    <result column="other_contacts" jdbcType="VARCHAR" property="otherContacts" />
    <result column="age" jdbcType="BIGINT" property="age" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, `role`, account_id, `login`, mobile_no, authen_code, `password`, email, province_id, 
    city_id, district_id, address, occupation_id, cus_level, `name`, nickname_modify, 
    en_firstname, en_lastname, id_type_id, id_no, gender, birth_date, last_login_time, 
    is_active, withdraw_type, referral_rate, referral_total_amount, channel_referral_rate_id, 
    image_path, wechat_openid, yd_wechat_openid, nickname, dept_id, role_id, created_at, 
    created_by, updated_at, updated_by, referral_level, practitioner_reg_no, practitioner_reg_company, 
    practitioner_reg_expirydate, practitioner_reg_status, practitioner_reg_education_level, 
    practitioner_reg_name, practitioner_id_type_id, practitioner_id_no, practitioner_birthdate, 
    practitioner_gender, practitioner_portait_url, source_channel, zodiac_type_id, blood_type_id, 
    mkt_campaign, mkt_task, source_plan_name, source_publishdate, source_article, wechat_no, 
    other_contacts, age
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ag_acl_customer
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ag_acl_customer
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomer" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer (`role`, account_id, `login`, 
      mobile_no, authen_code, `password`, 
      email, province_id, city_id, 
      district_id, address, occupation_id, 
      cus_level, `name`, nickname_modify, 
      en_firstname, en_lastname, id_type_id, 
      id_no, gender, birth_date, 
      last_login_time, is_active, withdraw_type, 
      referral_rate, referral_total_amount, channel_referral_rate_id, 
      image_path, wechat_openid, yd_wechat_openid, 
      nickname, dept_id, role_id, 
      created_at, created_by, updated_at, 
      updated_by, referral_level, practitioner_reg_no, 
      practitioner_reg_company, practitioner_reg_expirydate, 
      practitioner_reg_status, practitioner_reg_education_level, 
      practitioner_reg_name, practitioner_id_type_id, 
      practitioner_id_no, practitioner_birthdate, practitioner_gender, 
      practitioner_portait_url, source_channel, 
      zodiac_type_id, blood_type_id, mkt_campaign, 
      mkt_task, source_plan_name, source_publishdate, 
      source_article, wechat_no, other_contacts, 
      age)
    values (#{role,jdbcType=INTEGER}, #{accountId,jdbcType=VARCHAR}, #{login,jdbcType=VARCHAR}, 
      #{mobileNo,jdbcType=VARCHAR}, #{authenCode,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
      #{email,jdbcType=VARCHAR}, #{provinceId,jdbcType=BIGINT}, #{cityId,jdbcType=BIGINT}, 
      #{districtId,jdbcType=BIGINT}, #{address,jdbcType=VARCHAR}, #{occupationId,jdbcType=BIGINT}, 
      #{cusLevel,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{nicknameModify,jdbcType=VARCHAR}, 
      #{enFirstname,jdbcType=VARCHAR}, #{enLastname,jdbcType=VARCHAR}, #{idTypeId,jdbcType=BIGINT}, 
      #{idNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}, #{gender,jdbcType=INTEGER}, #{birthDate,jdbcType=DATE},
      #{lastLoginTime,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{withdrawType,jdbcType=INTEGER}, 
      #{referralRate,jdbcType=DECIMAL}, #{referralTotalAmount,jdbcType=DECIMAL}, #{channelReferralRateId,jdbcType=BIGINT}, 
      #{imagePath,jdbcType=LONGVARCHAR}, #{wechatOpenid,jdbcType=VARCHAR}, #{ydWechatOpenid,jdbcType=VARCHAR}, 
      #{nickname,jdbcType=LONGVARCHAR}, #{deptId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, 
      #{updatedBy,jdbcType=BIGINT}, #{referralLevel,jdbcType=INTEGER}, #{practitionerRegNo,jdbcType=VARCHAR}, 
      #{practitionerRegCompany,jdbcType=VARCHAR}, #{practitionerRegExpirydate,jdbcType=DATE}, 
      #{practitionerRegStatus,jdbcType=INTEGER}, #{practitionerRegEducationLevel,jdbcType=INTEGER}, 
      #{practitionerRegName,jdbcType=VARCHAR}, #{practitionerIdTypeId,jdbcType=INTEGER}, 
      #{practitionerIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}, #{practitionerBirthdate,jdbcType=DATE}, #{practitionerGender,jdbcType=INTEGER},
      #{practitionerPortaitUrl,jdbcType=LONGVARCHAR}, #{sourceChannel,jdbcType=VARCHAR}, 
      #{zodiacTypeId,jdbcType=INTEGER}, #{bloodTypeId,jdbcType=INTEGER}, #{mktCampaign,jdbcType=VARCHAR}, 
      #{mktTask,jdbcType=VARCHAR}, #{sourcePlanName,jdbcType=VARCHAR}, #{sourcePublishdate,jdbcType=VARCHAR}, 
      #{sourceArticle,jdbcType=VARCHAR}, #{wechatNo,jdbcType=VARCHAR}, #{otherContacts,jdbcType=VARCHAR}, 
      #{age,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomer" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="role != null">
        `role`,
      </if>
      <if test="accountId != null">
        account_id,
      </if>
      <if test="login != null">
        `login`,
      </if>
      <if test="mobileNo != null">
        mobile_no,
      </if>
      <if test="authenCode != null">
        authen_code,
      </if>
      <if test="password != null">
        `password`,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="provinceId != null">
        province_id,
      </if>
      <if test="cityId != null">
        city_id,
      </if>
      <if test="districtId != null">
        district_id,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="occupationId != null">
        occupation_id,
      </if>
      <if test="cusLevel != null">
        cus_level,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="nicknameModify != null">
        nickname_modify,
      </if>
      <if test="enFirstname != null">
        en_firstname,
      </if>
      <if test="enLastname != null">
        en_lastname,
      </if>
      <if test="idTypeId != null">
        id_type_id,
      </if>
      <if test="idNo != null">
        id_no,
      </if>
      <if test="gender != null">
        gender,
      </if>
      <if test="birthDate != null">
        birth_date,
      </if>
      <if test="lastLoginTime != null">
        last_login_time,
      </if>
      <if test="isActive != null">
        is_active,
      </if>
      <if test="withdrawType != null">
        withdraw_type,
      </if>
      <if test="referralRate != null">
        referral_rate,
      </if>
      <if test="referralTotalAmount != null">
        referral_total_amount,
      </if>
      <if test="channelReferralRateId != null">
        channel_referral_rate_id,
      </if>
      <if test="imagePath != null">
        image_path,
      </if>
      <if test="wechatOpenid != null">
        wechat_openid,
      </if>
      <if test="ydWechatOpenid != null">
        yd_wechat_openid,
      </if>
      <if test="nickname != null">
        nickname,
      </if>
      <if test="deptId != null">
        dept_id,
      </if>
      <if test="roleId != null">
        role_id,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="referralLevel != null">
        referral_level,
      </if>
      <if test="practitionerRegNo != null">
        practitioner_reg_no,
      </if>
      <if test="practitionerRegCompany != null">
        practitioner_reg_company,
      </if>
      <if test="practitionerRegExpirydate != null">
        practitioner_reg_expirydate,
      </if>
      <if test="practitionerRegStatus != null">
        practitioner_reg_status,
      </if>
      <if test="practitionerRegEducationLevel != null">
        practitioner_reg_education_level,
      </if>
      <if test="practitionerRegName != null">
        practitioner_reg_name,
      </if>
      <if test="practitionerIdTypeId != null">
        practitioner_id_type_id,
      </if>
      <if test="practitionerIdNo != null">
        practitioner_id_no,
      </if>
      <if test="practitionerBirthdate != null">
        practitioner_birthdate,
      </if>
      <if test="practitionerGender != null">
        practitioner_gender,
      </if>
      <if test="practitionerPortaitUrl != null">
        practitioner_portait_url,
      </if>
      <if test="sourceChannel != null">
        source_channel,
      </if>
      <if test="zodiacTypeId != null">
        zodiac_type_id,
      </if>
      <if test="bloodTypeId != null">
        blood_type_id,
      </if>
      <if test="mktCampaign != null">
        mkt_campaign,
      </if>
      <if test="mktTask != null">
        mkt_task,
      </if>
      <if test="sourcePlanName != null">
        source_plan_name,
      </if>
      <if test="sourcePublishdate != null">
        source_publishdate,
      </if>
      <if test="sourceArticle != null">
        source_article,
      </if>
      <if test="wechatNo != null">
        wechat_no,
      </if>
      <if test="otherContacts != null">
        other_contacts,
      </if>
      <if test="age != null">
        age,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="role != null">
        #{role,jdbcType=INTEGER},
      </if>
      <if test="accountId != null">
        #{accountId,jdbcType=VARCHAR},
      </if>
      <if test="login != null">
        #{login,jdbcType=VARCHAR},
      </if>
      <if test="mobileNo != null">
        #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="authenCode != null">
        #{authenCode,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="provinceId != null">
        #{provinceId,jdbcType=BIGINT},
      </if>
      <if test="cityId != null">
        #{cityId,jdbcType=BIGINT},
      </if>
      <if test="districtId != null">
        #{districtId,jdbcType=BIGINT},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="occupationId != null">
        #{occupationId,jdbcType=BIGINT},
      </if>
      <if test="cusLevel != null">
        #{cusLevel,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="nicknameModify != null">
        #{nicknameModify,jdbcType=VARCHAR},
      </if>
      <if test="enFirstname != null">
        #{enFirstname,jdbcType=VARCHAR},
      </if>
      <if test="enLastname != null">
        #{enLastname,jdbcType=VARCHAR},
      </if>
      <if test="idTypeId != null">
        #{idTypeId,jdbcType=BIGINT},
      </if>
      <if test="idNo != null">
        #{idNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="gender != null">
        #{gender,jdbcType=INTEGER},
      </if>
      <if test="birthDate != null">
        #{birthDate,jdbcType=DATE},
      </if>
      <if test="lastLoginTime != null">
        #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </if>
      <if test="withdrawType != null">
        #{withdrawType,jdbcType=INTEGER},
      </if>
      <if test="referralRate != null">
        #{referralRate,jdbcType=DECIMAL},
      </if>
      <if test="referralTotalAmount != null">
        #{referralTotalAmount,jdbcType=DECIMAL},
      </if>
      <if test="channelReferralRateId != null">
        #{channelReferralRateId,jdbcType=BIGINT},
      </if>
      <if test="imagePath != null">
        #{imagePath,jdbcType=LONGVARCHAR},
      </if>
      <if test="wechatOpenid != null">
        #{wechatOpenid,jdbcType=VARCHAR},
      </if>
      <if test="ydWechatOpenid != null">
        #{ydWechatOpenid,jdbcType=VARCHAR},
      </if>
      <if test="nickname != null">
        #{nickname,jdbcType=LONGVARCHAR},
      </if>
      <if test="deptId != null">
        #{deptId,jdbcType=BIGINT},
      </if>
      <if test="roleId != null">
        #{roleId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=BIGINT},
      </if>
      <if test="referralLevel != null">
        #{referralLevel,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegNo != null">
        #{practitionerRegNo,jdbcType=VARCHAR},
      </if>
      <if test="practitionerRegCompany != null">
        #{practitionerRegCompany,jdbcType=VARCHAR},
      </if>
      <if test="practitionerRegExpirydate != null">
        #{practitionerRegExpirydate,jdbcType=DATE},
      </if>
      <if test="practitionerRegStatus != null">
        #{practitionerRegStatus,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegEducationLevel != null">
        #{practitionerRegEducationLevel,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegName != null">
        #{practitionerRegName,jdbcType=VARCHAR},
      </if>
      <if test="practitionerIdTypeId != null">
        #{practitionerIdTypeId,jdbcType=INTEGER},
      </if>
      <if test="practitionerIdNo != null">
        #{practitionerIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="practitionerBirthdate != null">
        #{practitionerBirthdate,jdbcType=DATE},
      </if>
      <if test="practitionerGender != null">
        #{practitionerGender,jdbcType=INTEGER},
      </if>
      <if test="practitionerPortaitUrl != null">
        #{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
      </if>
      <if test="sourceChannel != null">
        #{sourceChannel,jdbcType=VARCHAR},
      </if>
      <if test="zodiacTypeId != null">
        #{zodiacTypeId,jdbcType=INTEGER},
      </if>
      <if test="bloodTypeId != null">
        #{bloodTypeId,jdbcType=INTEGER},
      </if>
      <if test="mktCampaign != null">
        #{mktCampaign,jdbcType=VARCHAR},
      </if>
      <if test="mktTask != null">
        #{mktTask,jdbcType=VARCHAR},
      </if>
      <if test="sourcePlanName != null">
        #{sourcePlanName,jdbcType=VARCHAR},
      </if>
      <if test="sourcePublishdate != null">
        #{sourcePublishdate,jdbcType=VARCHAR},
      </if>
      <if test="sourceArticle != null">
        #{sourceArticle,jdbcType=VARCHAR},
      </if>
      <if test="wechatNo != null">
        #{wechatNo,jdbcType=VARCHAR},
      </if>
      <if test="otherContacts != null">
        #{otherContacts,jdbcType=VARCHAR},
      </if>
      <if test="age != null">
        #{age,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomer">
    <!--@mbg.generated-->
    update ag_acl_customer
    <set>
      <if test="role != null">
        `role` = #{role,jdbcType=INTEGER},
      </if>
      <if test="accountId != null">
        account_id = #{accountId,jdbcType=VARCHAR},
      </if>
      <if test="login != null">
        `login` = #{login,jdbcType=VARCHAR},
      </if>
      <if test="mobileNo != null">
        mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="authenCode != null">
        authen_code = #{authenCode,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        `password` = #{password,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="provinceId != null">
        province_id = #{provinceId,jdbcType=BIGINT},
      </if>
      <if test="cityId != null">
        city_id = #{cityId,jdbcType=BIGINT},
      </if>
      <if test="districtId != null">
        district_id = #{districtId,jdbcType=BIGINT},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="occupationId != null">
        occupation_id = #{occupationId,jdbcType=BIGINT},
      </if>
      <if test="cusLevel != null">
        cus_level = #{cusLevel,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="nicknameModify != null">
        nickname_modify = #{nicknameModify,jdbcType=VARCHAR},
      </if>
      <if test="enFirstname != null">
        en_firstname = #{enFirstname,jdbcType=VARCHAR},
      </if>
      <if test="enLastname != null">
        en_lastname = #{enLastname,jdbcType=VARCHAR},
      </if>
      <if test="idTypeId != null">
        id_type_id = #{idTypeId,jdbcType=BIGINT},
      </if>
      <if test="idNo != null">
        id_no = #{idNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="gender != null">
        gender = #{gender,jdbcType=INTEGER},
      </if>
      <if test="birthDate != null">
        birth_date = #{birthDate,jdbcType=DATE},
      </if>
      <if test="lastLoginTime != null">
        last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </if>
      <if test="withdrawType != null">
        withdraw_type = #{withdrawType,jdbcType=INTEGER},
      </if>
      <if test="referralRate != null">
        referral_rate = #{referralRate,jdbcType=DECIMAL},
      </if>
      <if test="referralTotalAmount != null">
        referral_total_amount = #{referralTotalAmount,jdbcType=DECIMAL},
      </if>
      <if test="channelReferralRateId != null">
        channel_referral_rate_id = #{channelReferralRateId,jdbcType=BIGINT},
      </if>
      <if test="imagePath != null">
        image_path = #{imagePath,jdbcType=LONGVARCHAR},
      </if>
      <if test="wechatOpenid != null">
        wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
      </if>
      <if test="ydWechatOpenid != null">
        yd_wechat_openid = #{ydWechatOpenid,jdbcType=VARCHAR},
      </if>
      <if test="nickname != null">
        nickname = #{nickname,jdbcType=LONGVARCHAR},
      </if>
      <if test="deptId != null">
        dept_id = #{deptId,jdbcType=BIGINT},
      </if>
      <if test="roleId != null">
        role_id = #{roleId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=BIGINT},
      </if>
      <if test="referralLevel != null">
        referral_level = #{referralLevel,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegNo != null">
        practitioner_reg_no = #{practitionerRegNo,jdbcType=VARCHAR},
      </if>
      <if test="practitionerRegCompany != null">
        practitioner_reg_company = #{practitionerRegCompany,jdbcType=VARCHAR},
      </if>
      <if test="practitionerRegExpirydate != null">
        practitioner_reg_expirydate = #{practitionerRegExpirydate,jdbcType=DATE},
      </if>
      <if test="practitionerRegStatus != null">
        practitioner_reg_status = #{practitionerRegStatus,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegEducationLevel != null">
        practitioner_reg_education_level = #{practitionerRegEducationLevel,jdbcType=INTEGER},
      </if>
      <if test="practitionerRegName != null">
        practitioner_reg_name = #{practitionerRegName,jdbcType=VARCHAR},
      </if>
      <if test="practitionerIdTypeId != null">
        practitioner_id_type_id = #{practitionerIdTypeId,jdbcType=INTEGER},
      </if>
      <if test="practitionerIdNo != null">
        practitioner_id_no = #{practitionerIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      </if>
      <if test="practitionerBirthdate != null">
        practitioner_birthdate = #{practitionerBirthdate,jdbcType=DATE},
      </if>
      <if test="practitionerGender != null">
        practitioner_gender = #{practitionerGender,jdbcType=INTEGER},
      </if>
      <if test="practitionerPortaitUrl != null">
        practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
      </if>
      <if test="sourceChannel != null">
        source_channel = #{sourceChannel,jdbcType=VARCHAR},
      </if>
      <if test="zodiacTypeId != null">
        zodiac_type_id = #{zodiacTypeId,jdbcType=INTEGER},
      </if>
      <if test="bloodTypeId != null">
        blood_type_id = #{bloodTypeId,jdbcType=INTEGER},
      </if>
      <if test="mktCampaign != null">
        mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
      </if>
      <if test="mktTask != null">
        mkt_task = #{mktTask,jdbcType=VARCHAR},
      </if>
      <if test="sourcePlanName != null">
        source_plan_name = #{sourcePlanName,jdbcType=VARCHAR},
      </if>
      <if test="sourcePublishdate != null">
        source_publishdate = #{sourcePublishdate,jdbcType=VARCHAR},
      </if>
      <if test="sourceArticle != null">
        source_article = #{sourceArticle,jdbcType=VARCHAR},
      </if>
      <if test="wechatNo != null">
        wechat_no = #{wechatNo,jdbcType=VARCHAR},
      </if>
      <if test="otherContacts != null">
        other_contacts = #{otherContacts,jdbcType=VARCHAR},
      </if>
      <if test="age != null">
        age = #{age,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomer">
    <!--@mbg.generated-->
    update ag_acl_customer
    set `role` = #{role,jdbcType=INTEGER},
      account_id = #{accountId,jdbcType=VARCHAR},
      `login` = #{login,jdbcType=VARCHAR},
      mobile_no = #{mobileNo,jdbcType=VARCHAR},
      authen_code = #{authenCode,jdbcType=VARCHAR},
      `password` = #{password,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      province_id = #{provinceId,jdbcType=BIGINT},
      city_id = #{cityId,jdbcType=BIGINT},
      district_id = #{districtId,jdbcType=BIGINT},
      address = #{address,jdbcType=VARCHAR},
      occupation_id = #{occupationId,jdbcType=BIGINT},
      cus_level = #{cusLevel,jdbcType=INTEGER},
      `name` = #{name,jdbcType=VARCHAR},
      nickname_modify = #{nicknameModify,jdbcType=VARCHAR},
      en_firstname = #{enFirstname,jdbcType=VARCHAR},
      en_lastname = #{enLastname,jdbcType=VARCHAR},
      id_type_id = #{idTypeId,jdbcType=BIGINT},
      id_no = #{idNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      gender = #{gender,jdbcType=INTEGER},
      birth_date = #{birthDate,jdbcType=DATE},
      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      is_active = #{isActive,jdbcType=INTEGER},
      withdraw_type = #{withdrawType,jdbcType=INTEGER},
      referral_rate = #{referralRate,jdbcType=DECIMAL},
      referral_total_amount = #{referralTotalAmount,jdbcType=DECIMAL},
      channel_referral_rate_id = #{channelReferralRateId,jdbcType=BIGINT},
      image_path = #{imagePath,jdbcType=LONGVARCHAR},
      wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
      yd_wechat_openid = #{ydWechatOpenid,jdbcType=VARCHAR},
      nickname = #{nickname,jdbcType=LONGVARCHAR},
      dept_id = #{deptId,jdbcType=BIGINT},
      role_id = #{roleId,jdbcType=BIGINT},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      updated_by = #{updatedBy,jdbcType=BIGINT},
      referral_level = #{referralLevel,jdbcType=INTEGER},
      practitioner_reg_no = #{practitionerRegNo,jdbcType=VARCHAR},
      practitioner_reg_company = #{practitionerRegCompany,jdbcType=VARCHAR},
      practitioner_reg_expirydate = #{practitionerRegExpirydate,jdbcType=DATE},
      practitioner_reg_status = #{practitionerRegStatus,jdbcType=INTEGER},
      practitioner_reg_education_level = #{practitionerRegEducationLevel,jdbcType=INTEGER},
      practitioner_reg_name = #{practitionerRegName,jdbcType=VARCHAR},
      practitioner_id_type_id = #{practitionerIdTypeId,jdbcType=INTEGER},
      practitioner_id_no = #{practitionerIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
      practitioner_birthdate = #{practitionerBirthdate,jdbcType=DATE},
      practitioner_gender = #{practitionerGender,jdbcType=INTEGER},
      practitioner_portait_url = #{practitionerPortaitUrl,jdbcType=LONGVARCHAR},
      source_channel = #{sourceChannel,jdbcType=VARCHAR},
      zodiac_type_id = #{zodiacTypeId,jdbcType=INTEGER},
      blood_type_id = #{bloodTypeId,jdbcType=INTEGER},
      mkt_campaign = #{mktCampaign,jdbcType=VARCHAR},
      mkt_task = #{mktTask,jdbcType=VARCHAR},
      source_plan_name = #{sourcePlanName,jdbcType=VARCHAR},
      source_publishdate = #{sourcePublishdate,jdbcType=VARCHAR},
      source_article = #{sourceArticle,jdbcType=VARCHAR},
      wechat_no = #{wechatNo,jdbcType=VARCHAR},
      other_contacts = #{otherContacts,jdbcType=VARCHAR},
      age = #{age,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="findByLogin" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer
    where login = #{mobileNo,jdbcType=VARCHAR}
  </select>
  <select id="findByMobileNo" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer
    where mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
        and is_active=1 order by id desc limit 0,1
  </select>
  <select id="findByWeChatNo" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer
    where wechat_no = #{wechatNo,jdbcType=VARCHAR}
        and is_active=1 order by id desc limit 0,1
  </select>

  <select id="findByIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer
    where id in
    <foreach collection="customerIds" index="index" item="item" open="(" separator="," close=")">
      #{item}
    </foreach>
  </select>

  <select id="findByObj" parameterType="com.yd.dal.entity.customer.AclCustomer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from  ag_acl_customer
    where 1=1
    <if test="mobileNo != null">
      and mobile_no = #{mobileNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler}
    </if>
    <if test="email != null">
      and email = #{email,jdbcType=VARCHAR}
    </if>
    <if test="id != null">
      and id = #{id,jdbcType=BIGINT}
    </if>

    <if test="role != null">
      and `role` = #{role,jdbcType=INTEGER}
    </if>
    <if test="isActive != null">
      and is_active = #{isActive,jdbcType=INTEGER}
    </if>
  </select>
</mapper>