为何在controller中直接注入service层的CategoryService接口即可查询数据?
首先,CategoryService接口继承了IService接口,而IService接口封装了很多方法。
其次,之所以能查到mapper层的数据,是因为CategoryServiceI的实现类CategoryServiceImpl同时还继承了ServiceImpl类,而ServiceImpl类继承了BaseMapper类的同时还实现了IService接口。
为何在controller中直接注入service层的CategoryService接口即可查询数据?
首先,CategoryService接口继承了IService接口,而IService接口封装了很多方法。
其次,之所以能查到mapper层的数据,是因为CategoryServiceI的实现类CategoryServiceImpl同时还继承了ServiceImpl类,而ServiceImpl类继承了BaseMapper类的同时还实现了IService接口。