<?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="org.linlinjava.jz.db.dao.HmEmployRelationMapper">
  <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.HmEmployRelation">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="user_servant_id" jdbcType="BIGINT" property="userServantId" />
    <result column="user_employer_id" jdbcType="BIGINT" property="userEmployerId" />
    <result column="user_butler_id" jdbcType="BIGINT" property="userButlerId" />
    <result column="servant_name" jdbcType="VARCHAR" property="servantName" />
    <result column="employer_name" jdbcType="VARCHAR" property="employerName" />
    <result column="butler_name" jdbcType="VARCHAR" property="butlerName" />
    <result column="butler_first_confirm" jdbcType="INTEGER" property="butlerFirstConfirm" />
    <result column="first_service_time" jdbcType="TIMESTAMP" property="firstServiceTime" />
    <result column="rest_mode" jdbcType="INTEGER" property="restMode" />
    <result column="rest_day" jdbcType="VARCHAR" property="restDay" />
    <result column="is_need_clock" jdbcType="INTEGER" property="isNeedClock" />
    <result column="work_scope" jdbcType="VARCHAR" property="workScope" />
    <result column="is_invalid" jdbcType="INTEGER" property="isInvalid" />
    <result column="relieve_time" jdbcType="TIMESTAMP" property="relieveTime" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    id, order_no, user_servant_id, user_employer_id, user_butler_id, servant_name, employer_name, 
    butler_name, butler_first_confirm, first_service_time, rest_mode, rest_day, is_need_clock, 
    work_scope, is_invalid, relieve_time, create_time, update_time, remark
  </sql>
  <select id="selectByExample" parameterType="org.linlinjava.jz.db.domain.HmEmployRelationExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from hm_employ_relation
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="example != null and example.distinct">
      distinct
    </if>
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from hm_employ_relation
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from hm_employ_relation
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from hm_employ_relation
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from hm_employ_relation
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="org.linlinjava.jz.db.domain.HmEmployRelationExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from hm_employ_relation
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="org.linlinjava.jz.db.domain.HmEmployRelation">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into hm_employ_relation (order_no, user_servant_id, user_employer_id, 
      user_butler_id, servant_name, employer_name, 
      butler_name, butler_first_confirm, first_service_time, 
      rest_mode, rest_day, is_need_clock, 
      work_scope, is_invalid, relieve_time, 
      create_time, update_time, remark
      )
    values (#{orderNo,jdbcType=VARCHAR}, #{userServantId,jdbcType=BIGINT}, #{userEmployerId,jdbcType=BIGINT}, 
      #{userButlerId,jdbcType=BIGINT}, #{servantName,jdbcType=VARCHAR}, #{employerName,jdbcType=VARCHAR}, 
      #{butlerName,jdbcType=VARCHAR}, #{butlerFirstConfirm,jdbcType=INTEGER}, #{firstServiceTime,jdbcType=TIMESTAMP}, 
      #{restMode,jdbcType=INTEGER}, #{restDay,jdbcType=VARCHAR}, #{isNeedClock,jdbcType=INTEGER}, 
      #{workScope,jdbcType=VARCHAR}, #{isInvalid,jdbcType=INTEGER}, #{relieveTime,jdbcType=TIMESTAMP}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="org.linlinjava.jz.db.domain.HmEmployRelation">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into hm_employ_relation
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="userServantId != null">
        user_servant_id,
      </if>
      <if test="userEmployerId != null">
        user_employer_id,
      </if>
      <if test="userButlerId != null">
        user_butler_id,
      </if>
      <if test="servantName != null">
        servant_name,
      </if>
      <if test="employerName != null">
        employer_name,
      </if>
      <if test="butlerName != null">
        butler_name,
      </if>
      <if test="butlerFirstConfirm != null">
        butler_first_confirm,
      </if>
      <if test="firstServiceTime != null">
        first_service_time,
      </if>
      <if test="restMode != null">
        rest_mode,
      </if>
      <if test="restDay != null">
        rest_day,
      </if>
      <if test="isNeedClock != null">
        is_need_clock,
      </if>
      <if test="workScope != null">
        work_scope,
      </if>
      <if test="isInvalid != null">
        is_invalid,
      </if>
      <if test="relieveTime != null">
        relieve_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="userServantId != null">
        #{userServantId,jdbcType=BIGINT},
      </if>
      <if test="userEmployerId != null">
        #{userEmployerId,jdbcType=BIGINT},
      </if>
      <if test="userButlerId != null">
        #{userButlerId,jdbcType=BIGINT},
      </if>
      <if test="servantName != null">
        #{servantName,jdbcType=VARCHAR},
      </if>
      <if test="employerName != null">
        #{employerName,jdbcType=VARCHAR},
      </if>
      <if test="butlerName != null">
        #{butlerName,jdbcType=VARCHAR},
      </if>
      <if test="butlerFirstConfirm != null">
        #{butlerFirstConfirm,jdbcType=INTEGER},
      </if>
      <if test="firstServiceTime != null">
        #{firstServiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="restMode != null">
        #{restMode,jdbcType=INTEGER},
      </if>
      <if test="restDay != null">
        #{restDay,jdbcType=VARCHAR},
      </if>
      <if test="isNeedClock != null">
        #{isNeedClock,jdbcType=INTEGER},
      </if>
      <if test="workScope != null">
        #{workScope,jdbcType=VARCHAR},
      </if>
      <if test="isInvalid != null">
        #{isInvalid,jdbcType=INTEGER},
      </if>
      <if test="relieveTime != null">
        #{relieveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="org.linlinjava.jz.db.domain.HmEmployRelationExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from hm_employ_relation
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update hm_employ_relation
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.orderNo != null">
        order_no = #{record.orderNo,jdbcType=VARCHAR},
      </if>
      <if test="record.userServantId != null">
        user_servant_id = #{record.userServantId,jdbcType=BIGINT},
      </if>
      <if test="record.userEmployerId != null">
        user_employer_id = #{record.userEmployerId,jdbcType=BIGINT},
      </if>
      <if test="record.userButlerId != null">
        user_butler_id = #{record.userButlerId,jdbcType=BIGINT},
      </if>
      <if test="record.servantName != null">
        servant_name = #{record.servantName,jdbcType=VARCHAR},
      </if>
      <if test="record.employerName != null">
        employer_name = #{record.employerName,jdbcType=VARCHAR},
      </if>
      <if test="record.butlerName != null">
        butler_name = #{record.butlerName,jdbcType=VARCHAR},
      </if>
      <if test="record.butlerFirstConfirm != null">
        butler_first_confirm = #{record.butlerFirstConfirm,jdbcType=INTEGER},
      </if>
      <if test="record.firstServiceTime != null">
        first_service_time = #{record.firstServiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.restMode != null">
        rest_mode = #{record.restMode,jdbcType=INTEGER},
      </if>
      <if test="record.restDay != null">
        rest_day = #{record.restDay,jdbcType=VARCHAR},
      </if>
      <if test="record.isNeedClock != null">
        is_need_clock = #{record.isNeedClock,jdbcType=INTEGER},
      </if>
      <if test="record.workScope != null">
        work_scope = #{record.workScope,jdbcType=VARCHAR},
      </if>
      <if test="record.isInvalid != null">
        is_invalid = #{record.isInvalid,jdbcType=INTEGER},
      </if>
      <if test="record.relieveTime != null">
        relieve_time = #{record.relieveTime,jdbcType=TIMESTAMP},
      </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>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update hm_employ_relation
    set id = #{record.id,jdbcType=BIGINT},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      user_servant_id = #{record.userServantId,jdbcType=BIGINT},
      user_employer_id = #{record.userEmployerId,jdbcType=BIGINT},
      user_butler_id = #{record.userButlerId,jdbcType=BIGINT},
      servant_name = #{record.servantName,jdbcType=VARCHAR},
      employer_name = #{record.employerName,jdbcType=VARCHAR},
      butler_name = #{record.butlerName,jdbcType=VARCHAR},
      butler_first_confirm = #{record.butlerFirstConfirm,jdbcType=INTEGER},
      first_service_time = #{record.firstServiceTime,jdbcType=TIMESTAMP},
      rest_mode = #{record.restMode,jdbcType=INTEGER},
      rest_day = #{record.restDay,jdbcType=VARCHAR},
      is_need_clock = #{record.isNeedClock,jdbcType=INTEGER},
      work_scope = #{record.workScope,jdbcType=VARCHAR},
      is_invalid = #{record.isInvalid,jdbcType=INTEGER},
      relieve_time = #{record.relieveTime,jdbcType=TIMESTAMP},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      remark = #{record.remark,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.HmEmployRelation">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update hm_employ_relation
    <set>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="userServantId != null">
        user_servant_id = #{userServantId,jdbcType=BIGINT},
      </if>
      <if test="userEmployerId != null">
        user_employer_id = #{userEmployerId,jdbcType=BIGINT},
      </if>
      <if test="userButlerId != null">
        user_butler_id = #{userButlerId,jdbcType=BIGINT},
      </if>
      <if test="servantName != null">
        servant_name = #{servantName,jdbcType=VARCHAR},
      </if>
      <if test="employerName != null">
        employer_name = #{employerName,jdbcType=VARCHAR},
      </if>
      <if test="butlerName != null">
        butler_name = #{butlerName,jdbcType=VARCHAR},
      </if>
      <if test="butlerFirstConfirm != null">
        butler_first_confirm = #{butlerFirstConfirm,jdbcType=INTEGER},
      </if>
      <if test="firstServiceTime != null">
        first_service_time = #{firstServiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="restMode != null">
        rest_mode = #{restMode,jdbcType=INTEGER},
      </if>
      <if test="restDay != null">
        rest_day = #{restDay,jdbcType=VARCHAR},
      </if>
      <if test="isNeedClock != null">
        is_need_clock = #{isNeedClock,jdbcType=INTEGER},
      </if>
      <if test="workScope != null">
        work_scope = #{workScope,jdbcType=VARCHAR},
      </if>
      <if test="isInvalid != null">
        is_invalid = #{isInvalid,jdbcType=INTEGER},
      </if>
      <if test="relieveTime != null">
        relieve_time = #{relieveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.HmEmployRelation">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update hm_employ_relation
    set order_no = #{orderNo,jdbcType=VARCHAR},
      user_servant_id = #{userServantId,jdbcType=BIGINT},
      user_employer_id = #{userEmployerId,jdbcType=BIGINT},
      user_butler_id = #{userButlerId,jdbcType=BIGINT},
      servant_name = #{servantName,jdbcType=VARCHAR},
      employer_name = #{employerName,jdbcType=VARCHAR},
      butler_name = #{butlerName,jdbcType=VARCHAR},
      butler_first_confirm = #{butlerFirstConfirm,jdbcType=INTEGER},
      first_service_time = #{firstServiceTime,jdbcType=TIMESTAMP},
      rest_mode = #{restMode,jdbcType=INTEGER},
      rest_day = #{restDay,jdbcType=VARCHAR},
      is_need_clock = #{isNeedClock,jdbcType=INTEGER},
      work_scope = #{workScope,jdbcType=VARCHAR},
      is_invalid = #{isInvalid,jdbcType=INTEGER},
      relieve_time = #{relieveTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectOneByExample" parameterType="org.linlinjava.jz.db.domain.HmEmployRelationExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <include refid="Base_Column_List" />
    from hm_employ_relation
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
  <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from hm_employ_relation
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
    limit 1
  </select>
</mapper>