Loading...

Mybaties保存后自动获取主键ID

<!-- 插入记录 -->
<insert id="saveTvTypeBatch" useGeneratedKeys="true" keyProperty="id"
parameterType="java.util.List">
<selectKey resultType="long" keyProperty="id" order="AFTER"> 
SELECT 
LAST_INSERT_ID() 
</selectKey> 
INSERT INTO T_U_TV_TYPE (
TERMINAL_TYPE ,
TV_TYPE_CODE ,
TV_TYPE_NAME ,
TV_TYPE_ABRIDGE_NAME ,
ORDER_FIELD ,
FLG ,
UPDATE_TIME 
) VALUES 
<foreach collection="list" item="typeList" index="index" separator="," > 
(
#{typeList.terminalType} ,
#{typeList.tvTypeCode} ,
#{typeList.tvTypeName} ,
#{typeList.tvTypeAbridgeName} ,
#{typeList.orderField} ,
#{typeList.flg} ,
#{typeList.updateTime} 
)
</foreach>
</insert>

 

posted @ 2016-02-02 15:14  微笑阳光哈*_*  阅读(925)  评论(0编辑  收藏  举报