myBatis插入oracle獲取主鍵

劍握在手發表於2015-02-12
<insert id="insert" parameterType="com.inspur.biz.entry.SpLackApply">
      <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="billId">  
       SELECT 'QLSQ'||SP_LACK_APPLY_SEQ.NEXTVAL as BILL_ID from DUAL  
   </selectKey>
    insert into SP_LACK_APPLY (BILL_ID, ORGAN_ID, ORGAN_NAME, 
      APPLY_TYPE_VALUE, APPLY_TYPE_NAME, APPLY_PN, 
      APPLY_ITEM_NAME, APPLY_ITME_TYPE_VALUE, APPLY_ITEM_TYPE_NAME, 
      QTY, EMERGENCY_DEGREE_VALUE, EMERGENCY_DEGREE_NAME, 
      QUALITY_VALUE, QUALITY_NAME, INDUSTRY_VALUE, 
      INDUSTRY_NAME, APPLY_NOTE, APPLY_USER_ID, 
      APPLY_USER_NAME, APPLY_DATE, HANDLE_USER_ID, 
      HANDLE_USER_NAME, HANDLE_DATE, HANDLE_NOTE, 
      HANDLE_LATE_NOTE, HANDLE_LATE_WARN_QTY, INWHSE_DATE, 
      INWHSE_LATE_NOTE, INWHSE_LATE_WARN_QTY, FLOW_STATE, 
      WARN_STATE, HANDLE_USE_TIME, INWHSE_USE_TIME, 
      DEPOSIT_BILL_ID, HANDLE_TYPE_VALUE, HANDLE_TYPE_NAME, 
      HANDLE_PN, HANDLE_ITEM_NAME, HANDLE_ITME_TYPE_VALUE, 
      HANDLE_ITEM_TYPE_NAME,SERVICE_ID)
    values (#{billId,jdbcType=VARCHAR}, #{organId,jdbcType=VARCHAR}, #{organName,jdbcType=VARCHAR}, 
      #{applyTypeValue,jdbcType=VARCHAR}, #{applyTypeName,jdbcType=VARCHAR}, #{applyPn,jdbcType=VARCHAR}, 
      #{applyItemName,jdbcType=VARCHAR}, #{applyItmeTypeValue,jdbcType=VARCHAR}, #{applyItemTypeName,jdbcType=VARCHAR}, 
      #{qty,jdbcType=DECIMAL}, #{emergencyDegreeValue,jdbcType=VARCHAR}, #{emergencyDegreeName,jdbcType=VARCHAR}, 
      #{qualityValue,jdbcType=VARCHAR}, #{qualityName,jdbcType=VARCHAR}, #{industryValue,jdbcType=VARCHAR}, 
      #{industryName,jdbcType=VARCHAR}, #{applyNote,jdbcType=VARCHAR}, #{applyUserId,jdbcType=VARCHAR}, 
      #{applyUserName,jdbcType=VARCHAR}, #{applyDate,jdbcType=TIMESTAMP}, #{handleUserId,jdbcType=VARCHAR}, 
      #{handleUserName,jdbcType=VARCHAR}, #{handleDate,jdbcType=TIMESTAMP}, #{handleNote,jdbcType=VARCHAR}, 
      #{handleLateNote,jdbcType=VARCHAR}, #{handleLateWarnQty,jdbcType=DECIMAL}, #{inwhseDate,jdbcType=TIMESTAMP}, 
      #{inwhseLateNote,jdbcType=VARCHAR}, #{inwhseLateWarnQty,jdbcType=DECIMAL}, #{flowState,jdbcType=VARCHAR}, 
      #{warnState,jdbcType=VARCHAR}, #{handleUseTime,jdbcType=DECIMAL}, #{inwhseUseTime,jdbcType=DECIMAL}, 
      #{depositBillId,jdbcType=VARCHAR}, #{handleTypeValue,jdbcType=VARCHAR}, #{handleTypeName,jdbcType=VARCHAR}, 
      #{handlePn,jdbcType=VARCHAR}, #{handleItemName,jdbcType=VARCHAR}, #{handleItmeTypeValue,jdbcType=VARCHAR}, 
      #{handleItemTypeName,jdbcType=VARCHAR},#{serviceId,jdbcType=VARCHAR})
  </insert>

 

相關文章