1.8JDKLocalDateTime mybatis转换问题 sharding分表不分表都没问题 亲测
启动类上加上mapper扫描
import tk.mybatis.spring.annotation.MapperScan;
其他缺省
@MapperScan(basePackages = "com.*.*.web.dao")
public class Start {
public static void main(String[] args) {
SpringApplication.run(Start.class, args);
}
配置文件
##mybatis
mybatis.mapper-locations=classpath:/mapper/*.xml
mybatis.configuration.log-prefix=dao.
mybatis.type-aliases-package=com.*.*.web.po
# 驼峰命名规范 如:数据库字段是 order_id 那么 实体字段就要写成 orderId
mybatis.configuration.map-underscore-to-camel-case=true
######### 通用Mapper ##########
# 主键自增回写方法,默认值MYSQL,详细说明请看文档
mapper.identity=MYSQL
mapper.mappers=tk.mybatis.mapper.common.Mapper
# 设置 insert 和 update 中,是否判断字符串类型!=''
mapper.not-empty=true
# 枚举按简单类型处理
mapper.enum-as-simple-type=true
包
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>
属性
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
结果