<?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.neusoft.smart.pos.strategy.persistent.mapper.ShopOtherChargesConfigMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfig">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="bean_type_id" jdbcType="INTEGER" property="beanTypeId" />
    <result column="display_name" jdbcType="VARCHAR" property="displayName" />
    <result column="charge_category" jdbcType="VARCHAR" property="chargeCategory" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="org_id" jdbcType="INTEGER" property="orgId" />
    <result column="org_entity_table_name" jdbcType="VARCHAR" property="orgEntityTableName" />
    <result column="shop_id" jdbcType="INTEGER" property="shopId" />
    <result column="shop_entity_table_name" jdbcType="VARCHAR" property="shopEntityTableName" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="order_type" jdbcType="VARCHAR" property="orderType" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
    <result column="bean_parameter" jdbcType="VARCHAR" property="beanParameter" />
  </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, bean_type_id, display_name, charge_category, description, org_id, org_entity_table_name, 
    shop_id, shop_entity_table_name, created_at, order_type, created_by, updated_by, 
    updated_at, bean_parameter
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfigExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from shop_other_charges_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from shop_other_charges_config
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from shop_other_charges_config
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfigExample">
    delete from shop_other_charges_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfig" useGeneratedKeys="true">
    insert into shop_other_charges_config (bean_type_id, display_name, charge_category, 
      description, org_id, org_entity_table_name, 
      shop_id, shop_entity_table_name, created_at, 
      order_type, created_by, updated_by, 
      updated_at, bean_parameter)
    values (#{beanTypeId,jdbcType=INTEGER}, #{displayName,jdbcType=VARCHAR}, #{chargeCategory,jdbcType=VARCHAR}, 
      #{description,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, #{orgEntityTableName,jdbcType=VARCHAR}, 
      #{shopId,jdbcType=INTEGER}, #{shopEntityTableName,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{orderType,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, 
      #{updatedAt,jdbcType=TIMESTAMP}, #{beanParameter,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfig" useGeneratedKeys="true">
    insert into shop_other_charges_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="beanTypeId != null">
        bean_type_id,
      </if>
      <if test="displayName != null">
        display_name,
      </if>
      <if test="chargeCategory != null">
        charge_category,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
      <if test="orgEntityTableName != null">
        org_entity_table_name,
      </if>
      <if test="shopId != null">
        shop_id,
      </if>
      <if test="shopEntityTableName != null">
        shop_entity_table_name,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="orderType != null">
        order_type,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
      <if test="beanParameter != null">
        bean_parameter,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="beanTypeId != null">
        #{beanTypeId,jdbcType=INTEGER},
      </if>
      <if test="displayName != null">
        #{displayName,jdbcType=VARCHAR},
      </if>
      <if test="chargeCategory != null">
        #{chargeCategory,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=INTEGER},
      </if>
      <if test="orgEntityTableName != null">
        #{orgEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="shopId != null">
        #{shopId,jdbcType=INTEGER},
      </if>
      <if test="shopEntityTableName != null">
        #{shopEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="orderType != null">
        #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="beanParameter != null">
        #{beanParameter,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfigExample" resultType="java.lang.Integer">
    select count(*) from shop_other_charges_config
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update shop_other_charges_config
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.beanTypeId != null">
        bean_type_id = #{record.beanTypeId,jdbcType=INTEGER},
      </if>
      <if test="record.displayName != null">
        display_name = #{record.displayName,jdbcType=VARCHAR},
      </if>
      <if test="record.chargeCategory != null">
        charge_category = #{record.chargeCategory,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.orgId != null">
        org_id = #{record.orgId,jdbcType=INTEGER},
      </if>
      <if test="record.orgEntityTableName != null">
        org_entity_table_name = #{record.orgEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="record.shopId != null">
        shop_id = #{record.shopId,jdbcType=INTEGER},
      </if>
      <if test="record.shopEntityTableName != null">
        shop_entity_table_name = #{record.shopEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.orderType != null">
        order_type = #{record.orderType,jdbcType=VARCHAR},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedBy != null">
        updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedAt != null">
        updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.beanParameter != null">
        bean_parameter = #{record.beanParameter,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update shop_other_charges_config
    set id = #{record.id,jdbcType=INTEGER},
      bean_type_id = #{record.beanTypeId,jdbcType=INTEGER},
      display_name = #{record.displayName,jdbcType=VARCHAR},
      charge_category = #{record.chargeCategory,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=INTEGER},
      org_entity_table_name = #{record.orgEntityTableName,jdbcType=VARCHAR},
      shop_id = #{record.shopId,jdbcType=INTEGER},
      shop_entity_table_name = #{record.shopEntityTableName,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      order_type = #{record.orderType,jdbcType=VARCHAR},
      created_by = #{record.createdBy,jdbcType=VARCHAR},
      updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
      bean_parameter = #{record.beanParameter,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfig">
    update shop_other_charges_config
    <set>
      <if test="beanTypeId != null">
        bean_type_id = #{beanTypeId,jdbcType=INTEGER},
      </if>
      <if test="displayName != null">
        display_name = #{displayName,jdbcType=VARCHAR},
      </if>
      <if test="chargeCategory != null">
        charge_category = #{chargeCategory,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=INTEGER},
      </if>
      <if test="orgEntityTableName != null">
        org_entity_table_name = #{orgEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="shopId != null">
        shop_id = #{shopId,jdbcType=INTEGER},
      </if>
      <if test="shopEntityTableName != null">
        shop_entity_table_name = #{shopEntityTableName,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="orderType != null">
        order_type = #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="beanParameter != null">
        bean_parameter = #{beanParameter,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.ShopOtherChargesConfig">
    update shop_other_charges_config
    set bean_type_id = #{beanTypeId,jdbcType=INTEGER},
      display_name = #{displayName,jdbcType=VARCHAR},
      charge_category = #{chargeCategory,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      org_id = #{orgId,jdbcType=INTEGER},
      org_entity_table_name = #{orgEntityTableName,jdbcType=VARCHAR},
      shop_id = #{shopId,jdbcType=INTEGER},
      shop_entity_table_name = #{shopEntityTableName,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      order_type = #{orderType,jdbcType=VARCHAR},
      created_by = #{createdBy,jdbcType=VARCHAR},
      updated_by = #{updatedBy,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      bean_parameter = #{beanParameter,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into shop_other_charges_config  (bean_type_id, display_name, charge_category, 
        description, org_id, org_entity_table_name, 
        shop_id, shop_entity_table_name, created_at, 
        order_type, created_by, updated_by, 
        updated_at, bean_parameter)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.beanTypeId,jdbcType=INTEGER}, #{item.displayName,jdbcType=VARCHAR}, #{item.chargeCategory,jdbcType=VARCHAR}, 
        #{item.description,jdbcType=VARCHAR}, #{item.orgId,jdbcType=INTEGER}, #{item.orgEntityTableName,jdbcType=VARCHAR}, 
        #{item.shopId,jdbcType=INTEGER}, #{item.shopEntityTableName,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, 
        #{item.orderType,jdbcType=VARCHAR}, #{item.createdBy,jdbcType=VARCHAR}, #{item.updatedBy,jdbcType=VARCHAR}, 
        #{item.updatedAt,jdbcType=TIMESTAMP}, #{item.beanParameter,jdbcType=VARCHAR})
      </foreach>
    </if>
  </insert>
</mapper>