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通用接口 实体类的属性最好不要使用基本类型,因基本类型都有默认值 且无法消除 在查询时有时会出现多余的查询条件如果要使用建议使用基本类型的包装类