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 7425233925ebe9e683a4c7dac12e0c1ea4ce81fe..cc133d90beaf9fd837621f938413610ec018757a 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) {