<?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.cool.store.mapper.DingdingUserMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.DingdingUserDO">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="userid" jdbcType="VARCHAR" property="userid" />
    <result column="unionid" jdbcType="VARCHAR" property="unionid" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="is_boss" jdbcType="TINYINT" property="isBoss" />
    <result column="hired_date" jdbcType="VARCHAR" property="hiredDate" />
    <result column="is_senior" jdbcType="TINYINT" property="isSenior" />
    <result column="tel" jdbcType="VARCHAR" property="tel" />
    <result column="work_place" jdbcType="VARCHAR" property="workPlace" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="active" jdbcType="TINYINT" property="active" />
    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
    <result column="is_admin" jdbcType="TINYINT" property="isAdmin" />
    <result column="is_hide" jdbcType="TINYINT" property="isHide" />
    <result column="job_number" jdbcType="VARCHAR" property="jobNumber" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="state_code" jdbcType="VARCHAR" property="stateCode" />
    <result column="real_authed" jdbcType="TINYINT" property="realAuthed" />
    <result column="db_update_timestamp" jdbcType="TIMESTAMP" property="dbUpdateTimestamp" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="check_status" jdbcType="TINYINT" property="checkStatus" />
    <result column="job_status" jdbcType="TINYINT" property="jobStatus" />
    <result column="config_code_id" jdbcType="INTEGER" property="configCodeId" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.DingdingUserDO">
    <result column="is_leader_in_depts" jdbcType="LONGVARCHAR" property="isLeaderInDepts" />
    <result column="department" jdbcType="LONGVARCHAR" property="department" />
    <result column="extattr" jdbcType="LONGVARCHAR" property="extattr" />
    <result column="roles" jdbcType="LONGVARCHAR" property="roles" />
  </resultMap>
  <sql id="Base_Column_List">
    id, userid, unionid, remark, is_boss, hired_date, is_senior, tel, work_place, email, 
    active, avatar, is_admin, is_hide, job_number, name, state_code, real_authed, db_update_timestamp, 
    position, mobile, check_status, job_status, config_code_id
  </sql>
  <sql id="Blob_Column_List">
    is_leader_in_depts, department, extattr, roles
  </sql>
  <insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
    insert into dingding_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userid != null">
        userid,
      </if>
      <if test="unionid != null">
        unionid,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="isBoss != null">
        is_boss,
      </if>
      <if test="hiredDate != null">
        hired_date,
      </if>
      <if test="isSenior != null">
        is_senior,
      </if>
      <if test="tel != null">
        tel,
      </if>
      <if test="workPlace != null">
        work_place,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="active != null">
        active,
      </if>
      <if test="avatar != null">
        avatar,
      </if>
      <if test="isAdmin != null">
        is_admin,
      </if>
      <if test="isHide != null">
        is_hide,
      </if>
      <if test="jobNumber != null">
        job_number,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="stateCode != null">
        state_code,
      </if>
      <if test="realAuthed != null">
        real_authed,
      </if>
      <if test="dbUpdateTimestamp != null">
        db_update_timestamp,
      </if>
      <if test="position != null">
        position,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="checkStatus != null">
        check_status,
      </if>
      <if test="jobStatus != null">
        job_status,
      </if>
      <if test="configCodeId != null">
        config_code_id,
      </if>
      <if test="isLeaderInDepts != null">
        is_leader_in_depts,
      </if>
      <if test="department != null">
        department,
      </if>
      <if test="extattr != null">
        extattr,
      </if>
      <if test="roles != null">
        roles,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userid != null">
        #{userid},
      </if>
      <if test="unionid != null">
        #{unionid},
      </if>
      <if test="remark != null">
        #{remark},
      </if>
      <if test="isBoss != null">
        #{isBoss},
      </if>
      <if test="hiredDate != null">
        #{hiredDate},
      </if>
      <if test="isSenior != null">
        #{isSenior},
      </if>
      <if test="tel != null">
        #{tel},
      </if>
      <if test="workPlace != null">
        #{workPlace},
      </if>
      <if test="email != null">
        #{email},
      </if>
      <if test="active != null">
        #{active},
      </if>
      <if test="avatar != null">
        #{avatar},
      </if>
      <if test="isAdmin != null">
        #{isAdmin},
      </if>
      <if test="isHide != null">
        #{isHide},
      </if>
      <if test="jobNumber != null">
        #{jobNumber},
      </if>
      <if test="name != null">
        #{name},
      </if>
      <if test="stateCode != null">
        #{stateCode},
      </if>
      <if test="realAuthed != null">
        #{realAuthed},
      </if>
      <if test="dbUpdateTimestamp != null">
        #{dbUpdateTimestamp},
      </if>
      <if test="position != null">
        #{position},
      </if>
      <if test="mobile != null">
        #{mobile},
      </if>
      <if test="checkStatus != null">
        #{checkStatus},
      </if>
      <if test="jobStatus != null">
        #{jobStatus},
      </if>
      <if test="configCodeId != null">
        #{configCodeId},
      </if>
      <if test="isLeaderInDepts != null">
        #{isLeaderInDepts},
      </if>
      <if test="department != null">
        #{department},
      </if>
      <if test="extattr != null">
        #{extattr},
      </if>
      <if test="roles != null">
        #{roles},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective">
    update dingding_user
    <set>
      <if test="userid != null">
        userid = #{userid},
      </if>
      <if test="unionid != null">
        unionid = #{unionid},
      </if>
      <if test="remark != null">
        remark = #{remark},
      </if>
      <if test="isBoss != null">
        is_boss = #{isBoss},
      </if>
      <if test="hiredDate != null">
        hired_date = #{hiredDate},
      </if>
      <if test="isSenior != null">
        is_senior = #{isSenior},
      </if>
      <if test="tel != null">
        tel = #{tel},
      </if>
      <if test="workPlace != null">
        work_place = #{workPlace},
      </if>
      <if test="email != null">
        email = #{email},
      </if>
      <if test="active != null">
        active = #{active},
      </if>
      <if test="avatar != null">
        avatar = #{avatar},
      </if>
      <if test="isAdmin != null">
        is_admin = #{isAdmin},
      </if>
      <if test="isHide != null">
        is_hide = #{isHide},
      </if>
      <if test="jobNumber != null">
        job_number = #{jobNumber},
      </if>
      <if test="name != null">
        name = #{name},
      </if>
      <if test="stateCode != null">
        state_code = #{stateCode},
      </if>
      <if test="realAuthed != null">
        real_authed = #{realAuthed},
      </if>
      <if test="dbUpdateTimestamp != null">
        db_update_timestamp = #{dbUpdateTimestamp},
      </if>
      <if test="position != null">
        position = #{position},
      </if>
      <if test="mobile != null">
        mobile = #{mobile},
      </if>
      <if test="checkStatus != null">
        check_status = #{checkStatus},
      </if>
      <if test="jobStatus != null">
        job_status = #{jobStatus},
      </if>
      <if test="configCodeId != null">
        config_code_id = #{configCodeId},
      </if>
      <if test="isLeaderInDepts != null">
        is_leader_in_depts = #{isLeaderInDepts},
      </if>
      <if test="department != null">
        department = #{department},
      </if>
      <if test="extattr != null">
        extattr = #{extattr},
      </if>
      <if test="roles != null">
        roles = #{roles},
      </if>
    </set>
    where id = #{id}
  </update>
    <select id="selectDingDingUserByMobile" resultType="com.cool.store.entity.DingdingUserDO">
        select
        <include refid="Base_Column_List"/>,
        <include refid="Blob_Column_List"/>
        from
        dingding_user
        where
        mobile = #{mobile}
    </select>
</mapper>