mybatis批量插入怎么做 ?

kuanner 2012-01-21 10:38:44
<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(?,?,?,?,?),(?,?,?,?,?) 执行的时候就报个错。

求真相
...全文
371 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
我就改个名 2012-08-02
  • 打赏
  • 举报
回复
<insert id="insertInstance" parameterType="hashMap">
insert into ${tableName} (customer_id,${insertColumns}) values (#{customer_id},${insertValues})
</insert>

<update id="updateReceiveById" parameterType="hashMap">
update ${tableName} set ${updateValues} where document_id = #{document_id} and customer_id = #{customer_id}
</update>
ly1124263 2012-07-23
  • 打赏
  • 举报
回复
楼主怎么解决的,贴出来啊
MiceRice 2012-01-21
  • 打赏
  • 举报
回复
好歹给个错误提示信息来。

否则的话,建议你看看这个吧?
http://www.cnblogs.com/xcch/articles/2042298.html

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧