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;
            }
  • 相关阅读:
    Performance and Design
    返回数组中不重复的元素
    IE的button元素bug
    (转)Google Closure: 糟糕的JavaScript
    Why do we have an IMG element?
    About this and that
    C#中的Attribute
    C#检查字体是否存储,以及安装
    ZipFile压缩文件后,解压文件后有多层目录的处理方法
    Office系列在线预览
  • 原文地址:https://www.cnblogs.com/qqflying/p/2589965.html
Copyright © 2011-2022 走看看