<?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.exchangeStrategy.persistent.mapper.ExchangeStrategyTypeDictMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDict">
    <id column="strategy_type_id" jdbcType="INTEGER" property="strategyTypeId" />
    <result column="strategy_name" jdbcType="VARCHAR" property="strategyName" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="strategy_bean_name" jdbcType="VARCHAR" property="strategyBeanName" />
    <result column="param_list" jdbcType="VARCHAR" property="paramList" />
  </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">
    strategy_type_id, strategy_name, description, strategy_bean_name, param_list
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDictExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from exchange_strategy_type_dict
    <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 exchange_strategy_type_dict
    where strategy_type_id = #{strategyTypeId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from exchange_strategy_type_dict
    where strategy_type_id = #{strategyTypeId,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDictExample">
    delete from exchange_strategy_type_dict
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="strategy_type_id" keyProperty="strategyTypeId" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDict" useGeneratedKeys="true">
    insert into exchange_strategy_type_dict (strategy_name, description, strategy_bean_name, 
      param_list)
    values (#{strategyName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{strategyBeanName,jdbcType=VARCHAR}, 
      #{paramList,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="strategy_type_id" keyProperty="strategyTypeId" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDict" useGeneratedKeys="true">
    insert into exchange_strategy_type_dict
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="strategyName != null">
        strategy_name,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="strategyBeanName != null">
        strategy_bean_name,
      </if>
      <if test="paramList != null">
        param_list,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="strategyName != null">
        #{strategyName,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="strategyBeanName != null">
        #{strategyBeanName,jdbcType=VARCHAR},
      </if>
      <if test="paramList != null">
        #{paramList,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDictExample" resultType="java.lang.Integer">
    select count(*) from exchange_strategy_type_dict
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update exchange_strategy_type_dict
    <set>
      <if test="record.strategyTypeId != null">
        strategy_type_id = #{record.strategyTypeId,jdbcType=INTEGER},
      </if>
      <if test="record.strategyName != null">
        strategy_name = #{record.strategyName,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.strategyBeanName != null">
        strategy_bean_name = #{record.strategyBeanName,jdbcType=VARCHAR},
      </if>
      <if test="record.paramList != null">
        param_list = #{record.paramList,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update exchange_strategy_type_dict
    set strategy_type_id = #{record.strategyTypeId,jdbcType=INTEGER},
      strategy_name = #{record.strategyName,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      strategy_bean_name = #{record.strategyBeanName,jdbcType=VARCHAR},
      param_list = #{record.paramList,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDict">
    update exchange_strategy_type_dict
    <set>
      <if test="strategyName != null">
        strategy_name = #{strategyName,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="strategyBeanName != null">
        strategy_bean_name = #{strategyBeanName,jdbcType=VARCHAR},
      </if>
      <if test="paramList != null">
        param_list = #{paramList,jdbcType=VARCHAR},
      </if>
    </set>
    where strategy_type_id = #{strategyTypeId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.exchangeStrategy.persistent.domain.ExchangeStrategyTypeDict">
    update exchange_strategy_type_dict
    set strategy_name = #{strategyName,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      strategy_bean_name = #{strategyBeanName,jdbcType=VARCHAR},
      param_list = #{paramList,jdbcType=VARCHAR}
    where strategy_type_id = #{strategyTypeId,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into exchange_strategy_type_dict  (strategy_name, description, strategy_bean_name, 
        param_list)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.strategyName,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR}, #{item.strategyBeanName,jdbcType=VARCHAR}, 
        #{item.paramList,jdbcType=VARCHAR})
      </foreach>
    </if>
  </insert>
</mapper>