使用oracle系列生成主键,在insert时返回主键
<insert id="insertMenu" parameterType="com.comtop.qcms.security.model.MenuVO" >
<selectKey resultType="int" keyProperty="menuId">SELECT MENU_SEQ.NEXTVAL FROM DUAL
</selectKey>
INSERT INTO QCMS_PUB_MENU (
PARENT_MENU_ID,
MENU_NAME,
ALIASES,
MENU_URL,
FULL_NAME,
STATE,
SORT_ID
)VALUES(
#{parentMenuId,jdbcType=NUMERIC},
#{menuName,jdbcType=VARCHAR},
#{aliases,jdbcType=VARCHAR},
#{menuUrl,jdbcType=VARCHAR},
#{fullName,jdbcType=VARCHAR},
#{state,jdbcType=VARCHAR},
#{sortId,jdbcType=NUMERIC}
)
</insert>