赞
踩
suffixOverrides 它的作用是移除所有指定在 suffixOverrides属性中的内容。 suffix Overrides ——>后缀 覆盖
- <!-- keyProperty="id">
-
- <insert id="insert" useGeneratedKeys="true">
- insert into Count
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="countType != null">
- CountType,
- </if>
- <if test="countKey != null">
- CountKey,
- </if>
- <if test="countValue != null">
- CountValue,
- </if>
- <if test="lastUpdateTime != null">
- LastUpdateTime,
- </if>
- <if test="remark != null">
- Remark,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="countType != null">
- #{countType,jdbcType=VARCHAR},
- </if>
- <if test="countKey != null">
- #{countKey,jdbcType=VARCHAR},
- </if>
- <if test="countValue != null">
- #{countValue,jdbcType=INTEGER},
- </if>
- <if test="lastUpdateTime != null">
- getDate(),
- </if>
- <if test="remark != null">
- #{remark,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>

String countType = "BBQ"; | String countKey = "BBQ"; | Date lastUpdateTime = new Date(); |
insert into Count ( CountType, CountKey, LastUpdateTime ) values ( ?, ?, getDate() ) |
String countType = "BBQ"; | String countKey = "BBQ"; |
insert into Count ( CountType, CountKey ) values ( ?, ? ) |
根据入参和 SQL 慢慢体会使用
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。