Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
6610d724
Commit
6610d724
authored
Mar 25, 2019
by
忙碌蘑菇
Browse files
对标记Query注解,属性fuzzy为true的字段进行模糊查询处理(添加%%)
parent
c357515e
Changes
1
Hide whitespace changes
Inline
Side-by-side
admin-core/src/main/java/com/ibeetl/admin/core/web/query/PageParam.java
View file @
6610d724
package
com.ibeetl.admin.core.web.query
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.ibeetl.admin.core.annotation.Query
;
import
org.beetl.sql.core.engine.PageQuery
;
import
java.lang.reflect.Field
;
/**
* 子类继承此类获得翻页功能
* @author lijiazhi
...
...
@@ -21,6 +24,26 @@ public class PageParam {
@JsonIgnore
public
PageQuery
getPageQuery
()
{
Field
[]
fs
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
f:
fs
){
Query
query
=
f
.
getAnnotation
(
Query
.
class
);
if
(
query
==
null
){
continue
;
}
if
(
query
.
fuzzy
())
{
try
{
if
(
f
.
getType
()
==
String
.
class
)
{
f
.
setAccessible
(
true
);
Object
o
=
f
.
get
(
this
);
if
(
o
!=
null
&&
!
o
.
toString
().
isEmpty
())
{
f
.
set
(
this
,
"%"
+
o
.
toString
()+
"%"
);
}
}
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
}
PageQuery
query
=
new
PageQuery
();
query
.
setParas
(
this
);
if
(
page
!=
null
)
{
...
...
Write
Preview
Supports
Markdown
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