<?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.unified.UnifiedOrderProfitMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="channel_id" jdbcType="BIGINT" property="channelId" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="virt_id" jdbcType="BIGINT" property="virtId" />
    <result column="business_code" jdbcType="VARCHAR" property="businessCode" />
    <result column="profit_amount" jdbcType="DECIMAL" property="profitAmount" />
    <result column="proportion" jdbcType="DECIMAL" property="proportion" />
    <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
    <result column="order_sn_return" jdbcType="VARCHAR" property="orderSnReturn" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <result column="snapshot_order" jdbcType="LONGVARCHAR" property="snapshotOrder" />
    <result column="snapshot_profit" jdbcType="LONGVARCHAR" property="snapshotProfit" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <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">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <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">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    id, channel_id, org_id, virt_id, business_code, profit_amount, proportion, order_sn, 
    order_sn_return, create_time, update_time
  </sql>
  <sql id="Blob_Column_List">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    snapshot_order, snapshot_profit
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfitExample" resultMap="ResultMapWithBLOBs">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from unified_order_profit
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfitExample" resultMap="BaseResultMap">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from unified_order_profit
    <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="ResultMapWithBLOBs">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from unified_order_profit
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    delete from unified_order_profit
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfitExample">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    delete from unified_order_profit
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_order_profit (channel_id, org_id, virt_id, 
      business_code, profit_amount, proportion, 
      order_sn, order_sn_return, create_time, 
      update_time, snapshot_order, snapshot_profit
      )
    values (#{channelId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT}, #{virtId,jdbcType=BIGINT}, 
      #{businessCode,jdbcType=VARCHAR}, #{profitAmount,jdbcType=DECIMAL}, #{proportion,jdbcType=DECIMAL}, 
      #{orderSn,jdbcType=VARCHAR}, #{orderSnReturn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{snapshotOrder,jdbcType=LONGVARCHAR}, #{snapshotProfit,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_order_profit
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="channelId != null">
        channel_id,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
      <if test="virtId != null">
        virt_id,
      </if>
      <if test="businessCode != null">
        business_code,
      </if>
      <if test="profitAmount != null">
        profit_amount,
      </if>
      <if test="proportion != null">
        proportion,
      </if>
      <if test="orderSn != null">
        order_sn,
      </if>
      <if test="orderSnReturn != null">
        order_sn_return,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="snapshotOrder != null">
        snapshot_order,
      </if>
      <if test="snapshotProfit != null">
        snapshot_profit,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="channelId != null">
        #{channelId,jdbcType=BIGINT},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=BIGINT},
      </if>
      <if test="virtId != null">
        #{virtId,jdbcType=BIGINT},
      </if>
      <if test="businessCode != null">
        #{businessCode,jdbcType=VARCHAR},
      </if>
      <if test="profitAmount != null">
        #{profitAmount,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        #{proportion,jdbcType=DECIMAL},
      </if>
      <if test="orderSn != null">
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="orderSnReturn != null">
        #{orderSnReturn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="snapshotOrder != null">
        #{snapshotOrder,jdbcType=LONGVARCHAR},
      </if>
      <if test="snapshotProfit != null">
        #{snapshotProfit,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfitExample" resultType="java.lang.Long">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    select count(*) from unified_order_profit
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.channelId != null">
        channel_id = #{record.channelId,jdbcType=BIGINT},
      </if>
      <if test="record.orgId != null">
        org_id = #{record.orgId,jdbcType=BIGINT},
      </if>
      <if test="record.virtId != null">
        virt_id = #{record.virtId,jdbcType=BIGINT},
      </if>
      <if test="record.businessCode != null">
        business_code = #{record.businessCode,jdbcType=VARCHAR},
      </if>
      <if test="record.profitAmount != null">
        profit_amount = #{record.profitAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.proportion != null">
        proportion = #{record.proportion,jdbcType=DECIMAL},
      </if>
      <if test="record.orderSn != null">
        order_sn = #{record.orderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.orderSnReturn != null">
        order_sn_return = #{record.orderSnReturn,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.snapshotOrder != null">
        snapshot_order = #{record.snapshotOrder,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.snapshotProfit != null">
        snapshot_profit = #{record.snapshotProfit,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    set id = #{record.id,jdbcType=BIGINT},
      channel_id = #{record.channelId,jdbcType=BIGINT},
      org_id = #{record.orgId,jdbcType=BIGINT},
      virt_id = #{record.virtId,jdbcType=BIGINT},
      business_code = #{record.businessCode,jdbcType=VARCHAR},
      profit_amount = #{record.profitAmount,jdbcType=DECIMAL},
      proportion = #{record.proportion,jdbcType=DECIMAL},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      order_sn_return = #{record.orderSnReturn,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      snapshot_order = #{record.snapshotOrder,jdbcType=LONGVARCHAR},
      snapshot_profit = #{record.snapshotProfit,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    set id = #{record.id,jdbcType=BIGINT},
      channel_id = #{record.channelId,jdbcType=BIGINT},
      org_id = #{record.orgId,jdbcType=BIGINT},
      virt_id = #{record.virtId,jdbcType=BIGINT},
      business_code = #{record.businessCode,jdbcType=VARCHAR},
      profit_amount = #{record.profitAmount,jdbcType=DECIMAL},
      proportion = #{record.proportion,jdbcType=DECIMAL},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      order_sn_return = #{record.orderSnReturn,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    <set>
      <if test="channelId != null">
        channel_id = #{channelId,jdbcType=BIGINT},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=BIGINT},
      </if>
      <if test="virtId != null">
        virt_id = #{virtId,jdbcType=BIGINT},
      </if>
      <if test="businessCode != null">
        business_code = #{businessCode,jdbcType=VARCHAR},
      </if>
      <if test="profitAmount != null">
        profit_amount = #{profitAmount,jdbcType=DECIMAL},
      </if>
      <if test="proportion != null">
        proportion = #{proportion,jdbcType=DECIMAL},
      </if>
      <if test="orderSn != null">
        order_sn = #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="orderSnReturn != null">
        order_sn_return = #{orderSnReturn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="snapshotOrder != null">
        snapshot_order = #{snapshotOrder,jdbcType=LONGVARCHAR},
      </if>
      <if test="snapshotProfit != null">
        snapshot_profit = #{snapshotProfit,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    set channel_id = #{channelId,jdbcType=BIGINT},
      org_id = #{orgId,jdbcType=BIGINT},
      virt_id = #{virtId,jdbcType=BIGINT},
      business_code = #{businessCode,jdbcType=VARCHAR},
      profit_amount = #{profitAmount,jdbcType=DECIMAL},
      proportion = #{proportion,jdbcType=DECIMAL},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      order_sn_return = #{orderSnReturn,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      snapshot_order = #{snapshotOrder,jdbcType=LONGVARCHAR},
      snapshot_profit = #{snapshotProfit,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.unified.UnifiedOrderProfit">
    <!--


      This element was generated on Thu May 28 21:11:33 CST 2020.
    -->
    update unified_order_profit
    set channel_id = #{channelId,jdbcType=BIGINT},
      org_id = #{orgId,jdbcType=BIGINT},
      virt_id = #{virtId,jdbcType=BIGINT},
      business_code = #{businessCode,jdbcType=VARCHAR},
      profit_amount = #{profitAmount,jdbcType=DECIMAL},
      proportion = #{proportion,jdbcType=DECIMAL},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      order_sn_return = #{orderSnReturn,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>