欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL?MyBatis?默認(rèn)插入當(dāng)前時(shí)間方式

 更新時(shí)間:2022年10月12日 11:44:58   作者:在奮斗的大道  
這篇文章主要介紹了MySQL?MyBatis?默認(rèn)插入當(dāng)前時(shí)間方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

MySQL MyBatis 默認(rèn)插入當(dāng)前時(shí)間

<!--單表動(dòng)態(tài)更新語(yǔ)句 -->
  <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>

重點(diǎn)代碼:update_dt = now()

MyBatis 插入時(shí)間類型的數(shù)據(jù)

數(shù)據(jù)庫(kù)indbTime字段類型:date

實(shí)體中類型是:Date 

mybatis的插入類型應(yīng)該設(shè)置成:#{indbTime,jdbcType=TIMESTAMP}

mybatis的插入類型應(yīng)該設(shè)置成:  #{indbTime,jdbcType=DATE}

   insert into CDS_DATA_PLAT_TRANS_INFO
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="indbTime != null">
        INDB_TIME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="indbTime != null">
        #{indbTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論