mybatis xml中常见配置demo
新增:
<insert id="insertSelective" parameterType="map" >
insert into BS_CHNGROUP_DICT
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="groupName != null" >
GROUP_NAME,
</if>
<if test="hasChild != null" >
HAS_CHILD,
</if>
<if test="queryIndex != null" >
QUERY_INDEX,
</if>
<if test="activeTime != null" >
ACTIVE_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="groupName != null" >
#{groupName,jdbcType=VARCHAR},
</if>
<if test="hasChild != null" >
#{hasChild,jdbcType=CHAR},
</if>
<if test="queryIndex != null" >
#{queryIndex,jdbcType=DECIMAL},
</if>
<if test="activeTime != null" >
#{activeTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
修改:
1.
<update id="updateByPrimaryKeySelective" parameterType="map" >
update BS_STAFF_STATUS
<set >
<if test="status != null" >
STATUS = #{status,jdbcType=VARCHAR},
</if>
<if test="enterTime != null" >
ENTER_TIME = #{enterTime,jdbcType=TIMESTAMP},
</if>
<if test="insertTime != null" >
INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
</if>
<if test="deptId != null" >
DEPT_ID = #{deptId,jdbcType=VARCHAR},
</if>
<if test="phoneNo != null" >
PHONE_NO = #{phoneNo,jdbcType=VARCHAR},
</if>
</set>
where STAFF_ID = #{staffId,jdbcType=VARCHAR}
</update>
查询
1.
<select id="selectSelective" resultType="map" parameterType="map" >
select
<include refid="Base_Column_List" />
from BS_QUESTION_TRACE_INFO a
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="questionId != null" >
and QUESTION_ID = #{questionId,jdbcType=CHAR}
</if>
<if test="preStatus != null">
and PRE_STATUS = #{preStatus,jdbcType=CHAR}
</if>
<if test="curStatus != null">
and CUR_STATUS = #{curStatus,jdbcType=CHAR}
</if>
<if test="oprType != null">
and OPR_TYPE = #{oprType,jdbcType=CHAR}
</if>
<if test="questionOwnerId != null">
and QUESTION_OWNER_ID = #{questionOwnerId,jdbcType=CHAR}
</if>
</trim>
</select>
mybatis xml中常见配置demo的更多相关文章
- web.xml中常见配置解读
文章转自:http://blog.csdn.net/sdyy321/article/details/5838791 有一般XML都必须有的版本.编码.DTD <web-app>下子元素&l ...
- SpringMVC(十六):如何使用编程方式替代/WEB-INF/web.xml中的配置信息
在构建springmvc+mybatis项目时,更常用的方式是采用web.xml来配置,而且一般情况下会在web.xml中使用ContextLoaderListener加载applicationCon ...
- 【转】MyBatis学习总结(三)——优化MyBatis配置文件中的配置
[转]MyBatis学习总结(三)——优化MyBatis配置文件中的配置 一.连接数据库的配置单独放在一个properties文件中 之前,我们是直接将数据库的连接配置信息写在了MyBatis的con ...
- Mybatis系列(二):优化MyBatis配置文件中的配置和解决字段名与实体类属性名不相同的冲突
原文链接:http://www.cnblogs.com/xdp-gacl/p/4264301.html http://www.cnblogs.com/xdp-gacl/p/4264425.ht ...
- web.xml中JSP配置及 EL表达式
web.xml 中JSP配置.servlet配置 及 EL表达式 [摘要] servlet 基本配置 <servlet> <servlet-name>LoginServlet& ...
- J2EE进阶(五)Spring在web.xml中的配置
J2EE进阶(五)Spring在web.xml中的配置 前言 在实际项目中spring的配置文件applicationcontext.xml是通过spring提供的加载机制自动加载到容器中.在web ...
- Spring中,applicationContext.xml 配置文件在web.xml中的配置详解
一.首先写一下代码结构. 二.再看web.xml中的配置情况. <?xml version="1.0" encoding="UTF-8"?> < ...
- 使用Spring时web.xml中的配置
使用Spring时web.xml中的配置: <?xml version="1.0" encoding="UTF-8"?> <web-app x ...
- Struts在Web.xml中的配置及Struts1和Struts2的区别
(1)配置Struts的ActionServlet <servlet>元素来声明ActionServlet <servlet-name>元素:用来定义Servle ...
随机推荐
- 片段的findFragmentById
class类名 名字 = calss类名 getFragmentManager().findFragmentById(R.id.布局id) 因为需要获取到片段的管理者,才可以去寻找到相应的布局.
- bzoj 2212 Tree Rotations
bzoj 2212 Tree Rotations 考虑一个子树 \(x\) 的左右儿子分别为 \(ls,rs\) .那么子树 \(x\) 内的逆序对数就是 \(ls\) 内的逆序对数,\(rs\) 内 ...
- 《DSP using MATLAB》 示例 Example 9.12
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- Windows下使用curl命令
curl下载地址: https://curl.haxx.se/download.html 选择对应的版本下载后解压 使用方式(一):在解压后curl.exe所在目录打开cmd,即可使用 使用方式(二) ...
- 在IE7+ 中弹出窗口并关闭本身窗口的脚本(备忘)
window.onload =function(){ window.open("http://www.126.com"); window.opener=null; window.o ...
- Autocad 2010+ObjectArx 2010 +Vs2010 的.net 开发设置(转)
Autocad 2010+ObjectArx 2010 +Vs2010 的.net 开发设置 分类: ObjectArx.net2010-09-14 16:52 4203人阅读 评论(7) 收藏 举报 ...
- 【linux】linux文件属性权限的介绍
众所周知,root的信息存在/etc/passwd下,个人密码存在/etc/shadow下,所有组名存在/etc/group下,因此这三个文件十分重要. 在linux系统下,我们可以通过"l ...
- native关键字(本地方法)、 java调用so动态链接库
Java native关键字 一. 什么是Native Method 简单地讲,一个Native Method就是一个java调用非java代码的接口.一个Native Method是这样一个ja ...
- CFGym 100211J 题解
一.题目 二.题意 给定一个字母表(最多也就是英文小写字母的前10个字母),一个交换表,两个字符串,判断字符串A能否通过交换表的交换方式变成字符串B. 三.思路 1.一开始,比赛时,我半模拟半记忆化地 ...
- redis for windows之nosql还需要入门?
RT:nosql给很多人的感觉就是上手特别快,本文也是一篇入门级的,哎~~ 又写了一篇没有卵用的博文,姑且把它当作一篇文档吧,还是没有发布/订阅.事件...等介绍的一篇残缺文档,幸好废话不是很多,凑合 ...