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>
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;
}
{
mapper.Insert("InsertPurchaseEvaluations", purchaseEvaluations);
return purchaseEvaluations.Id;
}