springboot 页面查询显示项目表,项目表和用户表是多对多的关系,如何通过当前用户id查找显示当前登录用户的项目
sys_user 用户表 sys_game 项目表 sys_game_user关系表
现在我的sql只能用固定的ID查询 ,怎么绑定user登录用户id
用代码块功能插入代
```java
controller
@GetMapping("/page/")
public Result findPage(@RequestParam String name,
@RequestParam Integer pageNum,
@RequestParam Integer pageSize) {
Page<Game> page = gameService.findPage(new Page<>(pageNum, pageSize), name);
return Result.success(page);
}
service
@Override
public Page<Game> findPage(Page<Game> page, String name) {
return gameMapper.findPage(page,name);
}
mapper
public interface GameMapper extends BaseMapper<Game> {
Page<Game> findPage(Page<Game> page,@Param("name") String name);
}
mapper.xml
<select id="findPage" resultType="com.example.springboot2022.entity.Game">
SELECT * from sys_game LEFT JOIN sys_game_user on sys_game.id=sys_game_user.game_id
LEFT JOIN sys_user on sys_user.id=sys_game_user.user_id
-- where sys_user.id=
</select>
```
```,请勿粘贴截图