<?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._statistics.StPayableChargeAgainstRecordEntityMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntity">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="settlement_id" jdbcType="BIGINT" property="settlementId" />
    <result column="settlement_name" jdbcType="VARCHAR" property="settlementName" />
    <result column="service_no" jdbcType="VARCHAR" property="serviceNo" />
    <result column="service_no_name" jdbcType="VARCHAR" property="serviceNoName" />
    <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
    <result column="refund_order_sn" jdbcType="VARCHAR" property="refundOrderSn" />
    <result column="goods_id" jdbcType="BIGINT" property="goodsId" />
    <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
    <result column="credit_id" jdbcType="BIGINT" property="creditId" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="charge_json" jdbcType="VARCHAR" property="chargeJson" />
  </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, settlement_id, settlement_name, service_no, service_no_name, 
    order_sn, refund_order_sn, goods_id, goods_name, credit_id, created_at, charge_json
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntityExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from st_payable_charge_against_record
    <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 st_payable_charge_against_record
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from st_payable_charge_against_record
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntityExample">
    delete from st_payable_charge_against_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntity">
    insert into st_payable_charge_against_record (id, accounting_order_sn, settlement_id, 
      settlement_name, service_no, service_no_name, 
      order_sn, refund_order_sn, goods_id, 
      goods_name, credit_id, created_at, 
      charge_json)
    values (#{id,jdbcType=BIGINT}, #{accountingOrderSn,jdbcType=VARCHAR}, #{settlementId,jdbcType=BIGINT}, 
      #{settlementName,jdbcType=VARCHAR}, #{serviceNo,jdbcType=VARCHAR}, #{serviceNoName,jdbcType=VARCHAR}, 
      #{orderSn,jdbcType=VARCHAR}, #{refundOrderSn,jdbcType=VARCHAR}, #{goodsId,jdbcType=BIGINT}, 
      #{goodsName,jdbcType=VARCHAR}, #{creditId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{chargeJson,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntity">
    insert into st_payable_charge_against_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="settlementId != null">
        settlement_id,
      </if>
      <if test="settlementName != null">
        settlement_name,
      </if>
      <if test="serviceNo != null">
        service_no,
      </if>
      <if test="serviceNoName != null">
        service_no_name,
      </if>
      <if test="orderSn != null">
        order_sn,
      </if>
      <if test="refundOrderSn != null">
        refund_order_sn,
      </if>
      <if test="goodsId != null">
        goods_id,
      </if>
      <if test="goodsName != null">
        goods_name,
      </if>
      <if test="creditId != null">
        credit_id,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="chargeJson != null">
        charge_json,
      </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="settlementId != null">
        #{settlementId,jdbcType=BIGINT},
      </if>
      <if test="settlementName != null">
        #{settlementName,jdbcType=VARCHAR},
      </if>
      <if test="serviceNo != null">
        #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceNoName != null">
        #{serviceNoName,jdbcType=VARCHAR},
      </if>
      <if test="orderSn != null">
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="refundOrderSn != null">
        #{refundOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="goodsId != null">
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsName != null">
        #{goodsName,jdbcType=VARCHAR},
      </if>
      <if test="creditId != null">
        #{creditId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="chargeJson != null">
        #{chargeJson,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntityExample" resultType="java.lang.Long">
    select count(*) from st_payable_charge_against_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update st_payable_charge_against_record
    <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.settlementId != null">
        settlement_id = #{record.settlementId,jdbcType=BIGINT},
      </if>
      <if test="record.settlementName != null">
        settlement_name = #{record.settlementName,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceNo != null">
        service_no = #{record.serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceNoName != null">
        service_no_name = #{record.serviceNoName,jdbcType=VARCHAR},
      </if>
      <if test="record.orderSn != null">
        order_sn = #{record.orderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.refundOrderSn != null">
        refund_order_sn = #{record.refundOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.goodsId != null">
        goods_id = #{record.goodsId,jdbcType=BIGINT},
      </if>
      <if test="record.goodsName != null">
        goods_name = #{record.goodsName,jdbcType=VARCHAR},
      </if>
      <if test="record.creditId != null">
        credit_id = #{record.creditId,jdbcType=BIGINT},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.chargeJson != null">
        charge_json = #{record.chargeJson,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update st_payable_charge_against_record
    set id = #{record.id,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      settlement_id = #{record.settlementId,jdbcType=BIGINT},
      settlement_name = #{record.settlementName,jdbcType=VARCHAR},
      service_no = #{record.serviceNo,jdbcType=VARCHAR},
      service_no_name = #{record.serviceNoName,jdbcType=VARCHAR},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      refund_order_sn = #{record.refundOrderSn,jdbcType=VARCHAR},
      goods_id = #{record.goodsId,jdbcType=BIGINT},
      goods_name = #{record.goodsName,jdbcType=VARCHAR},
      credit_id = #{record.creditId,jdbcType=BIGINT},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      charge_json = #{record.chargeJson,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntity">
    update st_payable_charge_against_record
    <set>
      <if test="accountingOrderSn != null">
        accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="settlementId != null">
        settlement_id = #{settlementId,jdbcType=BIGINT},
      </if>
      <if test="settlementName != null">
        settlement_name = #{settlementName,jdbcType=VARCHAR},
      </if>
      <if test="serviceNo != null">
        service_no = #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceNoName != null">
        service_no_name = #{serviceNoName,jdbcType=VARCHAR},
      </if>
      <if test="orderSn != null">
        order_sn = #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="refundOrderSn != null">
        refund_order_sn = #{refundOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="goodsId != null">
        goods_id = #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsName != null">
        goods_name = #{goodsName,jdbcType=VARCHAR},
      </if>
      <if test="creditId != null">
        credit_id = #{creditId,jdbcType=BIGINT},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="chargeJson != null">
        charge_json = #{chargeJson,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.statistics.prayable.StPayableChargeAgainstRecordEntity">
    update st_payable_charge_against_record
    set accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      settlement_id = #{settlementId,jdbcType=BIGINT},
      settlement_name = #{settlementName,jdbcType=VARCHAR},
      service_no = #{serviceNo,jdbcType=VARCHAR},
      service_no_name = #{serviceNoName,jdbcType=VARCHAR},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      refund_order_sn = #{refundOrderSn,jdbcType=VARCHAR},
      goods_id = #{goodsId,jdbcType=BIGINT},
      goods_name = #{goodsName,jdbcType=VARCHAR},
      credit_id = #{creditId,jdbcType=BIGINT},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      charge_json = #{chargeJson,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>