MyBatis-Oracle-selectKey返回主键
生活随笔
收集整理的這篇文章主要介紹了
MyBatis-Oracle-selectKey返回主键
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
Mapper(Oracle)
<insert id="insertWxshLogOut" parameterType="java.util.HashMap"><selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">select wxsh_seq.nextval as id from dual</selectKey>INSERT INTO WXSH_LOG_OUT(ID,OUT_NO,USER_ID,FILE_NAME,CREATE_AT,IP,CONTENT,OUT_NUM,UNIT_NO,STATUS)VALUES(#{id},#{out_no},#{user_id},#{file_name},SYSDATE,#{ip},#{content},#{out_num},#{unit_no},#{status}) </insert>Service
public int addWxshLogOut(Map map) {try {DataSourceTypeManager.set(DataSources.GJT);welfareConfirmMapper.insertWxshLogOut(map);return Integer.parseInt(String.valueOf(map.get("id")));} catch (Exception e) {logger.error(e.getMessage());}return 0; }map中會增加返回的主鍵id
轉(zhuǎn)載于:https://my.oschina.net/merryyou/blog/1358372
總結(jié)
以上是生活随笔為你收集整理的MyBatis-Oracle-selectKey返回主键的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单碟1.75T 西数14TB充氦硬盘今年
- 下一篇: Appcan开发笔记:导出Excel文件