mybatis批量插入怎么做 ?

kuanner kuanner 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<insert id="addNormalPlan" parameterType="list" >
<selectKey keyProperty="id" resultType="int" order="BEFORE">
select max(id)+1 from TBL_NORMAL_PLAN
</selectKey>
<![CDATA[
INSERT INTO TEST( id, plan_type,week_type, start_time,end_time) VALUES ]]>
<foreach collection="list" item="item" index="index"
separator=",">
<![CDATA[ (#{id}, #{item.planType}, #{item.weekType},
#{item.startTime}, #{item.endTime} ) ]]>
</foreach>
</insert>



INSERT INTO TEST( id, plan_type,week_type, start_time,end_time) values(?,?,?,?,?),(?,?,?,?,?) 执行的时候就报个错。

求真相
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
kuanner
非技术区 23,404 成员 70,506 内容