<?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.UnifiedSupplierCostConfigMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfig">

    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="sale_id" jdbcType="BIGINT" property="saleId" />
    <result column="sale_name" jdbcType="VARCHAR" property="saleName" />
    <result column="return_point" jdbcType="DECIMAL" property="returnPoint" />
    <result column="return_point_future" jdbcType="DECIMAL" property="returnPointFuture" />
    <result column="future_date" jdbcType="TIMESTAMP" property="futureDate" />
    <result column="param1" jdbcType="VARCHAR" property="param1" />
    <result column="param2" jdbcType="VARCHAR" property="param2" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="update_user_id" jdbcType="BIGINT" property="updateUserId" />
    <result column="enabled" jdbcType="TINYINT" property="enabled" />
  </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, sale_id, sale_name, return_point, return_point_future, future_date, param1, param2, 
    create_time, create_user_id, update_time, update_user_id, enabled
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfigExample" resultMap="BaseResultMap">

    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from unified_supplier_cost_config
    <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 unified_supplier_cost_config
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

    delete from unified_supplier_cost_config
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfigExample">

    delete from unified_supplier_cost_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfig">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_supplier_cost_config (sale_id, sale_name, return_point, 
      return_point_future, future_date, param1, 
      param2, create_time, create_user_id, 
      update_time, update_user_id, enabled
      )
    values (#{saleId,jdbcType=BIGINT}, #{saleName,jdbcType=VARCHAR}, #{returnPoint,jdbcType=DECIMAL}, 
      #{returnPointFuture,jdbcType=DECIMAL}, #{futureDate,jdbcType=TIMESTAMP}, #{param1,jdbcType=VARCHAR}, 
      #{param2,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, #{enabled,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfig">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into unified_supplier_cost_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="saleId != null">
        sale_id,
      </if>
      <if test="saleName != null">
        sale_name,
      </if>
      <if test="returnPoint != null">
        return_point,
      </if>
      <if test="returnPointFuture != null">
        return_point_future,
      </if>
      <if test="futureDate != null">
        future_date,
      </if>
      <if test="param1 != null">
        param1,
      </if>
      <if test="param2 != null">
        param2,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="updateUserId != null">
        update_user_id,
      </if>
      <if test="enabled != null">
        enabled,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="saleId != null">
        #{saleId,jdbcType=BIGINT},
      </if>
      <if test="saleName != null">
        #{saleName,jdbcType=VARCHAR},
      </if>
      <if test="returnPoint != null">
        #{returnPoint,jdbcType=DECIMAL},
      </if>
      <if test="returnPointFuture != null">
        #{returnPointFuture,jdbcType=DECIMAL},
      </if>
      <if test="futureDate != null">
        #{futureDate,jdbcType=TIMESTAMP},
      </if>
      <if test="param1 != null">
        #{param1,jdbcType=VARCHAR},
      </if>
      <if test="param2 != null">
        #{param2,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfigExample" resultType="java.lang.Long">

    select count(*) from unified_supplier_cost_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">

    update unified_supplier_cost_config
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.saleId != null">
        sale_id = #{record.saleId,jdbcType=BIGINT},
      </if>
      <if test="record.saleName != null">
        sale_name = #{record.saleName,jdbcType=VARCHAR},
      </if>
      <if test="record.returnPoint != null">
        return_point = #{record.returnPoint,jdbcType=DECIMAL},
      </if>
      <if test="record.returnPointFuture != null">
        return_point_future = #{record.returnPointFuture,jdbcType=DECIMAL},
      </if>
      <if test="record.futureDate != null">
        future_date = #{record.futureDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.param1 != null">
        param1 = #{record.param1,jdbcType=VARCHAR},
      </if>
      <if test="record.param2 != null">
        param2 = #{record.param2,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserId != null">
        update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">

    update unified_supplier_cost_config
    set id = #{record.id,jdbcType=BIGINT},
      sale_id = #{record.saleId,jdbcType=BIGINT},
      sale_name = #{record.saleName,jdbcType=VARCHAR},
      return_point = #{record.returnPoint,jdbcType=DECIMAL},
      return_point_future = #{record.returnPointFuture,jdbcType=DECIMAL},
      future_date = #{record.futureDate,jdbcType=TIMESTAMP},
      param1 = #{record.param1,jdbcType=VARCHAR},
      param2 = #{record.param2,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user_id = #{record.createUserId,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      enabled = #{record.enabled,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfig">

    update unified_supplier_cost_config
    <set>
      <if test="saleId != null">
        sale_id = #{saleId,jdbcType=BIGINT},
      </if>
      <if test="saleName != null">
        sale_name = #{saleName,jdbcType=VARCHAR},
      </if>
      <if test="returnPoint != null">
        return_point = #{returnPoint,jdbcType=DECIMAL},
      </if>
      <if test="returnPointFuture != null">
        return_point_future = #{returnPointFuture,jdbcType=DECIMAL},
      </if>
      <if test="futureDate != null">
        future_date = #{futureDate,jdbcType=TIMESTAMP},
      </if>
      <if test="param1 != null">
        param1 = #{param1,jdbcType=VARCHAR},
      </if>
      <if test="param2 != null">
        param2 = #{param2,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        update_user_id = #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.organisation.UnifiedSupplierCostConfig">

    update unified_supplier_cost_config
    set sale_id = #{saleId,jdbcType=BIGINT},
      sale_name = #{saleName,jdbcType=VARCHAR},
      return_point = #{returnPoint,jdbcType=DECIMAL},
      return_point_future = #{returnPointFuture,jdbcType=DECIMAL},
      future_date = #{futureDate,jdbcType=TIMESTAMP},
      param1 = #{param1,jdbcType=VARCHAR},
      param2 = #{param2,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT},
      enabled = #{enabled,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>