<update id="updateByPrimaryKeySelective" parameterType="com.csii.loan.common.model.batch.JobDetail"> update batch_job_detail <set> <if test="jobName != null"> job_name = #{jobName,jdbcType=VARCHAR}, </if> <if test="jobType != null"> job_type = #{jobType,jdbcType=CHAR}, </if> <if test="trandateType != null"> trandate_type = #{trandateType,jdbcType=VARCHAR}, </if> <if test="executePeriod != null"> execute_period = #{executePeriod,jdbcType=CHAR}, </if> <if test="remark != null"> remark = #{remark,jdbcType=VARCHAR}, </if> <if test="createUser != null"> create_user = #{createUser,jdbcType=VARCHAR}, </if> <if test="createOrg != null"> create_org = #{createOrg,jdbcType=VARCHAR}, </if> <if test="createTime != null"> create_time = #{createTime,jdbcType=VARCHAR}, </if> <if test="updateUser != null"> update_user = #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateOrg != null"> update_org = #{updateOrg,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> update_time = #{updateTime,jdbcType=VARCHAR}, </if> <if test="curVers != null"> cur_vers = (#{curVers,jdbcType=INTEGER} + 1), </if> </set> WHERE id = #{id,jdbcType=VARCHAR} AND cur_vers = #{curVers,jdbcType=INTEGER} </update>
<if test="curVers != null">
cur_vers = (#{curVers,jdbcType=INTEGER} + 1),
</if>
每一次更新,数据库的版本号都会加一个。
WHERE id = #{id,jdbcType=VARCHAR}
AND cur_vers = #{curVers,jdbcType=INTEGER}
注意这里的 类型为 INTEGER