首页 > 其他 > 详细

mybatis例子

时间:2016-02-03 11:41:41      阅读:282      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!