Controller ----Service ----Mapper

UserController(前段控制器的操作 你可以看看如何) —> userService(这个是中间插件类似的一个桥梁)—> UserMapper(实现类的接口 实现具体数据库的操作)

1 首先是Controller 里面 注释@RestController 然后里面注入Service @Autowire Service 进行接口类似的特征
然后 Service 添加@Service 注释 然后在里面注入 mapper 就是 userMapper 注入 加上@Autowire 注解
最后 mapper 里面实现具体的操作 就是实现具体的数据库里的操作 方法!
不要忘记在住的 方法里面添加 @MapperScan

具体如图所示:
Controller ----Service ----Mapper_第1张图片------->>>>
Controller ----Service ----Mapper_第2张图片

---------->>>>>>>>>
Controller ----Service ----Mapper_第3张图片
---------->>>>>>>>>>
Controller ----Service ----Mapper_第4张图片
------------->>>>>>>>>>>>>>>>>

你可能感兴趣的:(Controller ----Service ----Mapper)