springboot 註解 sql ,插入數據、更新數據時,設置創建時間

springboot 註解 sql ,設置創建時間

mysql 寫法
@Update({
    "update electronic_invoice_user",
    "set phone = #{phone,jdbcType=VARCHAR}, ",
      "wechat_userid = #{wechatUserid,jdbcType=VARCHAR},",
      "userid = #{userid,jdbcType=VARCHAR},",
      "source_code = #{sourceCode,jdbcType=VARCHAR},",
      "update_time = now(),",    更新時間
      "remark = #{remark,jdbcType=VARCHAR}",
    "where certificate_no = #{certificateNo,jdbcType=INTEGER}"
})
/*根據證件號更新手機號*/
int updateUserPhone(ElectronicInvoiceUser record);
oracle 寫法
@Update({
    "update electronic_invoice_user",
    "set phone = #{phone,jdbcType=VARCHAR}, ",
      "wechat_userid = #{wechatUserid,jdbcType=VARCHAR},",
      "userid = #{userid,jdbcType=VARCHAR},",
      "source_code = #{sourceCode,jdbcType=VARCHAR},",
      "update_time = sysdate,",  更新時間
      "remark = #{remark,jdbcType=VARCHAR}",
    "where certificate_no = #{certificateNo,jdbcType=INTEGER}"
})
/*根據證件號更新手機號*/
int updateUserPhone(ElectronicInvoiceUser record);

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章