jeecgboot/JeecgBoot · error · JeecgBootException
字典数据不存在
Error message
字典数据不存在
What it means
Thrown by SysDictServiceImpl.editDictByLowAppId when baseMapper.selectById(id) returns null — the dictionary to be edited does not exist. This JeecgBootException guards the edit flow before attempting to compare lowAppId or update records. The same message is reused for both the not-found case (line 846) and the app-id-mismatch case (line 850), which can make debugging ambiguous.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java:846
}
return dictVoList;
}
@Override
public String addDictByLowAppId(SysDictVo sysDictVo) {
String[] dictResult = this.addDict(sysDictVo.getDictName(),sysDictVo.getLowAppId(),sysDictVo.getTenantId());
String id = dictResult[0];
String code = dictResult[1];
this.addDictItem(id,sysDictVo.getDictItemsList());
return code;
}
@Override
public void editDictByLowAppId(SysDictVo sysDictVo) {
String id = sysDictVo.getId();
SysDict dict = baseMapper.selectById(id);
if(null == dict){
throw new JeecgBootException("字典数据不存在");
}
//判断应用id和数据库中的是否一致,不一致不让修改
if(!dict.getLowAppId().equals(sysDictVo.getLowAppId())){
throw new JeecgBootException("字典数据不存在");
}
SysDict sysDict = new SysDict();
sysDict.setDictName(sysDictVo.getDictName());
sysDict.setId(id);
baseMapper.updateById(sysDict);
this.updateDictItem(id,sysDictVo.getDictItemsList());
// 删除字典缓存
redisUtil.removeAll(CacheConstant.SYS_DICT_CACHE + "::" + dict.getDictCode());
}
/**
* 还原逻辑删除
* @param ids
*/View on GitHub (pinned to 96fb33f5ec)
Solutions
- Refresh the dictionary list in the frontend to confirm the ID still exists.
- Add a distinct error message for the not-found case vs. the app-id-mismatch case to aid debugging.
- Check for concurrent deletion by another user or a cleanup job.
- Verify the dictionary ID is correctly passed from the frontend form.
Example fix
// before
SysDict dict = baseMapper.selectById(id);
if (null == dict) {
throw new JeecgBootException("字典数据不存在");
}
// after — use distinct messages for each failure
if (null == dict) {
throw new JeecgBootException("字典数据不存在(ID:" + id + ")");
}
if (!dict.getLowAppId().equals(sysDictVo.getLowAppId())) {
throw new JeecgBootException("字典不属于当前应用,无权修改");
} Defensive patterns
Strategy: validation
Validate before calling
// Validate dictionary exists before editing
SysDict dict = sysDictMapper.selectById(sysDictVo.getId());
if (dict == null) {
return Result.error("字典数据不存在,请刷新列表后重试");
}
service.editDictByLowAppId(sysDictVo); Type guard
public boolean isDictExists(String id) {
if (id == null || id.trim().isEmpty()) return false;
return sysDictMapper.selectById(id) != null;
} Try / catch
try {
service.editDictByLowAppId(sysDictVo);
} catch (JeecgBootException e) {
if (e.getMessage().contains("字典数据不存在")) {
return Result.error("字典已被删除,请刷新列表");
}
throw e;
} Prevention
- Refresh the dictionary list before editing.
- Check for concurrent deletions by other users.
- Use distinct error messages for 'not found' vs 'wrong app' to aid debugging.
When it happens
Trigger: Calling editDictByLowAppId with a dictionary ID that has been deleted, is from a different tenant, or doesn't exist. The dictionary ID comes from sysDictVo.getId().
Common situations: Editing a dictionary in a low-code app context where the dictionary was deleted by another user; stale frontend list data after a delete; cross-tenant access to a dictionary that doesn't exist in the current tenant scope.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/a084344d745dae85.
Report an issue: GitHub.