From 6610d7247527fdf06fed076ee3606fc62d078b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=99=E7=A2=8C=E8=98=91=E8=8F=87?= Date: Mon, 25 Mar 2019 11:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=A0=87=E8=AE=B0Query=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=EF=BC=8C=E5=B1=9E=E6=80=A7fuzzy=E4=B8=BAtrue=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=BF=9B=E8=A1=8C=E6=A8=A1=E7=B3=8A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=A4=84=E7=90=86=EF=BC=88=E6=B7=BB=E5=8A=A0%%?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/core/web/query/PageParam.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/web/query/PageParam.java b/admin-core/src/main/java/com/ibeetl/admin/core/web/query/PageParam.java index 74252339..cc133d90 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/web/query/PageParam.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/web/query/PageParam.java @@ -1,8 +1,11 @@ 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) { -- Gitee