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 ...
随机推荐
- keras_基本网络层结构(2)_卷积层
参考文献:http://keras-cn.readthedocs.io/en/latest/layers/convolutional_layer/ 卷积层 Conv1D层 keras.layers.c ...
- Java第二次作业--数组和String类
Deadline: 2017-3-28 23:00 一.学习要点 认真看书并查阅相关资料,掌握以下内容: 掌握基本数据类型和引用数据类型的区别 理解对象的生成与引用的关系 掌握构造方法的重载 掌握St ...
- 每天一个linux命令(性能、优化):【转载】lsof命令
lsof(list open files)是一个列出当前系统打开文件的工具.在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件.所以如传输控制协议 ...
- Hive教程之metastore的三种模式
Hive中metastore(元数据存储)的三种方式: 内嵌Derby方式 Local方式 Remote方式 [一].内嵌Derby方式 这个是Hive默认的启动模式,一般用于单元测试,这种存储方式有 ...
- UML drawing tools
1. tools based on the script http://www.websequencediagrams.com/ UMLet 12.1 My best two recommendati ...
- 【转】详解硬盘MBR
原文网址:http://hi.baidu.com/waybq/item/a4490f026f9859d21ef046a4 硬盘是现在计算机上最常用的存储器之一.我们都知道,计算机之所以神奇,是因为它具 ...
- GridView 绑定数据的常用指定格式。
形式 语法 结果 注释 数字 {0:N2} 12.36 数字 {0:N0} 13 货币 {0:c2} $12.36 货币 {0:c4} $12.3656 货币 "¥{0:N2 ...
- ROS使用国内的DDNS服务
未测试.转载余松老师的作品 虽然RouterOS 加入了cloud功能,但最近在配置RB2011的时候发现不好使,更新域名后无法正确解析到我的IP地址,虽然在cloud的public address中 ...
- ScheduledExecutorService 定时器用法
1,如果只是想简单的写个定时任务,比如10分钟跑一次,那么ScheduledExecutorService是比较方便的,下面举个简单的例子 import java.util.concurrent.Ex ...
- 5月23日笔记-js绑定事件、解绑事件、复合事件
each() $("p").each(function(i,ele){ //alert(ele.innerHTML); alert($("p:eq("+i+&q ...