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; }