<?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.steerinfo.ems.trmindexitemtype.mapper.TRmIndexItemTypeMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.trmindexitemtype.model.TRmIndexItemType">
    <id column="ITEMTYPE" jdbcType="VARCHAR" property="itemtype" />
    <result column="NAME" jdbcType="VARCHAR" property="name" />
    <result column="BZ" jdbcType="VARCHAR" property="bz" />
    <result column="CREATEMAN" jdbcType="VARCHAR" property="createman" />
    <result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
  </resultMap>
  <sql id="columns">
    ITEMTYPE, NAME, BZ, CREATEMAN, CREATETIME
  </sql>
  <sql id="columns_alias">
    t.ITEMTYPE, t.NAME, t.BZ, t.CREATEMAN, t.CREATETIME
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM T_RM_INDEX_ITEM_TYPE
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM T_RM_INDEX_ITEM_TYPE t
  </sql>
  <sql id="where">
    <where> 
      <if test="name != null and name != ''">
        and NAME = #{name}
      </if>
      <if test="bz != null and bz != ''">
        and BZ = #{bz}
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN = #{createman}
      </if>
      <if test="createtime != null">
        and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="name != null and name != ''">
        and NAME LIKE '%${name}%'
      </if>
      <if test="itemtype != null and itemtype != ''">
        and ITEMTYPE LIKE '%${itemtype}%'
      </if>
      <if test="bz != null and bz != ''">
        and BZ LIKE '%${bz}%'
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN LIKE '%${createman}%'
      </if>
      <if test="createtime != null">
        and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from T_RM_INDEX_ITEM_TYPE
    where ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from T_RM_INDEX_ITEM_TYPE
    where 1!=1 
      <if test="name != null and name != ''">
        or NAME = #{name}
      </if>
      <if test="bz != null and bz != ''">
        or BZ = #{bz}
      </if>
      <if test="createman != null and createman != ''">
        or CREATEMAN = #{createman}
      </if>
      <if test="createtime != null">
        or TO_CHAR(CREATETIME,'yyyy-MM-dd') = '#{createtime}'
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.trmindexitemtype.model.TRmIndexItemType">
    insert into T_RM_INDEX_ITEM_TYPE (ITEMTYPE, NAME, BZ, 
      CREATEMAN, CREATETIME)
    values (#{itemtype,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{bz,jdbcType=VARCHAR}, 
      #{createman,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.trmindexitemtype.model.TRmIndexItemType">
    insert into T_RM_INDEX_ITEM_TYPE
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="itemtype != null">
        ITEMTYPE,
      </if>
      <if test="name != null">
        NAME,
      </if>
      <if test="bz != null">
        BZ,
      </if>
      <if test="createman != null">
        CREATEMAN,
      </if>
      <if test="createtime != null">
        CREATETIME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="itemtype != null">
        #{itemtype,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        #{bz,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.trmindexitemtype.model.TRmIndexItemType">
    update T_RM_INDEX_ITEM_TYPE
    set NAME = #{name,jdbcType=VARCHAR},
      BZ = #{bz,jdbcType=VARCHAR},
      CREATEMAN = #{createman,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=TIMESTAMP}
    where ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.trmindexitemtype.model.TRmIndexItemType">
    update T_RM_INDEX_ITEM_TYPE
    <set>
      <if test="name != null">
        NAME = #{name,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        BZ = #{bz,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        CREATEMAN = #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where ITEMTYPE = #{itemtype,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into T_RM_INDEX_ITEM_TYPE 
      (ITEMTYPE, 
      NAME, BZ, CREATEMAN, 
      CREATETIME)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.itemtype,jdbcType=VARCHAR}, 
      #{item.name,jdbcType=VARCHAR}, #{item.bz,jdbcType=VARCHAR}, #{item.createman,jdbcType=VARCHAR}, 
      #{item.createtime,jdbcType=TIMESTAMP} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update T_RM_INDEX_ITEM_TYPE
     set
       ITEMTYPE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ITEMTYPE" close="end">
          when #{item.itemtype,jdbcType=VARCHAR} then #{item.itemtype,jdbcType=VARCHAR}
       </foreach>
       ,NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ITEMTYPE" close="end">
          when #{item.itemtype,jdbcType=VARCHAR} then #{item.name,jdbcType=VARCHAR}
       </foreach>
       ,BZ=
       <foreach collection="list" item="item" index="index" separator=" " open="case ITEMTYPE" close="end">
          when #{item.itemtype,jdbcType=VARCHAR} then #{item.bz,jdbcType=VARCHAR}
       </foreach>
       ,CREATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case ITEMTYPE" close="end">
          when #{item.itemtype,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
       </foreach>
       ,CREATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case ITEMTYPE" close="end">
          when #{item.itemtype,jdbcType=VARCHAR} then #{item.createtime,jdbcType=TIMESTAMP}
       </foreach>
     where ITEMTYPE in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.itemtype,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_RM_INDEX_ITEM_TYPE
    where ITEMTYPE in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <select id="get">

  </select>
  
</mapper>