tk.mybatis 保存实体类时个别字段使用数据库的默认值
作者:互联网
在实体类使用数据库默认值的字段设置
@Column(name = "yourName",insertable = false)
在生成insert语句时会忽略字段(JPA下未测试)
示例如下, 具体描述可以看javax.persistence.Column 源码。
package cn.aps.entity;
import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.code.ORDER;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author 구영강
* @version 1.0
* @date 2020/1/7 13:16
*/
@Data
@Table(name = "WIP_LOT")
public class WipLot {
@Id
@Column(name = "UPDATE_TIME",insertable = false)
private String updateTime;
private String technology;
private String grade;
private Integer processSeq;
private Integer version;
private String createUser;
@Column(name = "CREATE_TIME",insertable = false)
private String createTime;
private String updateUser;
}
标签:实体类,String,Column,private,tk,import,默认值,javax,persistence 来源: https://www.cnblogs.com/shoshana-kong/p/14290160.html