首先数据库能查询到数据, 不过查询到的字段都是 null 值, 因为业务上就用到这3个字段
![](https://i-blog.csdnimg.cn/blog_migrate/83de887addaac4892e33bfd6bbb52756.png)
代码中使用 mybatis-plus 精确字段查询, select方法可以精确查询字段
![](https://i-blog.csdnimg.cn/blog_migrate/88f9166c902436a86ddd23a661ed2e07.png)
之后debug看到 orderMain 对象为 null, 因为 这 3 个字段在数据库表中都是 null
![](https://i-blog.csdnimg.cn/blog_migrate/f53d2f6d5f5cf1eb9b57d24f5f2e7f0d.png)
解决方式是把 select方法需要查询一个数据库中不为 null 的字段即可, 比如 把主键 id 查出来, 至于原因我也不太清楚, 可能是mybatis-plus, 拿到都为 null 的字段就不做实体类的映射了
![](https://i-blog.csdnimg.cn/blog_migrate/8ecb32e19a3e0b99bab9a73abf7b2186.png)