<!-- 插入一条语句,根据类中存在的数据进行动态解析生成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