Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
ldp-docs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
doc
ldp-docs
Commits
4209dcf7
Commit
4209dcf7
authored
Jul 29, 2020
by
马超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 复杂查询完善文档
parent
d84b419c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
README.md
README.md
+1
-1
基于LDP框架的应用开发文档.md
基于LDP框架的应用开发文档.md
+2
-0
Hibernate条件查询工具类使用.md
开发文档/Hibernate条件查询工具类使用.md
+13
-1
No files found.
README.md
View file @
4209dcf7
...
...
@@ -30,4 +30,4 @@
5、
[
LDP本地数据库连接配置及使用
](
开发文档/LDP本地数据库连接配置及使用.md
)
\ No newline at end of file
6、
[
Hibernate条件查询工具类使用
](
开发文档/Hibernate条件查询工具类使用.md
)
\ No newline at end of file
基于LDP框架的应用开发文档.md
View file @
4209dcf7
...
...
@@ -1091,6 +1091,8 @@ public List<ExampleUserInfo> getUserListByJDBC(String sql, Map<String, Object> p
int executeTrans(LinkedList<TranscationQuery> listQuery);
</blockcode></pre>
</details>
#### 5.1.5 Hibernate查询扩展——复杂条件查询
Hibernate列表查询以及分页查询在普通的条件查询上做了扩展,可以Condition来做复杂的条件查询,需要使用 **HqlWhereHelper** 工具类来构建,条件的组合有以下几种:
...
...
开发文档/Hibernate条件查询工具类使用.md
View file @
4209dcf7
...
...
@@ -8,7 +8,7 @@ Hibernate 复杂查询需要依赖工具类—— **HqlWhereHelper** ,通过
LinkedList
<
Condition
>
conditions
=
HqlWhereHelper
.
getInstance
().
and
(
"key"
,
"value"
).
buildConditions
();
```
**HqlWhereHelper
**
条件之间分为AND和OR,sql参数过滤方式
**FilterType**
又分为EQUAL、NOTEQUAL、LIKE、IN、NOTIN
**HqlWhereHelper**
条件之间分为AND和OR,sql参数过滤方式
**FilterType**
又分为EQUAL、NOTEQUAL、LIKE、IN、NOTIN
|
**FilterType**
| 对应sql符号 |
| -------------- | ----------- |
...
...
@@ -96,6 +96,18 @@ LinkedList<Condition> conditions = HqlWhereHelper.getInstance().and("key","value
public
HqlWhereHelper
or
(
String
key
,
Object
value
,
FilterType
filterType
);
```
组合条件示例:
```
java
LinkedList
<
Condition
>
conditions
=
HqlWhereHelper
.
getInstance
()
.
or
(
"key1"
,
"value1"
)
.
or
(
"key2"
,
"value2"
)
.
and
(
"key3"
,
"value3"
)
.
andLike
(
"key4"
,
"value4"
)
.
orLike
(
"key5"
,
"value5"
)
.
buildConditions
();
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment