您的位置:首页 > 其它

mybatis 分页插件拦截注解不同版本不同的写法,及分页遇到的问题

2017-12-05 09:41 441 查看
mybatis @Intercepts注解的写法
使用MyBatis 3.4.1或者其以上版本
@Intercepts({  
@Signature(type = StatementHandler.class,  
method = "prepare",  
args = {Connection.class, Integer.class})})

使用MyBatis 3.4.1(不包含)以下
@Intercepts({  
@Signature(type = StatementHandler.class,  
method = "prepare",  
args = {Connection.class})})
其他小记:mybatis 中jdbcType=date和timestamp 是有格式区别的,date 类型只能精确到天,timestamp 能精确到时分秒
如果 使用mapper通用接口,并使用了自带的方法(mapper自带的方法 实体类一般都需要 @Table,@Column等注解)
并且不想让实体类中的某个字段作为条件进行查询匹配则可使用 @Transient注解 注解的全名称是javax.persistence.Transient
使用mapper通用接口 实体类的属性最好不要使用基本类型,因基本类型都有默认值 且无法消除 在查询时有时会出现多余的查询条件如果要使用建议使用基本类型的包装类
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息