<?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.settlement.UnifiedSettlementProgrammeAmountRuleMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRule">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="programme_id" jdbcType="BIGINT" property="programmeId" />
    <result column="display" jdbcType="TINYINT" property="display" />
    <result column="operator_ids" jdbcType="VARCHAR" property="operatorIds" />
    <result column="operator_names" jdbcType="VARCHAR" property="operatorNames" />
    <result column="org_ids" jdbcType="VARCHAR" property="orgIds" />
    <result column="org_names" jdbcType="VARCHAR" property="orgNames" />
    <result column="order_type_ids" jdbcType="VARCHAR" property="orderTypeIds" />
    <result column="order_type_names" jdbcType="VARCHAR" property="orderTypeNames" />
    <result column="amount_rule" jdbcType="TINYINT" property="amountRule" />
    <result column="amount_rate" jdbcType="DECIMAL" property="amountRate" />
    <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="deleted" jdbcType="TINYINT" property="deleted" />
  </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, programme_id, display, operator_ids, operator_names, org_ids, org_names, order_type_ids, 
    order_type_names, amount_rule, amount_rate, create_time, create_user_id, update_time, 
    update_user_id, deleted
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRuleExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from unified_settlement_programme_amount_rule
    <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_settlement_programme_amount_rule
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from unified_settlement_programme_amount_rule
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRuleExample">
    delete from unified_settlement_programme_amount_rule
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRule">
    insert into unified_settlement_programme_amount_rule (id, programme_id, display, 
      operator_ids, operator_names, org_ids, 
      org_names, order_type_ids, order_type_names, 
      amount_rule, amount_rate, create_time, 
      create_user_id, update_time, update_user_id, 
      deleted)
    values (#{id,jdbcType=BIGINT}, #{programmeId,jdbcType=BIGINT}, #{display,jdbcType=TINYINT}, 
      #{operatorIds,jdbcType=VARCHAR}, #{operatorNames,jdbcType=VARCHAR}, #{orgIds,jdbcType=VARCHAR}, 
      #{orgNames,jdbcType=VARCHAR}, #{orderTypeIds,jdbcType=VARCHAR}, #{orderTypeNames,jdbcType=VARCHAR}, 
      #{amountRule,jdbcType=TINYINT}, #{amountRate,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, 
      #{deleted,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRule">
    insert into unified_settlement_programme_amount_rule
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="programmeId != null">
        programme_id,
      </if>
      <if test="display != null">
        display,
      </if>
      <if test="operatorIds != null">
        operator_ids,
      </if>
      <if test="operatorNames != null">
        operator_names,
      </if>
      <if test="orgIds != null">
        org_ids,
      </if>
      <if test="orgNames != null">
        org_names,
      </if>
      <if test="orderTypeIds != null">
        order_type_ids,
      </if>
      <if test="orderTypeNames != null">
        order_type_names,
      </if>
      <if test="amountRule != null">
        amount_rule,
      </if>
      <if test="amountRate != null">
        amount_rate,
      </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="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="programmeId != null">
        #{programmeId,jdbcType=BIGINT},
      </if>
      <if test="display != null">
        #{display,jdbcType=TINYINT},
      </if>
      <if test="operatorIds != null">
        #{operatorIds,jdbcType=VARCHAR},
      </if>
      <if test="operatorNames != null">
        #{operatorNames,jdbcType=VARCHAR},
      </if>
      <if test="orgIds != null">
        #{orgIds,jdbcType=VARCHAR},
      </if>
      <if test="orgNames != null">
        #{orgNames,jdbcType=VARCHAR},
      </if>
      <if test="orderTypeIds != null">
        #{orderTypeIds,jdbcType=VARCHAR},
      </if>
      <if test="orderTypeNames != null">
        #{orderTypeNames,jdbcType=VARCHAR},
      </if>
      <if test="amountRule != null">
        #{amountRule,jdbcType=TINYINT},
      </if>
      <if test="amountRate != null">
        #{amountRate,jdbcType=DECIMAL},
      </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="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRuleExample" resultType="java.lang.Long">
    select count(*) from unified_settlement_programme_amount_rule
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update unified_settlement_programme_amount_rule
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.programmeId != null">
        programme_id = #{record.programmeId,jdbcType=BIGINT},
      </if>
      <if test="record.display != null">
        display = #{record.display,jdbcType=TINYINT},
      </if>
      <if test="record.operatorIds != null">
        operator_ids = #{record.operatorIds,jdbcType=VARCHAR},
      </if>
      <if test="record.operatorNames != null">
        operator_names = #{record.operatorNames,jdbcType=VARCHAR},
      </if>
      <if test="record.orgIds != null">
        org_ids = #{record.orgIds,jdbcType=VARCHAR},
      </if>
      <if test="record.orgNames != null">
        org_names = #{record.orgNames,jdbcType=VARCHAR},
      </if>
      <if test="record.orderTypeIds != null">
        order_type_ids = #{record.orderTypeIds,jdbcType=VARCHAR},
      </if>
      <if test="record.orderTypeNames != null">
        order_type_names = #{record.orderTypeNames,jdbcType=VARCHAR},
      </if>
      <if test="record.amountRule != null">
        amount_rule = #{record.amountRule,jdbcType=TINYINT},
      </if>
      <if test="record.amountRate != null">
        amount_rate = #{record.amountRate,jdbcType=DECIMAL},
      </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.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update unified_settlement_programme_amount_rule
    set id = #{record.id,jdbcType=BIGINT},
      programme_id = #{record.programmeId,jdbcType=BIGINT},
      display = #{record.display,jdbcType=TINYINT},
      operator_ids = #{record.operatorIds,jdbcType=VARCHAR},
      operator_names = #{record.operatorNames,jdbcType=VARCHAR},
      org_ids = #{record.orgIds,jdbcType=VARCHAR},
      org_names = #{record.orgNames,jdbcType=VARCHAR},
      order_type_ids = #{record.orderTypeIds,jdbcType=VARCHAR},
      order_type_names = #{record.orderTypeNames,jdbcType=VARCHAR},
      amount_rule = #{record.amountRule,jdbcType=TINYINT},
      amount_rate = #{record.amountRate,jdbcType=DECIMAL},
      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},
      deleted = #{record.deleted,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRule">
    update unified_settlement_programme_amount_rule
    <set>
      <if test="programmeId != null">
        programme_id = #{programmeId,jdbcType=BIGINT},
      </if>
      <if test="display != null">
        display = #{display,jdbcType=TINYINT},
      </if>
      <if test="operatorIds != null">
        operator_ids = #{operatorIds,jdbcType=VARCHAR},
      </if>
      <if test="operatorNames != null">
        operator_names = #{operatorNames,jdbcType=VARCHAR},
      </if>
      <if test="orgIds != null">
        org_ids = #{orgIds,jdbcType=VARCHAR},
      </if>
      <if test="orgNames != null">
        org_names = #{orgNames,jdbcType=VARCHAR},
      </if>
      <if test="orderTypeIds != null">
        order_type_ids = #{orderTypeIds,jdbcType=VARCHAR},
      </if>
      <if test="orderTypeNames != null">
        order_type_names = #{orderTypeNames,jdbcType=VARCHAR},
      </if>
      <if test="amountRule != null">
        amount_rule = #{amountRule,jdbcType=TINYINT},
      </if>
      <if test="amountRate != null">
        amount_rate = #{amountRate,jdbcType=DECIMAL},
      </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="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeAmountRule">
    update unified_settlement_programme_amount_rule
    set programme_id = #{programmeId,jdbcType=BIGINT},
      display = #{display,jdbcType=TINYINT},
      operator_ids = #{operatorIds,jdbcType=VARCHAR},
      operator_names = #{operatorNames,jdbcType=VARCHAR},
      org_ids = #{orgIds,jdbcType=VARCHAR},
      org_names = #{orgNames,jdbcType=VARCHAR},
      order_type_ids = #{orderTypeIds,jdbcType=VARCHAR},
      order_type_names = #{orderTypeNames,jdbcType=VARCHAR},
      amount_rule = #{amountRule,jdbcType=TINYINT},
      amount_rate = #{amountRate,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>