diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index c8e83524..bcd369a4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -58,11 +58,26 @@ public class ResourceServiceImpl extends CrudServiceImpl getWrapper(Map params) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("type", params.get("type").toString()) - .like(StringUtils.isNotBlank(params.get("name").toString()),"name", params.get("name").toString()) - .orderByDesc("create_date") - .eq(StringUtils.isNotBlank(params.get("creator").toString()),"creator", params.get("creator").toString()) - .eq("del_flag", 0); + params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> { + switch (index) { + case "type": + wrapper.eq("type", params.get("type").toString()); + break; + case "name": + wrapper.like(StringUtils.isNotBlank(params.get("name").toString()),"name", params.get("name").toString()); + break; + case "creator": + wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()),"creator", params.get("creator").toString()); + break; + } + }); + +// wrapper.eq("type", params.get("type").toString()) +// .like(StringUtils.isNotBlank(params.get("name").toString()),"name", params.get("name").toString()) +// .orderByDesc("create_date") +// .eq(StringUtils.isNotBlank(params.get("creator").toString()),"creator", params.get("creator").toString()) +// .eq("del_flag", 0); + wrapper.orderByDesc("create_date").eq("del_flag", 0); return wrapper; }