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

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

<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>
原文地址:https://www.cnblogs.com/dongyaotou/p/12730160.html