mybatis例子
mybatis的mapper不允许重载,因为它需要通过方法名称[不加签名]去查找需要执行的sql
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例子的更多相关文章
- IDEA maven项目下测试mybatis例子,使用mappper class或package引入mapper映射文件,总是报错Invalid bound statement(所有配置完全正确)
困扰几个小时,终于查到解决办法及原因(可以直接到最后看解决方案) 环境就是用IDEA搭建的maven项目,主要jar包引入配置如下 <dependencies> <dependenc ...
- SpringBoot整合MyBatis例子
1.pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="h ...
- SpringMvc+Spring3+MyBatis整合
1.MyBatis 例子 首先,单独使用MyBatis时: import java.io.IOException; import java.io.Reader; import org.apache.i ...
- SpringBoot+Mybatis集成搭建
本博客介绍一下SpringBoot集成Mybatis,数据库连接池使用alibaba的druid,使用SpringBoot微框架虽然集成Mybatis之后可以不使用xml的方式来写sql,但是用惯了x ...
- Spring集成MyBatis的使用-使用Mapper映射器
Spring集成MyBatis使用 前面复习MyBatis时,发现在测试时,需要手动创建sqlSessionFactory,Spring将帮忙自动创建sqlSessionFactory,并且将自动扫描 ...
- SpringBoot整合Thymeleaf
一个整合Thymeleaf与Mybatis的CRUD例子 整合Mybatis例子 一.添加maven依赖 <dependency> <groupId>org.springfra ...
- MyBatis Generator作为maven插件自动生成增删改查代码及配置文件例子
什么是MyBatis Generator MyBatis Generator (MBG) 是一个Mybatis的代码生成器,可以自动生成一些简单的CRUD(插入,查询,更新,删除)操作代码,model ...
- 调用mybatis generator已经生成好的dao来查询例子
package com.cib.xj.controller; import java.util.List; import javax.annotation.Resource; import org.s ...
- MyBatis Mapper 文件例子
转载:http://blog.csdn.net/ppby2002/article/details/20611737 <?xml version="1.0" encoding= ...
随机推荐
- 编译安装的gitlab8.x如何修改时区设置
编译安装的gitlab 8.x版本默认的时区是UTC,在页面上显示的时间默认是零时区的区时,安装完成之后,如果页面上显示的时间比北京时间少了8个小时,则需要修改一下时区 把gitlab.yml文件中的 ...
- 使用eclipse执行maven-release-plugin插件发布jar异常问题(.project)(Cannot prepare the release because you have local modifications )
开发是用的eclipse,里面有工程文件.project这种文件,运行release:prepare的时候报异常: Cannot prepare the release because you hav ...
- [APP] Android 开发笔记 004-Android常用基本控件使用说明
TextView 文本框 EditText控件 Button 与 ImageButton ImageView RadioButton CheckBox复选框 TextView 文本框 ,用于显示文本的 ...
- 高斯混合模型Gaussian Mixture Model (GMM)
混合高斯模型GMM是指对样本的概率密度分布进行估计,而估计采用的模型(训练模型)是几个高斯模型的加权和(具体是几个要在模型训练前建立好).每个高斯模型就代表了一个类(一个Cluster).对样本中的数 ...
- vue之创建组建
vue的核心基础就是组件的使用,玩好了组件才能将前面学的基础更好的运用起来.组件的使用更使我们的项目解耦合.更加符合vue的设计思想MVVM. 那接下来就跟我看一下如何在一个Vue实例中使用组件吧! ...
- 170816、nginx常用配置说明
#user nobody; #开启进程数 <=CPU数 worker_processes 1; #错误日志保存位置 #error_log logs/error.log; #error_log ...
- ubuntu16.04下安装ros-kinetic
参考:http://wiki.ros.org/kinetic/Installation/Ubuntu 1.添加ROS软件源 ~$ sudo sh -c 'echo "deb http://p ...
- MapRedece(多表关联)
多表关联: 准备数据 ******************************************** 工厂表: Factory Addressed BeijingRedStar 1 Shen ...
- PHP快速入门
1.表单 <form action="processorder.php" method="post"> 表单的第一行,action的意思是说,提交表 ...
- 【紫书】Oil Deposits UVA - 572 dfs求联通块
题意:给你一个地图,求联通块的数量. 题解: for(所有还未标记的‘@’点) 边dfs边在vis数组标记id,直到不能继续dfs. 输出id及可: ac代码: #define _CRT_SECURE ...