<?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.th.demo.mapping.develop.DevUpdownMapper">
  <resultMap id="BaseResultMap" type="com.th.demo.model.develop.DevUpdown">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="PARAM" jdbcType="VARCHAR" property="param" />
    <result column="ADD_ID" jdbcType="VARCHAR" property="addId" />
    <result column="ADD_TIME" jdbcType="TIMESTAMP" property="addTime" />
    <result column="MODIFY_ID" jdbcType="VARCHAR" property="modifyId" />
    <result column="MODIFY_TIME" jdbcType="TIMESTAMP" property="modifyTime" />
    <result column="CANCEL_ID" jdbcType="VARCHAR" property="cancelId" />
    <result column="CANCEL_TIME" jdbcType="TIMESTAMP" property="cancelTime" />
    <result column="CANCEL_FLAG" jdbcType="VARCHAR" property="cancelFlag" />
    <result column="ATTR1" jdbcType="VARCHAR" property="attr1" />
    <result column="ATTR2" jdbcType="VARCHAR" property="attr2" />
    <result column="ATTR3" jdbcType="VARCHAR" property="attr3" />
    <result column="ATTR4" jdbcType="DECIMAL" property="attr4" />
    <result column="ATTR5" jdbcType="DECIMAL" property="attr5" />
    <result column="ATTR6" jdbcType="DECIMAL" property="attr6" />
  </resultMap>
  <sql id="Base_Column_List">
    ID, PARAM, ADD_ID, ADD_TIME, MODIFY_ID, MODIFY_TIME, CANCEL_ID, CANCEL_TIME, CANCEL_FLAG, 
    ATTR1, ATTR2, ATTR3, ATTR4, ATTR5, ATTR6
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from DEV_UPDOWN
    where ID = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from DEV_UPDOWN
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.th.demo.model.develop.DevUpdown">
    <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
      SELECT  REPLACE(UUID(),'-','') as id from dual
    </selectKey>

     insert into DEV_UPDOWN (ID, PARAM, ADD_ID,
      ADD_TIME, MODIFY_ID, MODIFY_TIME, 
      CANCEL_ID, CANCEL_TIME, CANCEL_FLAG, 
      ATTR1, ATTR2, ATTR3, 
      ATTR4, ATTR5, ATTR6
      )
    values (#{id,jdbcType=VARCHAR}, #{param,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR}, 
      #{addTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, 
      #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, 
      #{attr1,jdbcType=VARCHAR}, #{attr2,jdbcType=VARCHAR}, #{attr3,jdbcType=VARCHAR}, 
      #{attr4,jdbcType=DECIMAL}, #{attr5,jdbcType=DECIMAL}, #{attr6,jdbcType=DECIMAL}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.th.demo.model.develop.DevUpdown">
    insert into DEV_UPDOWN
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="param != null">
        PARAM,
      </if>
      <if test="addId != null">
        ADD_ID,
      </if>
      <if test="addTime != null">
        ADD_TIME,
      </if>
      <if test="modifyId != null">
        MODIFY_ID,
      </if>
      <if test="modifyTime != null">
        MODIFY_TIME,
      </if>
      <if test="cancelId != null">
        CANCEL_ID,
      </if>
      <if test="cancelTime != null">
        CANCEL_TIME,
      </if>
      <if test="cancelFlag != null">
        CANCEL_FLAG,
      </if>
      <if test="attr1 != null">
        ATTR1,
      </if>
      <if test="attr2 != null">
        ATTR2,
      </if>
      <if test="attr3 != null">
        ATTR3,
      </if>
      <if test="attr4 != null">
        ATTR4,
      </if>
      <if test="attr5 != null">
        ATTR5,
      </if>
      <if test="attr6 != null">
        ATTR6,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="param != null">
        #{param,jdbcType=VARCHAR},
      </if>
      <if test="addId != null">
        #{addId,jdbcType=VARCHAR},
      </if>
      <if test="addTime != null">
        #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyId != null">
        #{modifyId,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cancelId != null">
        #{cancelId,jdbcType=VARCHAR},
      </if>
      <if test="cancelTime != null">
        #{cancelTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cancelFlag != null">
        #{cancelFlag,jdbcType=VARCHAR},
      </if>
      <if test="attr1 != null">
        #{attr1,jdbcType=VARCHAR},
      </if>
      <if test="attr2 != null">
        #{attr2,jdbcType=VARCHAR},
      </if>
      <if test="attr3 != null">
        #{attr3,jdbcType=VARCHAR},
      </if>
      <if test="attr4 != null">
        #{attr4,jdbcType=DECIMAL},
      </if>
      <if test="attr5 != null">
        #{attr5,jdbcType=DECIMAL},
      </if>
      <if test="attr6 != null">
        #{attr6,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.develop.DevUpdown">
    update DEV_UPDOWN
    <set>
      <if test="param != null">
        PARAM = #{param,jdbcType=VARCHAR},
      </if>
      <if test="addId != null">
        ADD_ID = #{addId,jdbcType=VARCHAR},
      </if>
      <if test="addTime != null">
        ADD_TIME = #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyId != null">
        MODIFY_ID = #{modifyId,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null">
        MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cancelId != null">
        CANCEL_ID = #{cancelId,jdbcType=VARCHAR},
      </if>
      <if test="cancelTime != null">
        CANCEL_TIME = #{cancelTime,jdbcType=TIMESTAMP},
      </if>
      <if test="cancelFlag != null">
        CANCEL_FLAG = #{cancelFlag,jdbcType=VARCHAR},
      </if>
      <if test="attr1 != null">
        ATTR1 = #{attr1,jdbcType=VARCHAR},
      </if>
      <if test="attr2 != null">
        ATTR2 = #{attr2,jdbcType=VARCHAR},
      </if>
      <if test="attr3 != null">
        ATTR3 = #{attr3,jdbcType=VARCHAR},
      </if>
      <if test="attr4 != null">
        ATTR4 = #{attr4,jdbcType=DECIMAL},
      </if>
      <if test="attr5 != null">
        ATTR5 = #{attr5,jdbcType=DECIMAL},
      </if>
      <if test="attr6 != null">
        ATTR6 = #{attr6,jdbcType=DECIMAL},
      </if>
    </set>
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.th.demo.model.develop.DevUpdown">
    update DEV_UPDOWN
    set PARAM = #{param,jdbcType=VARCHAR},
      ADD_ID = #{addId,jdbcType=VARCHAR},
      ADD_TIME = #{addTime,jdbcType=TIMESTAMP},
      MODIFY_ID = #{modifyId,jdbcType=VARCHAR},
      MODIFY_TIME = #{modifyTime,jdbcType=TIMESTAMP},
      CANCEL_ID = #{cancelId,jdbcType=VARCHAR},
      CANCEL_TIME = #{cancelTime,jdbcType=TIMESTAMP},
      CANCEL_FLAG = #{cancelFlag,jdbcType=VARCHAR},
      ATTR1 = #{attr1,jdbcType=VARCHAR},
      ATTR2 = #{attr2,jdbcType=VARCHAR},
      ATTR3 = #{attr3,jdbcType=VARCHAR},
      ATTR4 = #{attr4,jdbcType=DECIMAL},
      ATTR5 = #{attr5,jdbcType=DECIMAL},
      ATTR6 = #{attr6,jdbcType=DECIMAL}
    where ID = #{id,jdbcType=VARCHAR}
  </update>



  <select id="select" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from DEV_UPDOWN
    where ifnull(cancel_flag,'0') = '0'
  </select>
</mapper>