@TableId 遇到的一个小坑,; Field 'LOG_ID' doesn't have a default value; nested exception is java.sql.SQLExc

; Field 'LOG_ID' doesn't have a default value; nested exception is java.sql.SQLException: Field 'LOG_ID' doesn't have a default value
 

public class PsSyslogRdEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
	private Long logId;
	/**
	 * 
	 */
	private Long loginId;
	/**
	 * 
	 */
	private String loginNo;
	/**
	 * 
	 */
	private String loginName;
	/**
	 * 
	 */
	private String userIp;
	/**
	 * 
	 */
	private String userPort;
	/**
	 * 
	 */
	private String serviceIp;
	/**
	 * 
	 */
	private String serviceSport;
	/**
	 * 关联PS_FUNCTIONCODE_DICT
	 */
	private String funcCode;
	/**
	 * 
	 */
	private String opType;
	/**
	 * 
	 */
	private String opDesc;
	/**
	 * 
	 */
	private Date startTime;
	/**
	 * 
	 */
	private Date endTime;
	/**
	 * 
	 */
	private String serviceName;
	/**
	 * 
	 */
	private String contactId;
	/**
	 * 0-成功 1-失败
	 */
	private String successFlag;
	/**
	 * 
	 */
	private Date createTime;

}

由于我的Etity实体 中 logId 存在注解 @TableId,因此 我通过 mybatis-plus 默认的

this.insert(psServiceparamRd);

时,logId 即使赋值也不会拼入sql中

INSERT INTO PS_SERVICEPARAM_RD   ( in_param,  out_param )  VALUES   ( ?,  ? )

去除 @table 后

==>  Preparing: INSERT INTO PS_SERVICEPARAM_RD ( log_id, in_param, out_param ) VALUES ( ?, ?, ? ) 

留贴填坑!

 

你可能感兴趣的:(SPRINGBOOT)