This commit is contained in:
wangliwen 2022-10-29 11:07:23 +08:00
parent b15402adad
commit 105047f346
1 changed files with 5 additions and 9 deletions

View File

@ -31,10 +31,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
@Override
public PageData<SysDictTypeDTO> page(Map<String, Object> params) {
IPage<SysDictTypeEntity> page = baseDao.selectPage(
getPage(params, "sort", true),
getWrapper(params)
);
IPage<SysDictTypeEntity> page = baseDao.selectPage(getPage(params, "sort", true), getWrapper(params));
return getPageData(page, SysDictTypeDTO.class);
}
@ -42,15 +39,14 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeDao, SysD
private QueryWrapper<SysDictTypeEntity> getWrapper(Map<String, Object> 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<SysDictTypeEntity> 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;
}