springboot + mybatis 查询结果为null字段不显示


@Primary
@Bean(name = "sysSqlSessionFactory")
public SqlSessionFactory setSqlSessionFactory(@Qualifier("sysDataSource") DataSource dataSource) throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
  //设置为true 为null字段也会查询出来
bean.getObject().getConfiguration().setCallSettersOnNulls(true);
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
configuration.setMapUnderscoreToCamelCase(true);
bean.setConfiguration(configuration);
bean.setMapperLocations(resolveMapperLocations());
bean.setConfigurationProperties(resolveMapperProperties());
return bean.getObject();
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM