亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

MySQL?MyBatis?默認插入當(dāng)前時間方式

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

MySQL MyBatis 默認插入當(dāng)前時間

<!--單表動態(tài)更新語句 -->
  <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 插入時間類型的數(shù)據(jù)

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

實體中類型是: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>

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

相關(guān)文章

最新評論