<?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.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffUserMapper">
  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="third_staff_id" jdbcType="BIGINT" property="thirdStaffId" />
    <result column="add_customer_time" jdbcType="BIGINT" property="addCustomerTime" />
    <result column="remove_customer_time" jdbcType="BIGINT" property="removeCustomerTime" />
    <result column="unionid" jdbcType="VARCHAR" property="unionid" />
    <result column="sex" jdbcType="INTEGER" property="sex" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="company_remark" jdbcType="VARCHAR" property="companyRemark" />
    <result column="acctid" jdbcType="VARCHAR" property="acctid" />
    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
    <result column="source" jdbcType="INTEGER" property="source" />
    <result column="english_name" jdbcType="VARCHAR" property="englishName" />
    <result column="remark_phone" jdbcType="VARCHAR" property="remarkPhone" />
    <result column="realname" jdbcType="VARCHAR" property="realname" />
    <result column="real_remarks" jdbcType="VARCHAR" property="realRemarks" />
    <result column="labelid" jdbcType="VARCHAR" property="labelid" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="nickname" jdbcType="VARCHAR" property="nickname" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <result column="corp_id" jdbcType="BIGINT" property="corpId" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="seq" jdbcType="INTEGER" property="seq" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, third_staff_id, add_customer_time, remove_customer_time, unionid, sex, mobile, 
    company_remark, acctid, avatar, `source`, english_name, remark_phone, realname, real_remarks, 
    labelid, user_id, nickname, `position`, corp_id, remarks, seq, `status`, create_time, 
    update_time
  </sql>
  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUserExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from third_part_we_com_staff_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="page != null">
      limit #{page.offset} , #{page.pageSize}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from third_part_we_com_staff_user
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from third_part_we_com_staff_user
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUserExample">
    delete from third_part_we_com_staff_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
    insert into third_part_we_com_staff_user (id, third_staff_id, add_customer_time, 
      remove_customer_time, unionid, sex, 
      mobile, company_remark, acctid, 
      avatar, `source`, english_name, 
      remark_phone, realname, real_remarks, 
      labelid, user_id, nickname, 
      `position`, corp_id, remarks, 
      seq, `status`, create_time, 
      update_time)
    values (#{id,jdbcType=BIGINT}, #{thirdStaffId,jdbcType=BIGINT}, #{addCustomerTime,jdbcType=BIGINT}, 
      #{removeCustomerTime,jdbcType=BIGINT}, #{unionid,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, 
      #{mobile,jdbcType=VARCHAR}, #{companyRemark,jdbcType=VARCHAR}, #{acctid,jdbcType=VARCHAR}, 
      #{avatar,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{englishName,jdbcType=VARCHAR}, 
      #{remarkPhone,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR}, #{realRemarks,jdbcType=VARCHAR}, 
      #{labelid,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, #{nickname,jdbcType=VARCHAR}, 
      #{position,jdbcType=VARCHAR}, #{corpId,jdbcType=BIGINT}, #{remarks,jdbcType=VARCHAR}, 
      #{seq,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
    insert into third_part_we_com_staff_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="thirdStaffId != null">
        third_staff_id,
      </if>
      <if test="addCustomerTime != null">
        add_customer_time,
      </if>
      <if test="removeCustomerTime != null">
        remove_customer_time,
      </if>
      <if test="unionid != null">
        unionid,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="companyRemark != null">
        company_remark,
      </if>
      <if test="acctid != null">
        acctid,
      </if>
      <if test="avatar != null">
        avatar,
      </if>
      <if test="source != null">
        `source`,
      </if>
      <if test="englishName != null">
        english_name,
      </if>
      <if test="remarkPhone != null">
        remark_phone,
      </if>
      <if test="realname != null">
        realname,
      </if>
      <if test="realRemarks != null">
        real_remarks,
      </if>
      <if test="labelid != null">
        labelid,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="nickname != null">
        nickname,
      </if>
      <if test="position != null">
        `position`,
      </if>
      <if test="corpId != null">
        corp_id,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="seq != null">
        seq,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="thirdStaffId != null">
        #{thirdStaffId,jdbcType=BIGINT},
      </if>
      <if test="addCustomerTime != null">
        #{addCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="removeCustomerTime != null">
        #{removeCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="unionid != null">
        #{unionid,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="companyRemark != null">
        #{companyRemark,jdbcType=VARCHAR},
      </if>
      <if test="acctid != null">
        #{acctid,jdbcType=VARCHAR},
      </if>
      <if test="avatar != null">
        #{avatar,jdbcType=VARCHAR},
      </if>
      <if test="source != null">
        #{source,jdbcType=INTEGER},
      </if>
      <if test="englishName != null">
        #{englishName,jdbcType=VARCHAR},
      </if>
      <if test="remarkPhone != null">
        #{remarkPhone,jdbcType=VARCHAR},
      </if>
      <if test="realname != null">
        #{realname,jdbcType=VARCHAR},
      </if>
      <if test="realRemarks != null">
        #{realRemarks,jdbcType=VARCHAR},
      </if>
      <if test="labelid != null">
        #{labelid,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="nickname != null">
        #{nickname,jdbcType=VARCHAR},
      </if>
      <if test="position != null">
        #{position,jdbcType=VARCHAR},
      </if>
      <if test="corpId != null">
        #{corpId,jdbcType=BIGINT},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="seq != null">
        #{seq,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUserExample" resultType="java.lang.Long">
    select count(*) from third_part_we_com_staff_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update third_part_we_com_staff_user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.thirdStaffId != null">
        third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
      </if>
      <if test="record.addCustomerTime != null">
        add_customer_time = #{record.addCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="record.removeCustomerTime != null">
        remove_customer_time = #{record.removeCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="record.unionid != null">
        unionid = #{record.unionid,jdbcType=VARCHAR},
      </if>
      <if test="record.sex != null">
        sex = #{record.sex,jdbcType=INTEGER},
      </if>
      <if test="record.mobile != null">
        mobile = #{record.mobile,jdbcType=VARCHAR},
      </if>
      <if test="record.companyRemark != null">
        company_remark = #{record.companyRemark,jdbcType=VARCHAR},
      </if>
      <if test="record.acctid != null">
        acctid = #{record.acctid,jdbcType=VARCHAR},
      </if>
      <if test="record.avatar != null">
        avatar = #{record.avatar,jdbcType=VARCHAR},
      </if>
      <if test="record.source != null">
        `source` = #{record.source,jdbcType=INTEGER},
      </if>
      <if test="record.englishName != null">
        english_name = #{record.englishName,jdbcType=VARCHAR},
      </if>
      <if test="record.remarkPhone != null">
        remark_phone = #{record.remarkPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.realname != null">
        realname = #{record.realname,jdbcType=VARCHAR},
      </if>
      <if test="record.realRemarks != null">
        real_remarks = #{record.realRemarks,jdbcType=VARCHAR},
      </if>
      <if test="record.labelid != null">
        labelid = #{record.labelid,jdbcType=VARCHAR},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.nickname != null">
        nickname = #{record.nickname,jdbcType=VARCHAR},
      </if>
      <if test="record.position != null">
        `position` = #{record.position,jdbcType=VARCHAR},
      </if>
      <if test="record.corpId != null">
        corp_id = #{record.corpId,jdbcType=BIGINT},
      </if>
      <if test="record.remarks != null">
        remarks = #{record.remarks,jdbcType=VARCHAR},
      </if>
      <if test="record.seq != null">
        seq = #{record.seq,jdbcType=INTEGER},
      </if>
      <if test="record.status != null">
        `status` = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update third_part_we_com_staff_user
    set id = #{record.id,jdbcType=BIGINT},
      third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
      add_customer_time = #{record.addCustomerTime,jdbcType=BIGINT},
      remove_customer_time = #{record.removeCustomerTime,jdbcType=BIGINT},
      unionid = #{record.unionid,jdbcType=VARCHAR},
      sex = #{record.sex,jdbcType=INTEGER},
      mobile = #{record.mobile,jdbcType=VARCHAR},
      company_remark = #{record.companyRemark,jdbcType=VARCHAR},
      acctid = #{record.acctid,jdbcType=VARCHAR},
      avatar = #{record.avatar,jdbcType=VARCHAR},
      `source` = #{record.source,jdbcType=INTEGER},
      english_name = #{record.englishName,jdbcType=VARCHAR},
      remark_phone = #{record.remarkPhone,jdbcType=VARCHAR},
      realname = #{record.realname,jdbcType=VARCHAR},
      real_remarks = #{record.realRemarks,jdbcType=VARCHAR},
      labelid = #{record.labelid,jdbcType=VARCHAR},
      user_id = #{record.userId,jdbcType=BIGINT},
      nickname = #{record.nickname,jdbcType=VARCHAR},
      `position` = #{record.position,jdbcType=VARCHAR},
      corp_id = #{record.corpId,jdbcType=BIGINT},
      remarks = #{record.remarks,jdbcType=VARCHAR},
      seq = #{record.seq,jdbcType=INTEGER},
      `status` = #{record.status,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
    update third_part_we_com_staff_user
    <set>
      <if test="thirdStaffId != null">
        third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
      </if>
      <if test="addCustomerTime != null">
        add_customer_time = #{addCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="removeCustomerTime != null">
        remove_customer_time = #{removeCustomerTime,jdbcType=BIGINT},
      </if>
      <if test="unionid != null">
        unionid = #{unionid,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="mobile != null">
        mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="companyRemark != null">
        company_remark = #{companyRemark,jdbcType=VARCHAR},
      </if>
      <if test="acctid != null">
        acctid = #{acctid,jdbcType=VARCHAR},
      </if>
      <if test="avatar != null">
        avatar = #{avatar,jdbcType=VARCHAR},
      </if>
      <if test="source != null">
        `source` = #{source,jdbcType=INTEGER},
      </if>
      <if test="englishName != null">
        english_name = #{englishName,jdbcType=VARCHAR},
      </if>
      <if test="remarkPhone != null">
        remark_phone = #{remarkPhone,jdbcType=VARCHAR},
      </if>
      <if test="realname != null">
        realname = #{realname,jdbcType=VARCHAR},
      </if>
      <if test="realRemarks != null">
        real_remarks = #{realRemarks,jdbcType=VARCHAR},
      </if>
      <if test="labelid != null">
        labelid = #{labelid,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="nickname != null">
        nickname = #{nickname,jdbcType=VARCHAR},
      </if>
      <if test="position != null">
        `position` = #{position,jdbcType=VARCHAR},
      </if>
      <if test="corpId != null">
        corp_id = #{corpId,jdbcType=BIGINT},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="seq != null">
        seq = #{seq,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
    update third_part_we_com_staff_user
    set third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
      add_customer_time = #{addCustomerTime,jdbcType=BIGINT},
      remove_customer_time = #{removeCustomerTime,jdbcType=BIGINT},
      unionid = #{unionid,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      mobile = #{mobile,jdbcType=VARCHAR},
      company_remark = #{companyRemark,jdbcType=VARCHAR},
      acctid = #{acctid,jdbcType=VARCHAR},
      avatar = #{avatar,jdbcType=VARCHAR},
      `source` = #{source,jdbcType=INTEGER},
      english_name = #{englishName,jdbcType=VARCHAR},
      remark_phone = #{remarkPhone,jdbcType=VARCHAR},
      realname = #{realname,jdbcType=VARCHAR},
      real_remarks = #{realRemarks,jdbcType=VARCHAR},
      labelid = #{labelid,jdbcType=VARCHAR},
      user_id = #{userId,jdbcType=BIGINT},
      nickname = #{nickname,jdbcType=VARCHAR},
      `position` = #{position,jdbcType=VARCHAR},
      corp_id = #{corpId,jdbcType=BIGINT},
      remarks = #{remarks,jdbcType=VARCHAR},
      seq = #{seq,jdbcType=INTEGER},
      `status` = #{status,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>