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;
            }
  • 相关阅读:
    使用POI操作Excel时对事先写入模板的公式强制执行
    centos7下python3和pycharm安装
    IntelliJ IDEA 快捷键终极大全
    netcore XmlDocument 使用Load和Save方法
    Add File as a Link on Visual Studio
    C#开源项目
    Shell bash和sh区别
    SecureCRT中Vim颜色
    查找局域网中未知设备的IP
    代码分支管理
  • 原文地址:https://www.cnblogs.com/qqflying/p/2589965.html
Copyright © 2011-2022 走看看