如何使用MyBatis-Plus排除查询时非表定义的字段?
- 内容介绍
- 文章标签
- 相关推荐
本文共计212个文字,预计阅读时间需要1分钟。
使用`transient`修饰`private transient String noColumn;`以忽略字段,使用`static`修饰`private static String noColumn;`以定义静态字段,使用`@TableField(exist=false)`注解`private String noColumn;`以在Mybatis Plus中忽略字段。Mybatis Plus中,使用`@TableName`注解可以指定实体对应的表名。
使用 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排除非表中字段的操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。
本文共计212个文字,预计阅读时间需要1分钟。
使用`transient`修饰`private transient String noColumn;`以忽略字段,使用`static`修饰`private static String noColumn;`以定义静态字段,使用`@TableField(exist=false)`注解`private String noColumn;`以在Mybatis Plus中忽略字段。Mybatis Plus中,使用`@TableName`注解可以指定实体对应的表名。
使用 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排除非表中字段的操作就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。

