<?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.accounting.QchjcUserEntityMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntity">
    <constructor>
      <idArg column="id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="unified_id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="out_id" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="user_name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="sync_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
      <arg column="storage_status" javaType="java.lang.Integer" jdbcType="TINYINT" />
      <arg column="storage_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, out_id, user_name, sync_time, storage_status, storage_time
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntityExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from qchjc_user
    <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_user
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from qchjc_user
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntityExample">
    delete from qchjc_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntity">
    insert into qchjc_user (id, unified_id, out_id, 
      user_name, sync_time, storage_status, 
      storage_time)
    values (#{id,jdbcType=BIGINT}, #{unifiedId,jdbcType=BIGINT}, #{outId,jdbcType=VARCHAR}, 
      #{userName,jdbcType=VARCHAR}, #{syncTime,jdbcType=TIMESTAMP}, #{storageStatus,jdbcType=TINYINT}, 
      #{storageTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntity">
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into qchjc_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="unifiedId != null">
        unified_id,
      </if>
      <if test="outId != null">
        out_id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="syncTime != null">
        sync_time,
      </if>
      <if test="storageStatus != null">
        storage_status,
      </if>
      <if test="storageTime != null">
        storage_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="outId != null">
        #{outId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="storageStatus != null">
        #{storageStatus,jdbcType=TINYINT},
      </if>
      <if test="storageTime != null">
        #{storageTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntityExample" resultType="java.lang.Long">
    select count(*) from qchjc_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <select id="selectByOutId"
          resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from qchjc_user
    where out_id = #{outId,jdbcType=VARCHAR}
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update qchjc_user
    <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.outId != null">
        out_id = #{record.outId,jdbcType=VARCHAR},
      </if>
      <if test="record.userName != null">
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.syncTime != null">
        sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.storageStatus != null">
        storage_status = #{record.storageStatus,jdbcType=TINYINT},
      </if>
      <if test="record.storageTime != null">
        storage_time = #{record.storageTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update qchjc_user
    set id = #{record.id,jdbcType=BIGINT},
      unified_id = #{record.unifiedId,jdbcType=BIGINT},
      out_id = #{record.outId,jdbcType=VARCHAR},
      user_name = #{record.userName,jdbcType=VARCHAR},
      sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      storage_status = #{record.storageStatus,jdbcType=TINYINT},
      storage_time = #{record.storageTime,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.accounting.QchjcUserEntity">
    update qchjc_user
    <set>
      <if test="unifiedId != null">
        unified_id = #{unifiedId,jdbcType=BIGINT},
      </if>
      <if test="outId != null">
        out_id = #{outId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        sync_time = #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="storageStatus != null">
        storage_status = #{storageStatus,jdbcType=TINYINT},
      </if>
      <if test="storageTime != null">
        storage_time = #{storageTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcUserEntity">
    update qchjc_user
    set unified_id = #{unifiedId,jdbcType=BIGINT},
      out_id = #{outId,jdbcType=VARCHAR},
      user_name = #{userName,jdbcType=VARCHAR},
      sync_time = #{syncTime,jdbcType=TIMESTAMP},
      storage_status = #{storageStatus,jdbcType=TINYINT},
      storage_time = #{storageTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>