MySQL MyBatis 默认插入当前时间

java哥 阅读:812 2021-03-31 18:11:43 评论:0
<!--单表动态更新语句 --> 
  <update id="update" parameterType="com.zzg.entity.ColumnValidate"> 
  		update ucas_bus_column_validate 
  		<set> 
			<if test="updateBy != null and updateBy != ''"> 
				  update_by = #{updateBy,jdbcType=VARCHAR}, 
			</if> 
      		<if test="state != null and state != ''"> 
        		`state` = #{state,jdbcType=VARCHAR}, 
      		</if> 
      		<if test="deleteFlag != null and deleteFlag != ''"> 
        		delete_flag = #{deleteFlag,jdbcType=VARCHAR}, 
      		</if> 
      		<if test="validateName != null and validateName != ''"> 
      			 validate_name =  #{validateName,jdbcType=VARCHAR}, 
      		</if> 
      		<if test="validateContent != null and validateContent != ''"> 
      			 validate_content = #{validateContent,jdbcType=VARCHAR}, 
      		</if> 
      		version = version + 1, 
      		update_dt = now() 
      	</set> 
       	where sid = #{sid,jdbcType=VARCHAR} and version = #{version, jdbcType=INTEGER} 
  </update>

重点代码:update_dt = now()

标签:MyBatis
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号