mybatisplus实现多表联查

mybatisplus实现多表联查

已有表user与supervisor,需要user与supervisor实现多表联查,两张表共同字段为id,user表中字段为下方entity,supervisor表中字段为id,address,应对如下代码进行如何修正

@Configuration
@RequestMapping("test")
public class TestController {
    @Autowired
    IuserService userService;
    @PostMapping(value="getList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页码,从1开始, 默认为1", dataType = "int", paramType = "body", defaultValue = "1"),
            @ApiImplicitParam(name = "size", value = "分页大小, 默认为15", dataType = "int", paramType = "body", defaultValue = "15"),
            @ApiImplicitParam(name = "id", value = "项目id", dataType = "int", paramType = "body", required = true),
    @RepeatSubmit
    public AjaxResult getList(@RequestBody JSONObject post)
    {
        var Id = post.getIntValue("id");

        var wrapper = new QueryWrapper();

        wrapper.eq("id", Id);

        wrapper.orderByDesc("code");

        try
        {
            var pageNo = (int)post.getOrDefault("page", 1);
            var size = (int)post.getOrDefault("size", 15);
            var page = userService.page(new Page<>(pageNo, size), wrapper);
            return AjaxResult.success(page);
        }
        catch(Exception e)
        {
            return AjaxResult.error(e.getMessage());
        }
    }

mapper

public interface userMapper extends BaseMapper<user> {
}

entity

@Data

@TableName("user")
public class user extends Model {

    private int id;
    private String name;
}

service

public interface IuserService  extends IService<user> {

}

impl

@Service
public class userServiceImpl extends ServiceImpl, user> implements IuserService {

}

无过滤条件,如何实现对supervisor表的多表联查

想要得到什么都没表达清楚!!

mybatisplus只支持单表操作,多表联查需要自己写SQL

mybatisplus 只支持单表的增删改查操作,多表关联查询可以自行写sql文件