<?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.UnifiedSettlementProgrammeMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="customer_id" jdbcType="BIGINT" property="customerId" />
    <result column="type" jdbcType="TINYINT" property="type" />
    <result column="programme_name" jdbcType="VARCHAR" property="programmeName" />
    <result column="programme_no" jdbcType="VARCHAR" property="programmeNo" />
    <result column="settlement_scope" jdbcType="TINYINT" property="settlementScope" />
    <result column="settlement_rule" jdbcType="TINYINT" property="settlementRule" />
    <result column="bill_name" jdbcType="VARCHAR" property="billName" />
    <result column="supname_display_rule" jdbcType="TINYINT" property="supnameDisplayRule" />
    <result column="custom_supplier_name" jdbcType="VARCHAR" property="customSupplierName" />
    <result column="is_default" jdbcType="TINYINT" property="isDefault" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <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" />
    <result column="enabled" jdbcType="TINYINT" property="enabled" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
    <result column="export_field" jdbcType="LONGVARCHAR" property="exportField" />
  </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, customer_id, type, programme_name, programme_no, settlement_scope, settlement_rule, 
    bill_name, supname_display_rule, custom_supplier_name, is_default, remark, create_time, 
    create_user_id, update_time, update_user_id, deleted, enabled
  </sql>
  <sql id="Blob_Column_List">
    export_field
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from unified_settlement_programme
    <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.settlement.UnifiedSettlementProgrammeExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from unified_settlement_programme
    <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">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from unified_settlement_programme
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from unified_settlement_programme
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeExample">
    delete from unified_settlement_programme
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
    insert into unified_settlement_programme (id, customer_id, type, 
      programme_name, programme_no, settlement_scope, 
      settlement_rule, bill_name, supname_display_rule, 
      custom_supplier_name, is_default, remark, 
      create_time, create_user_id, update_time, 
      update_user_id, deleted, enabled, 
      export_field)
    values (#{id,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, 
      #{programmeName,jdbcType=VARCHAR}, #{programmeNo,jdbcType=VARCHAR}, #{settlementScope,jdbcType=TINYINT}, 
      #{settlementRule,jdbcType=TINYINT}, #{billName,jdbcType=VARCHAR}, #{supnameDisplayRule,jdbcType=TINYINT}, 
      #{customSupplierName,jdbcType=VARCHAR}, #{isDefault,jdbcType=TINYINT}, #{remark,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{updateUserId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}, #{enabled,jdbcType=TINYINT}, 
      #{exportField,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme" useGeneratedKeys="true" keyProperty="id">
    insert into unified_settlement_programme
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="programmeName != null">
        programme_name,
      </if>
      <if test="programmeNo != null">
        programme_no,
      </if>
      <if test="settlementScope != null">
        settlement_scope,
      </if>
      <if test="settlementRule != null">
        settlement_rule,
      </if>
      <if test="billName != null">
        bill_name,
      </if>
      <if test="supnameDisplayRule != null">
        supname_display_rule,
      </if>
      <if test="customSupplierName != null">
        custom_supplier_name,
      </if>
      <if test="isDefault != null">
        is_default,
      </if>
      <if test="remark != null">
        remark,
      </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>
      <if test="enabled != null">
        enabled,
      </if>
      <if test="exportField != null">
        export_field,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="customerId != null">
        #{customerId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        #{type,jdbcType=TINYINT},
      </if>
      <if test="programmeName != null">
        #{programmeName,jdbcType=VARCHAR},
      </if>
      <if test="programmeNo != null">
        #{programmeNo,jdbcType=VARCHAR},
      </if>
      <if test="settlementScope != null">
        #{settlementScope,jdbcType=TINYINT},
      </if>
      <if test="settlementRule != null">
        #{settlementRule,jdbcType=TINYINT},
      </if>
      <if test="billName != null">
        #{billName,jdbcType=VARCHAR},
      </if>
      <if test="supnameDisplayRule != null">
        #{supnameDisplayRule,jdbcType=TINYINT},
      </if>
      <if test="customSupplierName != null">
        #{customSupplierName,jdbcType=VARCHAR},
      </if>
      <if test="isDefault != null">
        #{isDefault,jdbcType=TINYINT},
      </if>
      <if test="remark != null">
        #{remark,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="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=TINYINT},
      </if>
      <if test="exportField != null">
        #{exportField,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeExample" resultType="java.lang.Long">
    select count(*) from unified_settlement_programme
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update unified_settlement_programme
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.customerId != null">
        customer_id = #{record.customerId,jdbcType=BIGINT},
      </if>
      <if test="record.type != null">
        type = #{record.type,jdbcType=TINYINT},
      </if>
      <if test="record.programmeName != null">
        programme_name = #{record.programmeName,jdbcType=VARCHAR},
      </if>
      <if test="record.programmeNo != null">
        programme_no = #{record.programmeNo,jdbcType=VARCHAR},
      </if>
      <if test="record.settlementScope != null">
        settlement_scope = #{record.settlementScope,jdbcType=TINYINT},
      </if>
      <if test="record.settlementRule != null">
        settlement_rule = #{record.settlementRule,jdbcType=TINYINT},
      </if>
      <if test="record.billName != null">
        bill_name = #{record.billName,jdbcType=VARCHAR},
      </if>
      <if test="record.supnameDisplayRule != null">
        supname_display_rule = #{record.supnameDisplayRule,jdbcType=TINYINT},
      </if>
      <if test="record.customSupplierName != null">
        custom_supplier_name = #{record.customSupplierName,jdbcType=VARCHAR},
      </if>
      <if test="record.isDefault != null">
        is_default = #{record.isDefault,jdbcType=TINYINT},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,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.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=TINYINT},
      </if>
      <if test="record.exportField != null">
        export_field = #{record.exportField,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update unified_settlement_programme
    set id = #{record.id,jdbcType=BIGINT},
      customer_id = #{record.customerId,jdbcType=BIGINT},
      type = #{record.type,jdbcType=TINYINT},
      programme_name = #{record.programmeName,jdbcType=VARCHAR},
      programme_no = #{record.programmeNo,jdbcType=VARCHAR},
      settlement_scope = #{record.settlementScope,jdbcType=TINYINT},
      settlement_rule = #{record.settlementRule,jdbcType=TINYINT},
      bill_name = #{record.billName,jdbcType=VARCHAR},
      supname_display_rule = #{record.supnameDisplayRule,jdbcType=TINYINT},
      custom_supplier_name = #{record.customSupplierName,jdbcType=VARCHAR},
      is_default = #{record.isDefault,jdbcType=TINYINT},
      remark = #{record.remark,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},
      deleted = #{record.deleted,jdbcType=TINYINT},
      enabled = #{record.enabled,jdbcType=TINYINT},
      export_field = #{record.exportField,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update unified_settlement_programme
    set id = #{record.id,jdbcType=BIGINT},
      customer_id = #{record.customerId,jdbcType=BIGINT},
      type = #{record.type,jdbcType=TINYINT},
      programme_name = #{record.programmeName,jdbcType=VARCHAR},
      programme_no = #{record.programmeNo,jdbcType=VARCHAR},
      settlement_scope = #{record.settlementScope,jdbcType=TINYINT},
      settlement_rule = #{record.settlementRule,jdbcType=TINYINT},
      bill_name = #{record.billName,jdbcType=VARCHAR},
      supname_display_rule = #{record.supnameDisplayRule,jdbcType=TINYINT},
      custom_supplier_name = #{record.customSupplierName,jdbcType=VARCHAR},
      is_default = #{record.isDefault,jdbcType=TINYINT},
      remark = #{record.remark,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},
      deleted = #{record.deleted,jdbcType=TINYINT},
      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.unified.settlement.UnifiedSettlementProgramme">
    update unified_settlement_programme
    <set>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=TINYINT},
      </if>
      <if test="programmeName != null">
        programme_name = #{programmeName,jdbcType=VARCHAR},
      </if>
      <if test="programmeNo != null">
        programme_no = #{programmeNo,jdbcType=VARCHAR},
      </if>
      <if test="settlementScope != null">
        settlement_scope = #{settlementScope,jdbcType=TINYINT},
      </if>
      <if test="settlementRule != null">
        settlement_rule = #{settlementRule,jdbcType=TINYINT},
      </if>
      <if test="billName != null">
        bill_name = #{billName,jdbcType=VARCHAR},
      </if>
      <if test="supnameDisplayRule != null">
        supname_display_rule = #{supnameDisplayRule,jdbcType=TINYINT},
      </if>
      <if test="customSupplierName != null">
        custom_supplier_name = #{customSupplierName,jdbcType=VARCHAR},
      </if>
      <if test="isDefault != null">
        is_default = #{isDefault,jdbcType=TINYINT},
      </if>
      <if test="remark != null">
        remark = #{remark,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="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=TINYINT},
      </if>
      <if test="exportField != null">
        export_field = #{exportField,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
    update unified_settlement_programme
    set customer_id = #{customerId,jdbcType=BIGINT},
      type = #{type,jdbcType=TINYINT},
      programme_name = #{programmeName,jdbcType=VARCHAR},
      programme_no = #{programmeNo,jdbcType=VARCHAR},
      settlement_scope = #{settlementScope,jdbcType=TINYINT},
      settlement_rule = #{settlementRule,jdbcType=TINYINT},
      bill_name = #{billName,jdbcType=VARCHAR},
      supname_display_rule = #{supnameDisplayRule,jdbcType=TINYINT},
      custom_supplier_name = #{customSupplierName,jdbcType=VARCHAR},
      is_default = #{isDefault,jdbcType=TINYINT},
      remark = #{remark,jdbcType=VARCHAR},
      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},
      enabled = #{enabled,jdbcType=TINYINT},
      export_field = #{exportField,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
    update unified_settlement_programme
    set customer_id = #{customerId,jdbcType=BIGINT},
      type = #{type,jdbcType=TINYINT},
      programme_name = #{programmeName,jdbcType=VARCHAR},
      programme_no = #{programmeNo,jdbcType=VARCHAR},
      settlement_scope = #{settlementScope,jdbcType=TINYINT},
      settlement_rule = #{settlementRule,jdbcType=TINYINT},
      bill_name = #{billName,jdbcType=VARCHAR},
      supname_display_rule = #{supnameDisplayRule,jdbcType=TINYINT},
      custom_supplier_name = #{customSupplierName,jdbcType=VARCHAR},
      is_default = #{isDefault,jdbcType=TINYINT},
      remark = #{remark,jdbcType=VARCHAR},
      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},
      enabled = #{enabled,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>