<?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.QchjcCustomerBackAccountEntityMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntity">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="back_account_status" jdbcType="INTEGER" property="backAccountStatus" />
    <result column="back_account_mode_record" jdbcType="INTEGER" property="backAccountModeRecord" />
    <result column="back_account_user_id" jdbcType="VARCHAR" property="backAccountUserId" />
    <result column="back_account_user_name" jdbcType="VARCHAR" property="backAccountUserName" />
    <result column="back_account_time" jdbcType="TIMESTAMP" property="backAccountTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="sync_time" jdbcType="TIMESTAMP" property="syncTime" />
  </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, accounting_order_sn, back_account_status, back_account_mode_record, back_account_user_id, 
    back_account_user_name, back_account_time, remark, sync_time
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntityExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from qchjc_customer_back_account
    <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_customer_back_account
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from qchjc_customer_back_account
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntityExample">
    delete from qchjc_customer_back_account
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntity">
    insert into qchjc_customer_back_account (id, accounting_order_sn, back_account_status, 
      back_account_mode_record, back_account_user_id, 
      back_account_user_name, back_account_time, 
      remark, sync_time)
    values (#{id,jdbcType=BIGINT}, #{accountingOrderSn,jdbcType=VARCHAR}, #{backAccountStatus,jdbcType=INTEGER}, 
      #{backAccountModeRecord,jdbcType=INTEGER}, #{backAccountUserId,jdbcType=VARCHAR}, 
      #{backAccountUserName,jdbcType=VARCHAR}, #{backAccountTime,jdbcType=TIMESTAMP}, 
      #{remark,jdbcType=VARCHAR}, #{syncTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntity">
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into qchjc_customer_back_account
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="backAccountStatus != null">
        back_account_status,
      </if>
      <if test="backAccountModeRecord != null">
        back_account_mode_record,
      </if>
      <if test="backAccountUserId != null">
        back_account_user_id,
      </if>
      <if test="backAccountUserName != null">
        back_account_user_name,
      </if>
      <if test="backAccountTime != null">
        back_account_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="syncTime != null">
        sync_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="backAccountStatus != null">
        #{backAccountStatus,jdbcType=INTEGER},
      </if>
      <if test="backAccountModeRecord != null">
        #{backAccountModeRecord,jdbcType=INTEGER},
      </if>
      <if test="backAccountUserId != null">
        #{backAccountUserId,jdbcType=VARCHAR},
      </if>
      <if test="backAccountUserName != null">
        #{backAccountUserName,jdbcType=VARCHAR},
      </if>
      <if test="backAccountTime != null">
        #{backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        #{syncTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.accounting.QchjcCustomerBackAccountEntityExample" resultType="java.lang.Long">
    select count(*) from qchjc_customer_back_account
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update qchjc_customer_back_account
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.accountingOrderSn != null">
        accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.backAccountStatus != null">
        back_account_status = #{record.backAccountStatus,jdbcType=INTEGER},
      </if>
      <if test="record.backAccountModeRecord != null">
        back_account_mode_record = #{record.backAccountModeRecord,jdbcType=INTEGER},
      </if>
      <if test="record.backAccountUserId != null">
        back_account_user_id = #{record.backAccountUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.backAccountUserName != null">
        back_account_user_name = #{record.backAccountUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.backAccountTime != null">
        back_account_time = #{record.backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </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_customer_back_account
    set id = #{record.id,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      back_account_status = #{record.backAccountStatus,jdbcType=INTEGER},
      back_account_mode_record = #{record.backAccountModeRecord,jdbcType=INTEGER},
      back_account_user_id = #{record.backAccountUserId,jdbcType=VARCHAR},
      back_account_user_name = #{record.backAccountUserName,jdbcType=VARCHAR},
      back_account_time = #{record.backAccountTime,jdbcType=TIMESTAMP},
      remark = #{record.remark,jdbcType=VARCHAR},
      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.accounting.QchjcCustomerBackAccountEntity">
    update qchjc_customer_back_account
    <set>
      <if test="accountingOrderSn != null">
        accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="backAccountStatus != null">
        back_account_status = #{backAccountStatus,jdbcType=INTEGER},
      </if>
      <if test="backAccountModeRecord != null">
        back_account_mode_record = #{backAccountModeRecord,jdbcType=INTEGER},
      </if>
      <if test="backAccountUserId != null">
        back_account_user_id = #{backAccountUserId,jdbcType=VARCHAR},
      </if>
      <if test="backAccountUserName != null">
        back_account_user_name = #{backAccountUserName,jdbcType=VARCHAR},
      </if>
      <if test="backAccountTime != null">
        back_account_time = #{backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </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.accounting.QchjcCustomerBackAccountEntity">
    update qchjc_customer_back_account
    set accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      back_account_status = #{backAccountStatus,jdbcType=INTEGER},
      back_account_mode_record = #{backAccountModeRecord,jdbcType=INTEGER},
      back_account_user_id = #{backAccountUserId,jdbcType=VARCHAR},
      back_account_user_name = #{backAccountUserName,jdbcType=VARCHAR},
      back_account_time = #{backAccountTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR},
      sync_time = #{syncTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>