mysql建立电影表_【代码片段】MySQL新建表添加基础字段
MySQL數據庫表中,經常會用到的三個字段
SQL建表時,直接插入
gmt_create datetime null comment '創建時間',
gmt_modified datetime null comment '修改時間',
is_deleted tinyint(1) unsigned default 0 not null comment '邏輯刪除標記'
或者在已有的表最后插入
alter table table_name
add gmt_create datetime null comment '創建時間';
alter table table_name
add gmt_modified datetime null comment '修改時間';
alter table table_name
add is_deleted tinyint(1) default 0 not null comment '邏輯刪除標記';
對應 Java 代碼,基于 MyBatis-Plus 時間字段自動填充、軟刪除
/**
* 創建時間
*/
@TableField(value = "gmt_create", fill = FieldFill.INSERT)
private String gmtCreate;
/**
* 修改時間
*/
@TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
private String gmtModified;
/**
* 邏輯刪除標記
*/
@TableLogic
private Integer isDeleted;
很贊哦! (0)
總結
以上是生活随笔為你收集整理的mysql建立电影表_【代码片段】MySQL新建表添加基础字段的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux下安装mysql的方式_lin
- 下一篇: java中表示根号三_Java命名规范