{"record":{"id":"a084344d745dae85","repo":"jeecgboot/JeecgBoot","slug":"error-a08434","errorCode":null,"errorMessage":"字典数据不存在","messagePattern":"字典数据不存在","errorType":"exception","errorClass":"JeecgBootException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java","lineNumber":846,"sourceCode":"\t\t}\n\t\treturn dictVoList;\n\t}\n\n\t@Override\n\tpublic String addDictByLowAppId(SysDictVo sysDictVo) {\n\t\tString[] dictResult = this.addDict(sysDictVo.getDictName(),sysDictVo.getLowAppId(),sysDictVo.getTenantId());\n\t\tString id = dictResult[0];\n\t\tString code = dictResult[1];\n\t\tthis.addDictItem(id,sysDictVo.getDictItemsList());\n\t\treturn code;\n\t}\n\n\t@Override\n\tpublic void editDictByLowAppId(SysDictVo sysDictVo) {\n\t\tString id = sysDictVo.getId();\n\t\tSysDict dict = baseMapper.selectById(id);\n\t\tif(null == dict){\n\t\t\tthrow new JeecgBootException(\"字典数据不存在\");\n\t\t}\n\t\t//判断应用id和数据库中的是否一致，不一致不让修改\n\t\tif(!dict.getLowAppId().equals(sysDictVo.getLowAppId())){\n\t\t\tthrow new JeecgBootException(\"字典数据不存在\");\n\t\t}\n\t\tSysDict sysDict = new SysDict();\n\t\tsysDict.setDictName(sysDictVo.getDictName());\n\t\tsysDict.setId(id);\n\t\tbaseMapper.updateById(sysDict);\n\t\tthis.updateDictItem(id,sysDictVo.getDictItemsList());\n\t\t// 删除字典缓存\n\t\tredisUtil.removeAll(CacheConstant.SYS_DICT_CACHE + \"::\" + dict.getDictCode());\n\t}\n\n\t/**\n\t * 还原逻辑删除\n\t * @param ids\n\t */","sourceCodeStart":828,"sourceCodeEnd":864,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDictServiceImpl.java#L828-L864","documentation":"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.","triggerScenarios":"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().","commonSituations":"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.","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."],"exampleFix":"// before\nSysDict dict = baseMapper.selectById(id);\nif (null == dict) {\n    throw new JeecgBootException(\"字典数据不存在\");\n}\n\n// after — use distinct messages for each failure\nif (null == dict) {\n    throw new JeecgBootException(\"字典数据不存在(ID:\" + id + \")\");\n}\nif (!dict.getLowAppId().equals(sysDictVo.getLowAppId())) {\n    throw new JeecgBootException(\"字典不属于当前应用，无权修改\");\n}","handlingStrategy":"validation","validationCode":"// Validate dictionary exists before editing\nSysDict dict = sysDictMapper.selectById(sysDictVo.getId());\nif (dict == null) {\n    return Result.error(\"字典数据不存在，请刷新列表后重试\");\n}\nservice.editDictByLowAppId(sysDictVo);","typeGuard":"public boolean isDictExists(String id) {\n    if (id == null || id.trim().isEmpty()) return false;\n    return sysDictMapper.selectById(id) != null;\n}","tryCatchPattern":"try {\n    service.editDictByLowAppId(sysDictVo);\n} catch (JeecgBootException e) {\n    if (e.getMessage().contains(\"字典数据不存在\")) {\n        return Result.error(\"字典已被删除，请刷新列表\");\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["jeecg-boot","dictionary","null-check","business-exception"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}