<?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.emsproductsexecutivestandard.mapper.EmsProductsExecutiveStandardMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsproductsexecutivestandard.model.EmsProductsExecutiveStandard">
    <id column="STANDARD_ID" jdbcType="VARCHAR" property="standardId" />
    <result column="PRODUCT" jdbcType="VARCHAR" property="product" />
    <result column="BRAND" jdbcType="VARCHAR" property="brand" />
    <result column="FACTORY_STANDARD" jdbcType="VARCHAR" property="factoryStandard" />
    <result column="SURFACE_STANDARD" jdbcType="VARCHAR" property="surfaceStandard" />
    <result column="CREATEMAN" jdbcType="VARCHAR" property="createman" />
    <result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
    <result column="UPDATEMAN" jdbcType="VARCHAR" property="updateman" />
    <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
  </resultMap>
  <sql id="columns">
    STANDARD_ID, PRODUCT, BRAND, FACTORY_STANDARD, SURFACE_STANDARD, CREATEMAN, CREATETIME, 
    UPDATEMAN, UPDATETIME, MEMO
  </sql>
  <sql id="columns_alias">
    t.STANDARD_ID, t.PRODUCT, t.BRAND, t.FACTORY_STANDARD, t.SURFACE_STANDARD, t.CREATEMAN, 
    t.CREATETIME, t.UPDATEMAN, t.UPDATETIME, t.MEMO
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM EMS_PRODUCTS_EXECUTIVE_STANDARD
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM EMS_PRODUCTS_EXECUTIVE_STANDARD t
  </sql>
  <sql id="where">
    <where> 
      <if test="standardId != null">
        and STANDARD_ID = #{standardId}
      </if>
      <if test="product != null and product != ''">
        and PRODUCT = #{product}
      </if>
      <if test="brand != null and brand != ''">
        and BRAND = #{brand}
      </if>
      <if test="factoryStandard != null and factoryStandard != ''">
        and FACTORY_STANDARD = #{factoryStandard}
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        and SURFACE_STANDARD = #{surfaceStandard}
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN = #{createman}
      </if>
      <if test="createtime != null">
        and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
      </if>
      <if test="updateman != null and updateman != ''">
        and UPDATEMAN = #{updateman}
      </if>
      <if test="updatetime != null">
        and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO = #{memo}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="standardId != null">
        and STANDARD_ID = #{standardId}
      </if>
      <if test="product != null and product != ''">
        and PRODUCT LIKE '%${product}%'
      </if>
      <if test="brand != null and brand != ''">
        and BRAND LIKE '%${brand}%'
      </if>
      <if test="factoryStandard != null and factoryStandard != ''">
        and FACTORY_STANDARD LIKE '%${factoryStandard}%'
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        and SURFACE_STANDARD LIKE '%${surfaceStandard}%'
      </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>
      <if test="updateman != null and updateman != ''">
        and UPDATEMAN LIKE '%${updateman}%'
      </if>
      <if test="updatetime != null">
        and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
      </if>
      <if test="memo != null and memo != ''">
        and MEMO LIKE '%${memo}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
    delete from EMS_PRODUCTS_EXECUTIVE_STANDARD
    where STANDARD_ID = #{standardId,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from EMS_PRODUCTS_EXECUTIVE_STANDARD
    where 1!=1 
      <if test="product != null and product != ''">
        or PRODUCT = #{product}
      </if>
      <if test="brand != null and brand != ''">
        or BRAND = #{brand}
      </if>
      <if test="factoryStandard != null and factoryStandard != ''">
        or FACTORY_STANDARD = #{factoryStandard}
      </if>
      <if test="surfaceStandard != null and surfaceStandard != ''">
        or SURFACE_STANDARD = #{surfaceStandard}
      </if>
      <if test="createman != null and createman != ''">
        or CREATEMAN = #{createman}
      </if>
      <if test="createtime != null">
        or TO_CHAR(CREATETIME,'yyyy-MM-dd') = '#{createtime}'
      </if>
      <if test="updateman != null and updateman != ''">
        or UPDATEMAN = #{updateman}
      </if>
      <if test="updatetime != null">
        or TO_CHAR(UPDATETIME,'yyyy-MM-dd') = '#{updatetime}'
      </if>
      <if test="memo != null and memo != ''">
        or MEMO = #{memo}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.emsproductsexecutivestandard.model.EmsProductsExecutiveStandard">
    insert into EMS_PRODUCTS_EXECUTIVE_STANDARD (STANDARD_ID, PRODUCT, BRAND, 
      FACTORY_STANDARD, SURFACE_STANDARD, CREATEMAN, 
      CREATETIME, UPDATEMAN, UPDATETIME, 
      MEMO)
    values (#{standardId,jdbcType=VARCHAR}, #{product,jdbcType=VARCHAR}, #{brand,jdbcType=VARCHAR},
      #{factoryStandard,jdbcType=VARCHAR}, #{surfaceStandard,jdbcType=VARCHAR}, #{createman,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updateman,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, 
      #{memo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.emsproductsexecutivestandard.model.EmsProductsExecutiveStandard">
    insert into EMS_PRODUCTS_EXECUTIVE_STANDARD
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="standardId != null">
        STANDARD_ID,
      </if>
      <if test="product != null">
        PRODUCT,
      </if>
      <if test="brand != null">
        BRAND,
      </if>
      <if test="factoryStandard != null">
        FACTORY_STANDARD,
      </if>
      <if test="surfaceStandard != null">
        SURFACE_STANDARD,
      </if>
      <if test="createman != null">
        CREATEMAN,
      </if>
      <if test="createtime != null">
        CREATETIME,
      </if>
      <if test="updateman != null">
        UPDATEMAN,
      </if>
      <if test="updatetime != null">
        UPDATETIME,
      </if>
      <if test="memo != null">
        MEMO,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="standardId != null">
        #{standardId,jdbcType=VARCHAR},
      </if>
      <if test="product != null">
        #{product,jdbcType=VARCHAR},
      </if>
      <if test="brand != null">
        #{brand,jdbcType=VARCHAR},
      </if>
      <if test="factoryStandard != null">
        #{factoryStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateman != null">
        #{updateman,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsproductsexecutivestandard.model.EmsProductsExecutiveStandard">
    update EMS_PRODUCTS_EXECUTIVE_STANDARD
    set PRODUCT = #{product,jdbcType=VARCHAR},
      BRAND = #{brand,jdbcType=VARCHAR},
      FACTORY_STANDARD = #{factoryStandard,jdbcType=VARCHAR},
      SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      CREATEMAN = #{createman,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      MEMO = #{memo,jdbcType=VARCHAR}
    where STANDARD_ID = #{standardId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsproductsexecutivestandard.model.EmsProductsExecutiveStandard">
    update EMS_PRODUCTS_EXECUTIVE_STANDARD
    <set>
      <if test="product != null">
        PRODUCT = #{product,jdbcType=VARCHAR},
      </if>
      <if test="brand != null">
        BRAND = #{brand,jdbcType=VARCHAR},
      </if>
      <if test="factoryStandard != null">
        FACTORY_STANDARD = #{factoryStandard,jdbcType=VARCHAR},
      </if>
      <if test="surfaceStandard != null">
        SURFACE_STANDARD = #{surfaceStandard,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        CREATEMAN = #{createman,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateman != null">
        UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
    </set>
    where STANDARD_ID = #{standardId,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
    <include refid="select"/>
    where STANDARD_ID = #{standardId,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    ORDER BY LENGTH(PRODUCT),PRODUCT
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    ORDER BY LENGTH(PRODUCT),PRODUCT
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into EMS_PRODUCTS_EXECUTIVE_STANDARD 
      (STANDARD_ID, 
      PRODUCT, BRAND, FACTORY_STANDARD, 
      SURFACE_STANDARD, CREATEMAN, CREATETIME, 
      UPDATEMAN, UPDATETIME, MEMO
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.standardId,jdbcType=VARCHAR},
      #{item.product,jdbcType=VARCHAR}, #{item.brand,jdbcType=VARCHAR}, #{item.factoryStandard,jdbcType=VARCHAR}, 
      #{item.surfaceStandard,jdbcType=VARCHAR}, #{item.createman,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP}, 
      #{item.updateman,jdbcType=VARCHAR}, #{item.updatetime,jdbcType=TIMESTAMP}, #{item.memo,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update EMS_PRODUCTS_EXECUTIVE_STANDARD
     set
       STANDARD_ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.standardId,jdbcType=VARCHAR}
       </foreach>
       ,PRODUCT=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.product,jdbcType=VARCHAR}
       </foreach>
       ,BRAND=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.brand,jdbcType=VARCHAR}
       </foreach>
       ,FACTORY_STANDARD=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.factoryStandard,jdbcType=VARCHAR}
       </foreach>
       ,SURFACE_STANDARD=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.surfaceStandard,jdbcType=VARCHAR}
       </foreach>
       ,CREATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
       </foreach>
       ,CREATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.createtime,jdbcType=TIMESTAMP}
       </foreach>
       ,UPDATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.updateman,jdbcType=VARCHAR}
       </foreach>
       ,UPDATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.updatetime,jdbcType=TIMESTAMP}
       </foreach>
       ,MEMO=
       <foreach collection="list" item="item" index="index" separator=" " open="case STANDARD_ID" close="end">
          when #{item.standardId,jdbcType=VARCHAR} then #{item.memo,jdbcType=VARCHAR}
       </foreach>
     where STANDARD_ID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.standardId,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from EMS_PRODUCTS_EXECUTIVE_STANDARD
    where STANDARD_ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>