Mybatis - Mapper文件简练
来源:互联网 发布:祛斑精华知乎 编辑:程序博客网 时间:2024/04/28 13:33
<!-- 插入一条语句,根据类中存在的数据进行动态解析生成SQL -->
<select id="select" resultMap="BaseResultMap" parameterType="com.metarnet.Execution.DAO.Model.CeicsExecution">
select
<include refid="Base_Column_List" />
from CEICS_EXECUTION
<trim prefix="WHERE" prefixOverrides="AND">
<if test="executionId != null">
AND EXECUTION_ID=#{executionId,jdbcType=DECIMAL}
</if>
<if test="executionName != null" >
AND EXECUTION_NAME like #{executionName,jdbcType=VARCHAR}
</if>
<if test="executionActive != null" >
AND EXECUTION_ACTIVE like #{executionActive,jdbcType=DECIMAL}
</if>
<if test="regDate != null" >
AND REG_DATE=#{regDate,jdbcType=TIMESTAMP}
</if>
</trim>
</select>
<!-- 自动主键(此时的自动主键可在JAVA中获取到) -->
<insert id="insert" parameterType="com.metarnet.Execution.DAO.Model.CeicsExecution" >
<selectKey keyProperty="executionId" resultType="java.math.BigDecimal" order="BEFORE" >
SELECT nvl(max(EXECUTION_ID),0)+1 as executionId FROM CEICS_EXECUTION
</selectKey>
insert into CEICS_EXECUTION (EXECUTION_ID, EXECUTION_NAME, EXECUTION_ACTIVE,
REG_DATE)
values (#{executionId,jdbcType=DECIMAL}, #{executionName,jdbcType=VARCHAR}, #{executionActive,jdbcType=DECIMAL},
#{regDate,jdbcType=TIMESTAMP})
<select id="select" resultMap="BaseResultMap" parameterType="com.metarnet.Execution.DAO.Model.CeicsExecution">
select
<include refid="Base_Column_List" />
from CEICS_EXECUTION
<trim prefix="WHERE" prefixOverrides="AND">
<if test="executionId != null">
AND EXECUTION_ID=#{executionId,jdbcType=DECIMAL}
</if>
<if test="executionName != null" >
AND EXECUTION_NAME like #{executionName,jdbcType=VARCHAR}
</if>
<if test="executionActive != null" >
AND EXECUTION_ACTIVE like #{executionActive,jdbcType=DECIMAL}
</if>
<if test="regDate != null" >
AND REG_DATE=#{regDate,jdbcType=TIMESTAMP}
</if>
</trim>
</select>
<!-- 自动主键(此时的自动主键可在JAVA中获取到) -->
<insert id="insert" parameterType="com.metarnet.Execution.DAO.Model.CeicsExecution" >
<selectKey keyProperty="executionId" resultType="java.math.BigDecimal" order="BEFORE" >
SELECT nvl(max(EXECUTION_ID),0)+1 as executionId FROM CEICS_EXECUTION
</selectKey>
insert into CEICS_EXECUTION (EXECUTION_ID, EXECUTION_NAME, EXECUTION_ACTIVE,
REG_DATE)
values (#{executionId,jdbcType=DECIMAL}, #{executionName,jdbcType=VARCHAR}, #{executionActive,jdbcType=DECIMAL},
#{regDate,jdbcType=TIMESTAMP})
</insert>
-----------------------------------程序员 闫帆原创---------------------------------------
转载请注明原创人信息 程序员 闫帆yanfanvip
- Mybatis - Mapper文件简练
- MyBatis Mapper 文件例子
- MyBatis Mapper XML 文件 01
- MyBatis Mapper XML 文件 02
- Mybatis Mapper文件特殊符号替换
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis的mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- mybatis写mapper文件注意事项
- MyBatis 3.Mapper XML 文件
- 无法自动生成或更新R.java文件
- POJ3764 日日夜夜的TLE
- andorid 收藏索引
- Android系统为何不流畅?QNX道破玄机
- java正则表达式处理类
- Mybatis - Mapper文件简练
- 模板的使用
- ORACLE自动主键功能
- Android启动Launcher过程
- HDU 2059 龟兔赛跑 思想基本正确,但是没有独立做出来,以后再自我考察 update
- 各操作系统启动java程序的脚本
- C#温故而知新学习系列之.NET框架高级特性—.NET框架中自身提供的属性(二)
- js版的dateAdd与dateDiff
- 用c++实现urlencode