From 105047f346987dc1a932c5f146fe889bc4cdc6ee Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 29 Oct 2022 11:07:23 +0800 Subject: [PATCH] 500 --- .../sys/service/impl/SysDictTypeServiceImpl.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java index 48776078..da309c9a 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysDictTypeServiceImpl.java @@ -31,10 +31,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, "sort", true), - getWrapper(params) - ); + IPage page = baseDao.selectPage(getPage(params, "sort", true), getWrapper(params)); return getPageData(page, SysDictTypeDTO.class); } @@ -42,15 +39,14 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl getWrapper(Map params) { String dictType = (String) params.get("dictType"); String dictName = (String) params.get("dictName"); - - String dictLabel = (String) params.get("dictLabel"); - String dictValue = (String) params.get("dictValue"); + String dictLabel = params.containsKey("dictLabel") ? (String) params.get("dictLabel") : ""; + String dictValue = params.containsKey("dictValue") ? (String) params.get("dictValue") : ""; QueryWrapper wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(dictType), "dict_type", dictType); wrapper.like(StringUtils.isNotBlank(dictName), "dict_name", dictName); - wrapper.exists(StringUtils.isNotBlank(dictLabel), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_label LIKE CONCAT( '%', '%s', '%' ) ", dictLabel)); - wrapper.exists(StringUtils.isNotBlank(dictValue), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_value =1", dictValue)); + wrapper.exists(StringUtils.isNotEmpty(dictLabel), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_label LIKE CONCAT( '%%', '%s', '%%' ) ", dictLabel)); + wrapper.exists(StringUtils.isNotEmpty(dictValue), String.format("SELECT 1 FROM sys_dict_data sdd WHERE sdd.dict_type_id = sys_dict_type.id AND sdd.dict_value =1", dictValue)); return wrapper; }