mybatis批量插入使用sequence的技巧
<insert id="addCheckDetail" parameterType="java.util.List"> INSERT INTO CHECK_DETAIL( CHECK_id,CHECK_DATE,CHECK_WEEK,EMP_CODE,CHECK_TIME,CHECK_LATE,CHECK_LEAVE_EARLY, CHECK_EXCEPTION,CHECK_WORK_OVERTIME,EMP_NAME,DEPT_NAME,CHECK_LATE_TIME,DESCRIPTION ) select CHECK_DETAIL_SEQ.NEXTVAL,cd.* from( <foreach collection="list" item="item" index="index" separator="union all"> select #{item.checkDate,jdbcType=VARCHAR}, #{item.checkWeek,jdbcType=VARCHAR}, #{item.empCode,jdbcType=VARCHAR}, #{item.checkTime,jdbcType=VARCHAR}, #{item.checkLate,jdbcType=VARCHAR}, #{item.checkLeaveEarly,jdbcType=VARCHAR}, #{item.checkException,jdbcType=VARCHAR}, #{item.checkWorkOverTime,jdbcType=VARCHAR}, #{item.empName,jdbcType=VARCHAR}, #{item.deptName,jdbcType=VARCHAR}, #{item.checkLateTime,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR} from dual </foreach> ) cd </insert>