1. 程式人生 > 程式設計 >mybatis-plus排除非表中欄位的操作

mybatis-plus排除非表中欄位的操作

使用 transient 修飾

private transient String noColumn;

使用 static 修飾

private static String noColumn;

使用 TableField 註解

@TableField(exist=false)

private String noColumn;

補充知識:Mybatis plus @TableName實體中新增非資料庫欄位報錯,如增加請在欄位上加註解 @TableField(exist = false)

否則會出現以下異常:

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '***' in 'field list'

以上這篇mybatis-plus排除非表中欄位的操作就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。