diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java index ce840459..25f4627b 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java @@ -490,6 +490,16 @@ public interface BaseMapper { return MapperUtil.queryRelations(this, MapperUtil.getSelectOneResult(selectListByQuery(queryWrapper))); } + /** + * 根据主表主键来查询 1 条数据。 + * + * @param id 主表主键 + * @return 实体类数据 + */ + default T selectOneWithRelationsById(Serializable id) { + return MapperUtil.queryRelations(this, selectOneById(id)); + } + /** * 根据查询条件来查询 1 条数据。 *