码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis例子

时间:2016-02-03 11:44:19      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

1.批量删除

  <delete id="deletePlanLocations" parameterType="list" >
    delete from plan_location where uuid in
    (<foreach collection="list" item="item" separator="," index="index"> 
        #{item, jdbcType=VARCHAR}
    </foreach>)
  </delete>

 2.批量插入

<insert id="insertPlanLocations" parameterType="list" >
    insert into plan_location (uuid, location_name, group_id, x, 
      y, tenant_id, 
      create_time, create_user_id, update_user_id
      ) values 
    <foreach collection="list" item="item" separator="," index="index" > 
        (#{item.uuid, jdbcType=VARCHAR}, #{item.locationName,jdbcType=VARCHAR},#{item.groupId,jdbcType=INTEGER},
        #{item.x,jdbcType=DOUBLE},#{item.y,jdbcType=DOUBLE},
        #{item.tenantId,jdbcType=INTEGER},#{item.createTime,jdbcType=TIMESTAMP},
        #{item.createUserId,jdbcType=INTEGER},#{item.createUserId,jdbcType=INTEGER})
    </foreach>
  </insert>

 

mybatis例子

标签:

原文地址:http://www.cnblogs.com/guochunyi/p/5179179.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!