This is an automated email from the ASF dual-hosted git repository.

panyuepeng pushed a commit to branch dev
in repository 
https://gitbox.apache.org/repos/asf/incubator-streampark-website.git


The following commit(s) were added to refs/heads/dev by this push:
     new d7adcfdb [Improve] Update mapper name rule (#277)
d7adcfdb is described below

commit d7adcfdb2379c7a5cce8a463f2b2dec65c67ac3c
Author: VampireAchao <[email protected]>
AuthorDate: Tue Oct 24 09:18:18 2023 +0800

    [Improve] Update mapper name rule (#277)
---
 community/submit_guide/code-style-and-quality-guide.md    | 13 +++++++++++--
 .../current/submit_guide/code-style-and-quality-guide.md  | 15 ++++++++++++---
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/community/submit_guide/code-style-and-quality-guide.md 
b/community/submit_guide/code-style-and-quality-guide.md
index 0c3dbde9..02ee2704 100644
--- a/community/submit_guide/code-style-and-quality-guide.md
+++ b/community/submit_guide/code-style-and-quality-guide.md
@@ -102,9 +102,18 @@ sidebar_position: 3
 
 5. The methods name of basic `CRUD` of the database layer (non-service layer) 
should be uniformly standardized according to name 
`com.baomidou.mybatisplus.core.mapper.BaseMapper`:
 
-   If perform a database select operation, the name of the method should be 
started with `select`.
+    - If performing a database query operation, the method name should start 
with `select`.
 
-   For example, `selectById`, `selectByXxx`, `selectPageByXxx`
+      When querying a single record, you can use `selectXxx`, such as 
`selectApp`.
+
+      When querying multiple records, you can use `selectXxxs` to indicate a 
collection result, such as `selectApps`. If the entity ends with `s`, you can 
use `List`, such as `selectStatusList`.
+
+      If the result is paginated, you can use `selectPage`. If the result is a 
`Map`, it is recommended to follow the `Map` naming conventions, such as 
`selectIdUserMap`.
+
+      When the query includes specific conditions, you can use 
`selectXxxByXxx` naming, such as `listById` or `selectAppsByProjectId`.
+
+      > In cases of excessively long entity names, consider abbreviating 
judiciously. The principle is to be “clear and concise.” For example, 
`selectApplications` can be abbreviated to `selectApps`. However, if there is 
no suitable abbreviation, abbreviation is not recommended.
+      > For `Mapper` queries like `selectRecentK8sClusterIds`, you can also 
adopt the `selectList` naming convention.
 
     - If perform a database <mark> update </mark> statement operation, the 
name of the method should be started with `update`
     - If perform a database <mark> insert </mark> statement operation, the 
name of the method should be started with `insert`
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/submit_guide/code-style-and-quality-guide.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/submit_guide/code-style-and-quality-guide.md
index 6b5d120d..5cd2a3a0 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/submit_guide/code-style-and-quality-guide.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs-community/current/submit_guide/code-style-and-quality-guide.md
@@ -102,9 +102,18 @@ sidebar_position: 3
 
 5. 数据库层(非服务层)的基本 `CRUD` 的方法名称应根据 
`com.baomidou.mybatisplus.core.mapper.BaseMapper` 的名称统一标准化:
 
-   如果执行数据库选择操作,方法的名称应以 `select` 开头。
+   - 如果执行数据库查询操作,方法的名称应以 `select` 开头。
 
-   例如,`selectById`、`selectByXxx`、`selectPageByXxx`
+     当查询单条记录时可以使用`selectXxx`,例如`selectApp`
+   
+     
当查询多条记录时可以使用`selectXxxs`表示集合结果,例如`selectApps`,如果实体以`s`结尾,可以使用`List`如`selectStatusList`;
+
+     如果是分页结果,则可以使用`selectPage`;如果是`Map`结果,建议参考`Map`命名规则如`selectIdUserMap`
+   
+     当查询包含具体条件时可以使用`selectXxxByXxx`命名,例如`listById`、`selectAppsByProjectId`
+     
+     > 
如遇到太长的实体可以酌情缩写,原则是“见名知意”且做到不啰嗦,例如`selectApplications`缩写为`selectApps`,但如果没有合适的缩写,不建议缩写
+     > 如果是`Mapper`查询`selectRecentK8sClusterIds`,则也可以采取`selectList`命名
 
     - 如果执行数据库的 <mark> 更新 </mark> 语句操作,方法的名称应以 `update` 开头。
     - 如果执行数据库的 <mark> 插入 </mark> 语句操作,方法的名称应以 `insert` 开头。
@@ -113,7 +122,7 @@ sidebar_position: 3
 6. 服务层的基本 `CRUD` 方法命名应参考 `com.baomidou.mybatisplus.extension.service.IService`:
 
     - 如果执行数据库的 <mark> 选择 </mark> 操作来查询多个记录,方法的名称应以 `list` 开头,例如 
`listByIds`、`listByXxx`。
-    - 如果执行数据库的 <mark> 选择 </mark> 操作查询单个记录,方法的名称应以 get 开头,例如 `getByName` 和 
`getOne`。
+    - 如果执行数据库的 <mark> 选择 </mark> 操作查询单个记录,方法的名称应以 `get` 开头,例如 `getByName` 和 
`getOne`。
     - 如果执行数据库的 <mark> 更新 </mark> 操作,方法的名称应以 `update` 开头。
     - 如果执行数据库的 <mark> 插入 </mark> 操作,方法的名称应以 `save` 开头。
     - 如果执行数据库的 <mark> 删除 </mark> 操作,方法的名称应以 `remove` 开头。

Reply via email to