mybatis中的几个注意的地方
1、首先定义一个sql标签,一定要定义唯一id<sql id="Base_Column_List" >name,age</sql>
2、然后通过id引用
<select id="selectAll">
select
<include refid="Base_Column_List" />
from student
</select>
这个<include refid="Base_Column_List" />会自动把上面的代码贴过来。 <trim prefix="(" suffix=")" suffixOverrides="," >
</trim>
<insert id="insertSelective" parameterType="com.dearbinge.data.pojo.Security" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into t_security
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="fSecuritykey != null" >
f_SecurityKey,
</if>
<if test="fSecurityvalue != null" >
f_SecurityValue,
</if>
<if test="fMerchantid != null" >
f_MerchantId,
</if>
<if test="fTag != null" >
f_Tag,
</if>
<if test="fIsdelete != null" >
f_IsDelete,
</if>
<if test="fCreateuser != null" >
f_CreateUser,
</if>
<if test="fCreatetime != null" >
f_CreateTime,
</if>
<if test="fUpdateuser != null" >
f_UpdateUser,
</if>
<if test="fUpdatetime != null" >
f_UpdateTime,
</if>
<if test="fRemark != null" >
f_Remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="fSecuritykey != null" >
#{fSecuritykey,jdbcType=VARCHAR},
</if>
<if test="fSecurityvalue != null" >
#{fSecurityvalue,jdbcType=VARCHAR},
</if>
<if test="fMerchantid != null" >
#{fMerchantid,jdbcType=VARCHAR},
</if>
<if test="fTag != null" >
#{fTag,jdbcType=VARCHAR},
</if>
<if test="fIsdelete != null" >
#{fIsdelete,jdbcType=INTEGER},
</if>
<if test="fCreateuser != null" >
#{fCreateuser,jdbcType=VARCHAR},
</if>
<if test="fCreatetime != null" >
#{fCreatetime,jdbcType=DATE},
</if>
<if test="fUpdateuser != null" >
#{fUpdateuser,jdbcType=VARCHAR},
</if>
<if test="fUpdatetime != null" >
#{fUpdatetime,jdbcType=DATE},
</if>
<if test="fRemark != null" >
#{fRemark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
mybatis中的几个注意的地方的更多相关文章
- Mybatis中SqlMapper配置的扩展与应用(3)
隔了两周,首先回顾一下,在Mybatis中的SqlMapper配置文件中引入的几个扩展机制: 1.引入SQL配置函数,简化配置.屏蔽DB底层差异性 2.引入自定义命名空间,允许自定义语句级元素.脚本级 ...
- MyBatis中的特殊符号[20160713]
今天中午回到工位已经是12:20多了,没有时间睡觉了,本想着还能提前开始,结果看了点新闻之后,又是12:40了,所以新闻坚决不能看,执行力. 今天主要记录一下MyBatis中的特殊符号的问题,这个问题 ...
- Mybatis中的collection、association来处理结果映射
前不久的项目时间紧张,为了尽快完成原型开发,写了一段效率相当低的代码. 最近几天闲下来,主动把之前的代码优化了一下:) 标签:Java.Mybatis.MySQL 概况:本地系统从另外一个系统得到 ...
- MyBatis中主要类的生命周期和应用范围
转自:http://ccchhhlll1988-163-com.iteye.com/blog/1420026 MyBatis中常用的类就要数SqlSessionFactoryBuilder.SqlSe ...
- Mybatis中配置Mapper的方法
在这篇文章中我主要想讲一下Mybatis配置文件中mappers元素的配置.关于基础部分的内容可以参考http://haohaoxuexi.iteye.com/blog/1333271. 我们知道在M ...
- SSM-MyBatis-17:Mybatis中一级缓存(主要是一级缓存存在性的证明,增删改对一级缓存会造成什么影响)
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 缓存------------------------------------------> 很熟悉的一个 ...
- MyBatis中主键回填的两种实现方式
主键回填其实是一个非常常见的需求,特别是在数据添加的过程中,我们经常需要添加完数据之后,需要获取刚刚添加的数据 id,无论是 Jdbc 还是各种各样的数据库框架都对此提供了相关的支持,本文我就来和和大 ...
- MyBatis中Mapper的返回值类型
insert.update.delete语句的返回值类型 对数据库执行修改操作时,数据库会返回受影响的行数. 在MyBatis(使用版本3.4.6,早期版本不支持)中insert.update.del ...
- springboot 与 mybatis 中事务特性讲解
1 MyBatis自动参与到 spring 事务管理中,无需额外配置,只要org.mybatis.spring.SqlSessionFactoryBean引用的数据源与 DataSourceTrans ...
随机推荐
- vue+vuecli+webapck2实现多页面应用
准备工作 在本地用vue-cli新建一个项目,首先安装vue-cil,命令: npm install -g vue-cli 新建一个vue项目,创建一个基于"webpack"的项目 ...
- (最详细)小米MIX的Usb调试模式在哪里打开的教程
当我们使用安卓手机链接pc的时候,或者使用的有些应用比如我们团队营销团队当使用的应用引号精灵,以前老版本就需要开启Usb调试模式下使用,现当新版本不需要了,如果手机没有开启Usb调试模式,pc则没法成 ...
- Android 轮播图Banner切换图片的效果
Android XBanner使用详解 2018年03月14日 08:19:59 AND_Devil 阅读数:910 版权声明:本文为博主原创文章,未经博主允许不得转载. https://www. ...
- nginx配置proxy_pass URL末尾加与不加/(斜线)的区别
nginx在配置proxy_pass的时候 URL结尾加斜线(/)与不加的区别和注意事项 假设访问路径的 /pss/bill.html 加/斜线的情况 location /pss/ { proxy_p ...
- MongoDB分片 在部署和维护管理 中常见事项的总结
分片(sharding)是MongoDB将大型集合分割到不同服务器(或者说集群)上所采用的方法,主要为应对高吞吐量与大数据量的应用场景提供了方法. 和既有的分库分表.分区方案相比,MongoDB的最大 ...
- 【公众号系列】SAP将裁员4400人,颤抖吧!
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[公众号系列]SAP将裁员4400人,颤抖吧! ...
- WPF中在MVVM模式下,后台绑定ListCollectionView事件触发问题
问题:WPF中MVVM模式下 ListView绑定ListCollectionView时,CurrentChanged无法触发 解决方案: 初期方案:利用ListView的SelectionChang ...
- linux 系统信息展示 htop glances conky psensor
htop glances conky psensor htop glances 只能在终端内展示. htop 使用系统自带程序包管理程序就可以安装 glances github地址:https://g ...
- [LeetCode] 5. 最长回文子串
题目链接:https://leetcode-cn.com/problems/longest-palindromic-substring/ 题目描述: 给定一个字符串 s,找到 s 中最长的回文子串.你 ...
- Mac进行 usr/bin 目录下修改权限问题,operation not permitted
一般情况下我们在使用mac系统过程中下载一些文件.新建一些项目之后,这些文件都会默认是只读状态,这时我们只需要简单的一句权限设置命令就可以解决 你要修改文件上层目录的路径 但是我们在对 usr/bin ...