<?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="cn.superdesk.uniorder.dao.mapper.thirdpart.qchjc.organisation.QchjcEnterpriseEntityMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntity">
    <constructor>
      <idArg column="id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="unified_id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="contacts_address" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="contacts_name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="contacts_phone" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="deleted" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="enabled" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="virt_id" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="virt_name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="create_user_name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="create_user_id" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="create_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
      <arg column="update_user_name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="update_user_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="update_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
      <arg column="sync_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
    </constructor>
  </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, unified_id, contacts_address, contacts_name, contacts_phone, deleted, enabled, 
    virt_id, virt_name, create_user_name, create_user_id, create_time, update_user_name, 
    update_user_id, update_time, sync_time
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntityExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from qchjc_enterprise
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from qchjc_enterprise
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from qchjc_enterprise
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntityExample">
    delete from qchjc_enterprise
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntity">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into qchjc_enterprise (id, unified_id, contacts_address, 
      contacts_name, contacts_phone, deleted, 
      enabled, virt_id, virt_name, 
      create_user_name, create_user_id, create_time, 
      update_user_name, update_user_id, update_time, 
      sync_time)
    values (#{id,jdbcType=BIGINT}, #{unifiedId,jdbcType=BIGINT}, #{contactsAddress,jdbcType=VARCHAR}, 
      #{contactsName,jdbcType=VARCHAR}, #{contactsPhone,jdbcType=VARCHAR}, #{deleted,jdbcType=INTEGER}, 
      #{enabled,jdbcType=INTEGER}, #{virtId,jdbcType=VARCHAR}, #{virtName,jdbcType=VARCHAR}, 
      #{createUserName,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateUserName,jdbcType=VARCHAR}, #{updateUserId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{syncTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntity">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into qchjc_enterprise
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="unifiedId != null">
        unified_id,
      </if>
      <if test="contactsAddress != null">
        contacts_address,
      </if>
      <if test="contactsName != null">
        contacts_name,
      </if>
      <if test="contactsPhone != null">
        contacts_phone,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="enabled != null">
        enabled,
      </if>
      <if test="virtId != null">
        virt_id,
      </if>
      <if test="virtName != null">
        virt_name,
      </if>
      <if test="createUserName != null">
        create_user_name,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateUserName != null">
        update_user_name,
      </if>
      <if test="updateUserId != null">
        update_user_id,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="syncTime != null">
        sync_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="unifiedId != null">
        #{unifiedId,jdbcType=BIGINT},
      </if>
      <if test="contactsAddress != null">
        #{contactsAddress,jdbcType=VARCHAR},
      </if>
      <if test="contactsName != null">
        #{contactsName,jdbcType=VARCHAR},
      </if>
      <if test="contactsPhone != null">
        #{contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=INTEGER},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=INTEGER},
      </if>
      <if test="virtId != null">
        #{virtId,jdbcType=VARCHAR},
      </if>
      <if test="virtName != null">
        #{virtName,jdbcType=VARCHAR},
      </if>
      <if test="createUserName != null">
        #{createUserName,jdbcType=VARCHAR},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserName != null">
        #{updateUserName,jdbcType=VARCHAR},
      </if>
      <if test="updateUserId != null">
        #{updateUserId,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="syncTime != null">
        #{syncTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntityExample" resultType="java.lang.Long">
    select count(*) from qchjc_enterprise
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <select id="selectByOutId"
          resultMap="BaseResultMap">
    select * from qchjc_enterprise where virt_id = #{outId,jdbcType=BIGINT}
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update qchjc_enterprise
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.unifiedId != null">
        unified_id = #{record.unifiedId,jdbcType=BIGINT},
      </if>
      <if test="record.contactsAddress != null">
        contacts_address = #{record.contactsAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.contactsName != null">
        contacts_name = #{record.contactsName,jdbcType=VARCHAR},
      </if>
      <if test="record.contactsPhone != null">
        contacts_phone = #{record.contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=INTEGER},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=INTEGER},
      </if>
      <if test="record.virtId != null">
        virt_id = #{record.virtId,jdbcType=VARCHAR},
      </if>
      <if test="record.virtName != null">
        virt_name = #{record.virtName,jdbcType=VARCHAR},
      </if>
      <if test="record.createUserName != null">
        create_user_name = #{record.createUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserName != null">
        update_user_name = #{record.updateUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.updateUserId != null">
        update_user_id = #{record.updateUserId,jdbcType=INTEGER},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.syncTime != null">
        sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update qchjc_enterprise
    set id = #{record.id,jdbcType=BIGINT},
      unified_id = #{record.unifiedId,jdbcType=BIGINT},
      contacts_address = #{record.contactsAddress,jdbcType=VARCHAR},
      contacts_name = #{record.contactsName,jdbcType=VARCHAR},
      contacts_phone = #{record.contactsPhone,jdbcType=VARCHAR},
      deleted = #{record.deleted,jdbcType=INTEGER},
      enabled = #{record.enabled,jdbcType=INTEGER},
      virt_id = #{record.virtId,jdbcType=VARCHAR},
      virt_name = #{record.virtName,jdbcType=VARCHAR},
      create_user_name = #{record.createUserName,jdbcType=VARCHAR},
      create_user_id = #{record.createUserId,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_user_name = #{record.updateUserName,jdbcType=VARCHAR},
      update_user_id = #{record.updateUserId,jdbcType=INTEGER},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      sync_time = #{record.syncTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntity">
    update qchjc_enterprise
    <set>
      <if test="unifiedId != null">
        unified_id = #{unifiedId,jdbcType=BIGINT},
      </if>
      <if test="contactsAddress != null">
        contacts_address = #{contactsAddress,jdbcType=VARCHAR},
      </if>
      <if test="contactsName != null">
        contacts_name = #{contactsName,jdbcType=VARCHAR},
      </if>
      <if test="contactsPhone != null">
        contacts_phone = #{contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=INTEGER},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=INTEGER},
      </if>
      <if test="virtId != null">
        virt_id = #{virtId,jdbcType=VARCHAR},
      </if>
      <if test="virtName != null">
        virt_name = #{virtName,jdbcType=VARCHAR},
      </if>
      <if test="createUserName != null">
        create_user_name = #{createUserName,jdbcType=VARCHAR},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserName != null">
        update_user_name = #{updateUserName,jdbcType=VARCHAR},
      </if>
      <if test="updateUserId != null">
        update_user_id = #{updateUserId,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="syncTime != null">
        sync_time = #{syncTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.organisation.QchjcEnterpriseEntity">
    update qchjc_enterprise
    set unified_id = #{unifiedId,jdbcType=BIGINT},
      contacts_address = #{contactsAddress,jdbcType=VARCHAR},
      contacts_name = #{contactsName,jdbcType=VARCHAR},
      contacts_phone = #{contactsPhone,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=INTEGER},
      enabled = #{enabled,jdbcType=INTEGER},
      virt_id = #{virtId,jdbcType=VARCHAR},
      virt_name = #{virtName,jdbcType=VARCHAR},
      create_user_name = #{createUserName,jdbcType=VARCHAR},
      create_user_id = #{createUserId,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_user_name = #{updateUserName,jdbcType=VARCHAR},
      update_user_id = #{updateUserId,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      sync_time = #{syncTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>