diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 6eb7459f..47ce2020 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -60,8 +60,9 @@ export default defineConfig({ items: [ {text: '增删改', link: '/zh/base/add-delete-update'}, {text: '查询和分页', link: '/zh/base/query'}, - {text: 'IService', link: '/zh/base/service'}, {text: 'QueryWrapper', link: '/zh/base/querywrapper'}, + {text: 'Db + Row', link: '/zh/base/db-row'}, + {text: 'IService', link: '/zh/base/service'}, ] }, { @@ -70,7 +71,6 @@ export default defineConfig({ {text: '@Table 注解', link: '/zh/core/table'}, {text: '@Id 注解', link: '/zh/core/id'}, {text: '@Column 注解', link: '/zh/core/column'}, - {text: 'Db + Row', link: '/zh/core/db-row'}, {text: '逻辑删除', link: '/zh/core/logic-delete'}, {text: '乐观锁', link: '/zh/core/version'}, {text: '数据填充', link: '/zh/core/fill'}, diff --git a/docs/zh/core/db-row.md b/docs/zh/base/db-row.md similarity index 100% rename from docs/zh/core/db-row.md rename to docs/zh/base/db-row.md diff --git a/docs/zh/base/query.md b/docs/zh/base/query.md index a8cb0f44..00da7963 100644 --- a/docs/zh/base/query.md +++ b/docs/zh/base/query.md @@ -19,6 +19,9 @@ - **selectListByQueryAs(query, asType)**: 和 `selectListByQuery` 方法类似,但是在某些场景下,`query` 可能包含了 `left join` 等多表查询,返回的数据和 entity 字段不一致时, 可以通过 `asType` 参数来指定接收的数据类型(通常是 dto、vo 等)。 - **selectAll**:查询所有数据。 +- **selectObjectByQuery(query)**:查询只返回 1 列,并只有 1 条数据的场景。 +- **selectObjectListByQuery(query)**:查询只返回 1 列场景,比如 `QueryWrapper.create().select(ACCOINT.ID).from(...)`。 +- **selectObjectListByQueryAs(query, asType)**:对 `selectObjectListByQuery` 进行封装,并转换为特定的类型。 - **selectCountByCondition**:根据 QueryWrapper 查询数据量。 - **selectCountByQuery**:根据 QueryWrapper 查询数据量。 diff --git a/docs/zh/base/service.md b/docs/zh/base/service.md index a0f17a52..9bc53564 100644 --- a/docs/zh/base/service.md +++ b/docs/zh/base/service.md @@ -15,7 +15,7 @@ MyBatis-Flex 提供了一个名为 `IService` 的接口,及其默认实现类 ```java public interface IAccountService extends IService{ //你的自定义方法 - Account customMethod(); + List customMethod(); } ``` @@ -27,8 +27,9 @@ public class AccountServiceImpl implements IAccountService extends ServiceImpl{ @Override - public Account customMethod(){ - return getMapper().selectOneByQuery("..."); + public List customMethod(){ + //返回 id >= 100 的数据 + return list(ACCOUNT.ID.ge(100)); } } ```