<?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="com.neu.his.mbg.mapper.BmsInvoiceRecordMapper">
  <resultMap id="BaseResultMap" type="com.neu.his.mbg.model.BmsInvoiceRecord">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="invoice_no" jdbcType="BIGINT" property="invoiceNo" />
    <result column="bill_id" jdbcType="BIGINT" property="billId" />
    <result column="amount" jdbcType="DECIMAL" property="amount" />
    <result column="freeze_status" jdbcType="INTEGER" property="freezeStatus" />
    <result column="associate_id" jdbcType="BIGINT" property="associateId" />
    <result column="operator_id" jdbcType="BIGINT" property="operatorId" />
    <result column="settlement_cat_id" jdbcType="BIGINT" property="settlementCatId" />
    <result column="settle_record_id" jdbcType="BIGINT" property="settleRecordId" />
    <result column="item_list" jdbcType="VARCHAR" property="itemList" />
    <result column="type" jdbcType="INTEGER" property="type" />
  </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, create_time, invoice_no, bill_id, amount, freeze_status, associate_id, operator_id, 
    settlement_cat_id, settle_record_id, item_list, type
  </sql>
  <select id="selectByExample" parameterType="com.neu.his.mbg.model.BmsInvoiceRecordExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from bms_invoice_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 bms_invoice_record
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from bms_invoice_record
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.neu.his.mbg.model.BmsInvoiceRecordExample">
    delete from bms_invoice_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.neu.his.mbg.model.BmsInvoiceRecord">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into bms_invoice_record (create_time, invoice_no, bill_id, 
      amount, freeze_status, associate_id, 
      operator_id, settlement_cat_id, settle_record_id, 
      item_list, type)
    values (#{createTime,jdbcType=TIMESTAMP}, #{invoiceNo,jdbcType=BIGINT}, #{billId,jdbcType=BIGINT}, 
      #{amount,jdbcType=DECIMAL}, #{freezeStatus,jdbcType=INTEGER}, #{associateId,jdbcType=BIGINT}, 
      #{operatorId,jdbcType=BIGINT}, #{settlementCatId,jdbcType=BIGINT}, #{settleRecordId,jdbcType=BIGINT}, 
      #{itemList,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.neu.his.mbg.model.BmsInvoiceRecord">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into bms_invoice_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="createTime != null">
        create_time,
      </if>
      <if test="invoiceNo != null">
        invoice_no,
      </if>
      <if test="billId != null">
        bill_id,
      </if>
      <if test="amount != null">
        amount,
      </if>
      <if test="freezeStatus != null">
        freeze_status,
      </if>
      <if test="associateId != null">
        associate_id,
      </if>
      <if test="operatorId != null">
        operator_id,
      </if>
      <if test="settlementCatId != null">
        settlement_cat_id,
      </if>
      <if test="settleRecordId != null">
        settle_record_id,
      </if>
      <if test="itemList != null">
        item_list,
      </if>
      <if test="type != null">
        type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceNo != null">
        #{invoiceNo,jdbcType=BIGINT},
      </if>
      <if test="billId != null">
        #{billId,jdbcType=BIGINT},
      </if>
      <if test="amount != null">
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="freezeStatus != null">
        #{freezeStatus,jdbcType=INTEGER},
      </if>
      <if test="associateId != null">
        #{associateId,jdbcType=BIGINT},
      </if>
      <if test="operatorId != null">
        #{operatorId,jdbcType=BIGINT},
      </if>
      <if test="settlementCatId != null">
        #{settlementCatId,jdbcType=BIGINT},
      </if>
      <if test="settleRecordId != null">
        #{settleRecordId,jdbcType=BIGINT},
      </if>
      <if test="itemList != null">
        #{itemList,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neu.his.mbg.model.BmsInvoiceRecordExample" resultType="java.lang.Integer">
    select count(*) from bms_invoice_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update bms_invoice_record
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.invoiceNo != null">
        invoice_no = #{record.invoiceNo,jdbcType=BIGINT},
      </if>
      <if test="record.billId != null">
        bill_id = #{record.billId,jdbcType=BIGINT},
      </if>
      <if test="record.amount != null">
        amount = #{record.amount,jdbcType=DECIMAL},
      </if>
      <if test="record.freezeStatus != null">
        freeze_status = #{record.freezeStatus,jdbcType=INTEGER},
      </if>
      <if test="record.associateId != null">
        associate_id = #{record.associateId,jdbcType=BIGINT},
      </if>
      <if test="record.operatorId != null">
        operator_id = #{record.operatorId,jdbcType=BIGINT},
      </if>
      <if test="record.settlementCatId != null">
        settlement_cat_id = #{record.settlementCatId,jdbcType=BIGINT},
      </if>
      <if test="record.settleRecordId != null">
        settle_record_id = #{record.settleRecordId,jdbcType=BIGINT},
      </if>
      <if test="record.itemList != null">
        item_list = #{record.itemList,jdbcType=VARCHAR},
      </if>
      <if test="record.type != null">
        type = #{record.type,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update bms_invoice_record
    set id = #{record.id,jdbcType=BIGINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      invoice_no = #{record.invoiceNo,jdbcType=BIGINT},
      bill_id = #{record.billId,jdbcType=BIGINT},
      amount = #{record.amount,jdbcType=DECIMAL},
      freeze_status = #{record.freezeStatus,jdbcType=INTEGER},
      associate_id = #{record.associateId,jdbcType=BIGINT},
      operator_id = #{record.operatorId,jdbcType=BIGINT},
      settlement_cat_id = #{record.settlementCatId,jdbcType=BIGINT},
      settle_record_id = #{record.settleRecordId,jdbcType=BIGINT},
      item_list = #{record.itemList,jdbcType=VARCHAR},
      type = #{record.type,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neu.his.mbg.model.BmsInvoiceRecord">
    update bms_invoice_record
    <set>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceNo != null">
        invoice_no = #{invoiceNo,jdbcType=BIGINT},
      </if>
      <if test="billId != null">
        bill_id = #{billId,jdbcType=BIGINT},
      </if>
      <if test="amount != null">
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="freezeStatus != null">
        freeze_status = #{freezeStatus,jdbcType=INTEGER},
      </if>
      <if test="associateId != null">
        associate_id = #{associateId,jdbcType=BIGINT},
      </if>
      <if test="operatorId != null">
        operator_id = #{operatorId,jdbcType=BIGINT},
      </if>
      <if test="settlementCatId != null">
        settlement_cat_id = #{settlementCatId,jdbcType=BIGINT},
      </if>
      <if test="settleRecordId != null">
        settle_record_id = #{settleRecordId,jdbcType=BIGINT},
      </if>
      <if test="itemList != null">
        item_list = #{itemList,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neu.his.mbg.model.BmsInvoiceRecord">
    update bms_invoice_record
    set create_time = #{createTime,jdbcType=TIMESTAMP},
      invoice_no = #{invoiceNo,jdbcType=BIGINT},
      bill_id = #{billId,jdbcType=BIGINT},
      amount = #{amount,jdbcType=DECIMAL},
      freeze_status = #{freezeStatus,jdbcType=INTEGER},
      associate_id = #{associateId,jdbcType=BIGINT},
      operator_id = #{operatorId,jdbcType=BIGINT},
      settlement_cat_id = #{settlementCatId,jdbcType=BIGINT},
      settle_record_id = #{settleRecordId,jdbcType=BIGINT},
      item_list = #{itemList,jdbcType=VARCHAR},
      type = #{type,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>