亲测,已经解决。
yaml:
mybatis:
mapper-locations: classpath:mapper/*.xml
# config-location: classpath:mybatis/mybatis-config.xml
configuration:
map-underscore-to-camel-case: true #开启驼峰命名模式
商品ID和品牌ID都是为空。
因为我在Product、和ProductDto里的字段:store_id, brand_id
,因为yaml配置开启了驼峰,所以就不能映射到数据库表中的store_id和brand_id字段。
所以把数据库字段和javaBean、Dto的字段都设置为驼峰命名就可以了。