ai-engineering-init 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,29 +251,30 @@ public PageVO<XxxVO> pageList(XxxPageParam param) {
251
251
  ### 带合计行的导出
252
252
 
253
253
  ```java
254
+ // ⚠️ 系统默认在商户库执行,业务查询无需 Executors.readInSystem()
255
+ // Executors.readInSystem() 仅用于需要访问系统库的场景(如全局配置、商户管理)
256
+
254
257
  public ReportBaseTotalVO<XxxVO> pageWithTotal(XxxPageParam param) {
255
- return Executors.readInSystem(() -> {
256
- ReportBaseTotalVO<XxxVO> result = new ReportBaseTotalVO<>();
257
-
258
- // 1. 导出时不查询合计行(避免不必要的性能开销)
259
- if (CollUtil.isEmpty(param.getExportCols())) {
260
- XxxVO totalLine = mapper.getSummaryTotal(param);
261
- result.setTotalLine(totalLine);
262
- }
263
-
264
- // 2. 导出时不分页
265
- if (CollUtil.isNotEmpty(param.getExportCols())) {
266
- List<XxxVO> list = mapper.getSummaryList(param);
267
- result.setResultPage(PageVO.of(list));
268
- } else {
269
- // 正常分页查询
270
- PageMethod.startPage(param);
271
- List<XxxVO> list = mapper.getSummaryList(param);
272
- result.setResultPage(PageVO.of(list));
273
- }
274
-
275
- return result;
276
- });
258
+ ReportBaseTotalVO<XxxVO> result = new ReportBaseTotalVO<>();
259
+
260
+ // 1. 导出时不查询合计行(避免不必要的性能开销)
261
+ if (CollUtil.isEmpty(param.getExportCols())) {
262
+ XxxVO totalLine = mapper.getSummaryTotal(param);
263
+ result.setTotalLine(totalLine);
264
+ }
265
+
266
+ // 2. 导出时不分页
267
+ if (CollUtil.isNotEmpty(param.getExportCols())) {
268
+ List<XxxVO> list = mapper.getSummaryList(param);
269
+ result.setResultPage(PageVO.of(list));
270
+ } else {
271
+ // 正常分页查询
272
+ PageMethod.startPage(param);
273
+ List<XxxVO> list = mapper.getSummaryList(param);
274
+ result.setResultPage(PageVO.of(list));
275
+ }
276
+
277
+ return result;
277
278
  }
278
279
  ```
279
280
 
@@ -24,7 +24,7 @@ description: |
24
24
  |------|------|
25
25
  | **包名前缀** | `net.xnzn.core.*` |
26
26
  | **JDK 版本** | 21 |
27
- | **跨租户工具** | `Executors.readInSystem()` |
27
+ | **双库切换** | 默认商户库,`Executors.doInSystem()` 切换系统库 |
28
28
  | **分页工具** | `PageMethod.startPage()` |
29
29
  | **结果封装** | `ReportBaseTotalVO<T>` |
30
30
  | **分页封装** | `PageVO.of()` |
@@ -38,32 +38,32 @@ description: |
38
38
  ### 带合计行的分页查询
39
39
 
40
40
  ```java
41
- import net.xnzn.framework.data.executor.Executors;
42
41
  import net.xnzn.core.common.page.PageMethod;
43
42
  import net.xnzn.core.common.page.PageVO;
44
43
  import net.xnzn.core.common.vo.ReportBaseTotalVO;
45
44
  import cn.hutool.core.collection.CollUtil;
46
45
 
46
+ // ⚠️ 系统默认在商户库执行,业务查询无需 Executors.readInSystem()
47
+ // Executors.readInSystem() 仅用于需要访问系统库的场景(如全局配置、商户管理)
48
+
47
49
  public ReportBaseTotalVO<XxxVO> pageWithTotal(XxxPageParam param) {
48
- return Executors.readInSystem(() -> {
49
- ReportBaseTotalVO<XxxVO> result = new ReportBaseTotalVO<>();
50
+ ReportBaseTotalVO<XxxVO> result = new ReportBaseTotalVO<>();
50
51
 
51
- // 1. 导出时不查询合计行(避免不必要的性能开销)
52
- if (CollUtil.isEmpty(param.getExportCols())) {
53
- XxxVO totalLine = mapper.getSummaryTotal(param);
54
- result.setTotalLine(totalLine);
55
- }
52
+ // 1. 导出时不查询合计行(避免不必要的性能开销)
53
+ if (CollUtil.isEmpty(param.getExportCols())) {
54
+ XxxVO totalLine = mapper.getSummaryTotal(param);
55
+ result.setTotalLine(totalLine);
56
+ }
56
57
 
57
- // 2. 开启分页
58
- PageMethod.startPage(param.getPage());
58
+ // 2. 开启分页
59
+ PageMethod.startPage(param.getPage());
59
60
 
60
- // 3. 查询数据
61
- List<XxxVO> list = mapper.getSummaryList(param);
61
+ // 3. 查询数据
62
+ List<XxxVO> list = mapper.getSummaryList(param);
62
63
 
63
- // 4. 封装分页结果
64
- result.setResultPage(PageVO.of(list));
65
- return result;
66
- });
64
+ // 4. 封装分页结果
65
+ result.setResultPage(PageVO.of(list));
66
+ return result;
67
67
  }
68
68
  ```
69
69
 
@@ -71,7 +71,8 @@ public ReportBaseTotalVO<XxxVO> pageWithTotal(XxxPageParam param) {
71
71
 
72
72
  ```java
73
73
  public XxxVO getSummaryTotal(XxxPageParam param) {
74
- return Executors.readInSystem(() -> mapper.getSummaryTotal(param));
74
+ // 默认在商户库执行,无需 Executors 包装
75
+ return mapper.getSummaryTotal(param);
75
76
  }
76
77
  ```
77
78
 
@@ -190,6 +191,6 @@ public void exportExcel(XxxParam param, HttpServletResponse response) {
190
191
  ## 注意事项
191
192
 
192
193
  - 合计SQL只返回数值字段,不返回字符串、ID、名称等
193
- - 使用 `Executors.readInSystem()` 跨租户查询
194
+ - 业务查询默认在商户库执行,无需 `Executors` 包装;仅访问系统库数据时才使用 `Executors.doInSystem()`
194
195
  - 导出时通过 `exportCols` 判断是否需要合计行
195
196
  - 金额字段类型与 Entity 保持一致:订单模块用 `BigDecimal`,钱包模块用 `Long`(详见 leniu-java-amount-handling)