zoukankan      html  css  js  c++  java
  • IBatis框架 利用select @@Identity 获取新增记录ID

    xml文件写法:

    <insert id="InsertPurchaseEvaluations" parameterClass="PurchaseEvaluations">
                INSERT INTO PurchaseEvaluations(
                ApplyMoneyID,
                PurchaseID,
                PurchaseName,
                AddUserID,
                AddUserName,
                AddTime,
                AverageScoreValue,
                EvaluationRemark,
                PurchaseLevel,
                EvaluationType)
                VALUES(
                #ApplyMoneyID#,
                #PurchaseID#,
                #PurchaseName#,
                #AddUserID#,
                #AddUserName#,
                #AddTime#,
                #AverageScoreValue#,
                #EvaluationRemark#,
                #PurchaseLevel#,
                #EvaluationType#)
                <selectKey property="Id" resultClass="int" type="post">
                select @@Identity as Id
            </selectKey>
            </insert>

    方法:

    public int InsertPurchaseEvaluations(PurchaseEvaluations purchaseEvaluations)
            {
                mapper.Insert("InsertPurchaseEvaluations", purchaseEvaluations);
                return purchaseEvaluations.Id;
            }
  • 相关阅读:
    121. Best Time to Buy and Sell Stock
    70. Climbing Stairs
    647. Palindromic Substrings
    609. Find Duplicate File in System
    583. Delete Operation for Two Strings
    556 Next Greater Element III
    553. Optimal Division
    539. Minimum Time Difference
    537. Complex Number Multiplication
    227. Basic Calculator II
  • 原文地址:https://www.cnblogs.com/qqflying/p/2589965.html
Copyright © 2011-2022 走看看