首页 > 数据库技术 > 详细

mybatis带有序列的插入sql--保留一个做纪念

时间:2020-04-19 09:48:26      阅读:48      评论:0      收藏:0      [点我收藏+]

现在项目都要换成雪花算法生成主键,之前使用序列的方式不用了,但是害怕自己忘记了以前的方式,特意记下来一个。

<insert id="commit" parameterType="com.picc.hmims.productInfo.dto.ExamineBo">
        <selectKey keyProperty="taskId" resultType="String"    order="BEFORE">
            --             select seq_product_service_price.nextval from dual
            select nextval(‘seq_t_service‘)
        </selectKey>
        insert into T_EXAMINE_TASK
        (TASK_ID,TASK_CODE,BUSI_CODE,BUSI_NAME,BUSI_TYPE,TASK_TYPE,TASK_STATUS,TASK_RESULT,TASK_RESULT_DESC,ORG_CODE,APPLY_PERSON,APPLY_TIME,PREPARE,INSERT_OPER,INSERT_TIME
        )
        values(
        cast(#{taskId} as NUMERIC ),
        --seq_t_service.nextval,
        #{taskCode,jdbcType=VARCHAR},
        #{busiCode,jdbcType=VARCHAR},
        #{busiName,jdbcType=VARCHAR},
        #{busiType,jdbcType=VARCHAR},
        #{taskType,jdbcType=VARCHAR},
        #{taskStatus,jdbcType=VARCHAR},
        #{taskResult,jdbcType=VARCHAR},
        #{taskResultDesc,jdbcType=VARCHAR},
        #{orgCode,jdbcType=VARCHAR},
        #{applyPerson,jdbcType=VARCHAR},
        #{applyTime},
        #{prepare,jdbcType=VARCHAR},
        #{insertOper,jdbcType=VARCHAR},
        #{insertTime})
    </insert>

 

mybatis带有序列的插入sql--保留一个做纪念

原文:https://www.cnblogs.com/dongyaotou/p/12730160.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!