This commit is contained in:
wangliwen 2022-04-29 16:47:34 +08:00
parent a64b56dd14
commit 604ddc049e
1 changed files with 20 additions and 5 deletions

View File

@ -58,11 +58,26 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ResourceEntity> 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;
}