• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

Hint API


I. Data Source Specification DsHint

(Ⅰ) Overview

In the Oinone development environment, DsHintApi is used to enforce the specification of the data source to be used during data queries. In actual business scenarios, complex SQLs may occur in the following situations:

  • When a single-table SQL cannot meet the requirements
  • When there are complex Join relationships or subqueries
  • When the logic of complex SQLs is difficult to implement or the implementation cost is high through program logic

In such cases, the business functions can be implemented by using the native mybatis/mybatis-plus and custom Mappers. At this time, DsHintApi can be used in combination.

(Ⅱ) API Definition

public static DsHintApi model(String model) {
    // Specific implementation
}

public DsHintApi(Object dsKey) {
    // Specific implementation
}
  • model(String model): Specify the data source by passing in the model code. The model code serves as the basis for data source selection, making it convenient for developers to associate with the corresponding data source according to the business model.
  • DsHintApi(Object dsKey): Directly pass in the data source name to specify the data source. This method is more intuitive and suitable for scenarios where the data source name is clearly known.

(Ⅲ) Usage Examples

1. Precautions

Be sure to use the try - with - resources syntax when using DsHintApi in the code. Failure to use this syntax may lead to problems such as data source confusion, affecting the accuracy of data queries and the stability of the system.

2. DsHintApi Usage Example

Within the try block, all query operations will be forced to use the specified data source.

  • Usage Method 1: Specify the data source by model code
try (DsHintApi dsHintApi = DsHintApi.model(PetItem.MODEL_MODEL)) {
    List<PetItem> items = demoItemDAO.customSqlDemoItem();
    PetShopProxy data2 = data.queryById();
    data2.fieldQuery(PetShopProxy::getPetTalents);
}

In the above example, DsHintApi.model(PetItem.MODEL_MODEL) specifies the data source according to the model code of PetItem, ensuring that all queries within the try block obtain data from the specified data source.

  • Usage Method 2: Specify the data source by data source name
try (DsHintApi dsHintApi = DsHintApi.use("data source name")) {
    List<PetItem> items = demoItemDAO.customSqlDemoItem();
    PetShopProxy data2 = data.queryById();
    data2.fieldQuery(PetShopProxy::getPetTalents);
}

In this example, DsHintApi.use("data source name") directly specifies the data source by the data source name, also ensuring that the query operations within the try block obtain data from this data source.

II. BatchSizeHint

(Ⅰ) Usage Scenarios

In the Oinone development environment, BatchSizeHintApi is used to enforce the specification of the batch size for queries. When processing a large number of data queries, reasonably setting the batch size can optimize performance, reduce memory consumption, and alleviate network transmission pressure. For example, in paged query or batch data processing scenarios, the amount of data returned by each query can be precisely controlled according to the data volume and system resource conditions.

(Ⅱ) API Definition

public static BatchSizeHintApi use(Integer batchSize) {
    // Specific implementation
}

use(Integer batchSize): Specify the batch size for queries by passing in an integer value. This integer represents the amount of data returned by each query. The special value -1 indicates no pagination, returning all data that meets the conditions at once.

(Ⅲ) Usage Examples

1. Precautions

Be sure to use the try - with - resources syntax when using DsHintApi and BatchSizeHintApi in the code. Failure to use this syntax may lead to problems such as data source confusion, affecting the accuracy of data queries and the stability of the system.

2. BatchSizeHintApi Usage Example

Within the try block, all query operations will be performed according to the specified batchSize.

  • Specify non-paged query (batchSize = -1)
try (BatchSizeHintApi batchSizeHintApi = BatchSizeHintApi.use(-1)) {
    PetShopProxy data2 = data.queryById();
    data2.fieldQuery(PetShopProxy::getPetTalents);
}

In the above example, BatchSizeHintApi.use(-1) indicates that the queries within the try block will not be paginated, returning all data that meets the conditions at once.

Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Meta Directive API
Next
Message Hub API
默认页脚
Copyright © 2026 Mr.Hope