<?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.BeanTypeDictMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDict">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="bean_type" jdbcType="VARCHAR" property="beanType" />
    <result column="bean_name" jdbcType="VARCHAR" property="beanName" />
    <result column="bean_display_name" jdbcType="VARCHAR" property="beanDisplayName" />
    <result column="bean_description" jdbcType="VARCHAR" property="beanDescription" />
    <result column="bean_parameter_template" jdbcType="VARCHAR" property="beanParameterTemplate" />
  </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, bean_name, bean_display_name, bean_description, bean_parameter_template
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDictExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from bean_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 bean_type_dict
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from bean_type_dict
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDictExample">
    delete from bean_type_dict
    <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.BeanTypeDict" useGeneratedKeys="true">
    insert into bean_type_dict (bean_type, bean_name, bean_display_name, 
      bean_description, bean_parameter_template)
    values (#{beanType,jdbcType=VARCHAR}, #{beanName,jdbcType=VARCHAR}, #{beanDisplayName,jdbcType=VARCHAR}, 
      #{beanDescription,jdbcType=VARCHAR}, #{beanParameterTemplate,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDict" useGeneratedKeys="true">
    insert into bean_type_dict
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="beanType != null">
        bean_type,
      </if>
      <if test="beanName != null">
        bean_name,
      </if>
      <if test="beanDisplayName != null">
        bean_display_name,
      </if>
      <if test="beanDescription != null">
        bean_description,
      </if>
      <if test="beanParameterTemplate != null">
        bean_parameter_template,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="beanType != null">
        #{beanType,jdbcType=VARCHAR},
      </if>
      <if test="beanName != null">
        #{beanName,jdbcType=VARCHAR},
      </if>
      <if test="beanDisplayName != null">
        #{beanDisplayName,jdbcType=VARCHAR},
      </if>
      <if test="beanDescription != null">
        #{beanDescription,jdbcType=VARCHAR},
      </if>
      <if test="beanParameterTemplate != null">
        #{beanParameterTemplate,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDictExample" resultType="java.lang.Integer">
    select count(*) from bean_type_dict
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update bean_type_dict
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.beanType != null">
        bean_type = #{record.beanType,jdbcType=VARCHAR},
      </if>
      <if test="record.beanName != null">
        bean_name = #{record.beanName,jdbcType=VARCHAR},
      </if>
      <if test="record.beanDisplayName != null">
        bean_display_name = #{record.beanDisplayName,jdbcType=VARCHAR},
      </if>
      <if test="record.beanDescription != null">
        bean_description = #{record.beanDescription,jdbcType=VARCHAR},
      </if>
      <if test="record.beanParameterTemplate != null">
        bean_parameter_template = #{record.beanParameterTemplate,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update bean_type_dict
    set id = #{record.id,jdbcType=INTEGER},
      bean_type = #{record.beanType,jdbcType=VARCHAR},
      bean_name = #{record.beanName,jdbcType=VARCHAR},
      bean_display_name = #{record.beanDisplayName,jdbcType=VARCHAR},
      bean_description = #{record.beanDescription,jdbcType=VARCHAR},
      bean_parameter_template = #{record.beanParameterTemplate,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.BeanTypeDict">
    update bean_type_dict
    <set>
      <if test="beanType != null">
        bean_type = #{beanType,jdbcType=VARCHAR},
      </if>
      <if test="beanName != null">
        bean_name = #{beanName,jdbcType=VARCHAR},
      </if>
      <if test="beanDisplayName != null">
        bean_display_name = #{beanDisplayName,jdbcType=VARCHAR},
      </if>
      <if test="beanDescription != null">
        bean_description = #{beanDescription,jdbcType=VARCHAR},
      </if>
      <if test="beanParameterTemplate != null">
        bean_parameter_template = #{beanParameterTemplate,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.strategy.persistent.domain.BeanTypeDict">
    update bean_type_dict
    set bean_type = #{beanType,jdbcType=VARCHAR},
      bean_name = #{beanName,jdbcType=VARCHAR},
      bean_display_name = #{beanDisplayName,jdbcType=VARCHAR},
      bean_description = #{beanDescription,jdbcType=VARCHAR},
      bean_parameter_template = #{beanParameterTemplate,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into bean_type_dict  (bean_type, bean_name, bean_display_name, 
        bean_description, bean_parameter_template)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.beanType,jdbcType=VARCHAR}, #{item.beanName,jdbcType=VARCHAR}, #{item.beanDisplayName,jdbcType=VARCHAR}, 
        #{item.beanDescription,jdbcType=VARCHAR}, #{item.beanParameterTemplate,jdbcType=VARCHAR})
      </foreach>
    </if>
  </insert>
</mapper>