{"record":{"id":"d49cab7d19b84a8f","repo":"jeecgboot/JeecgBoot","slug":"error-d49cab","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/SysTableWhiteListServiceImpl.java","lineNumber":68,"sourceCode":"            return true;\n        }\n        return false;\n    }\n\n    /**\n     * 检查需要新增或更新的实体是否符合规范\n     *\n     * @param sysTableWhiteList\n     */\n    private void checkEntity(SysTableWhiteList sysTableWhiteList) {\n        if (sysTableWhiteList == null) {\n            throw new JeecgBootException(\"操作失败，实体为空！\");\n        }\n        if (oConvertUtils.isEmpty(sysTableWhiteList.getTableName())) {\n            throw new JeecgBootException(\"操作失败，表名不能为空！\");\n        }\n        if (oConvertUtils.isEmpty(sysTableWhiteList.getFieldName())) {\n            throw new JeecgBootException(\"操作失败，字段名不能为空！\");\n        }\n        // 将表名和字段名转换成小写\n        sysTableWhiteList.setTableName(sysTableWhiteList.getTableName().toLowerCase());\n        sysTableWhiteList.setFieldName(sysTableWhiteList.getFieldName().toLowerCase());\n        // 如果status为空，则默认启用\n        if (oConvertUtils.isEmpty(sysTableWhiteList.getStatus())) {\n            sysTableWhiteList.setStatus(CommonConstant.STATUS_1);\n        }\n    }\n\n    @Override\n    public boolean deleteByIds(String ids) {\n        if (oConvertUtils.isEmpty(ids)) {\n            return false;\n        }\n        List<String> idList = Arrays.asList(ids.split(\",\"));\n        if (super.removeByIds(idList)) {\n            // 清空缓存","sourceCodeStart":50,"sourceCodeEnd":86,"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/SysTableWhiteListServiceImpl.java#L50-L86","documentation":"Thrown by SysTableWhiteListServiceImpl.checkEntity when sysTableWhiteList.getFieldName() is empty or null (checked via oConvertUtils.isEmpty). This JeecgBootException is the third validation in the chain, enforcing that every whitelist entry must specify a field name. It fires after the table-name check passes.","triggerScenarios":"Saving or updating a SysTableWhiteList where the fieldName field is null, empty string, or whitespace-only. The table name is provided but the field name is missing.","commonSituations":"Frontend form submitted with table name but missing field name; API call with incomplete JSON; programmatic caller set tableName but forgot fieldName.","solutions":["Add @NotBlank validation annotation on the fieldName field of SysTableWhiteList.","Ensure the frontend form requires both tableName and fieldName before submission.","If calling programmatically, set both tableName and fieldName before calling the service."],"exampleFix":"// before\nif (oConvertUtils.isEmpty(sysTableWhiteList.getFieldName())) {\n    throw new JeecgBootException(\"操作失败，字段名不能为空！\");\n}\n\n// after — bean validation on the entity\npublic class SysTableWhiteList {\n    @NotBlank(message = \"表名不能为空\")\n    private String tableName;\n    @NotBlank(message = \"字段名不能为空\")\n    private String fieldName;\n    // ...\n}","handlingStrategy":"validation","validationCode":"// Validate fieldName is non-empty before calling service\nif (sysTableWhiteList == null || oConvertUtils.isEmpty(sysTableWhiteList.getFieldName())) {\n    return Result.error(\"操作失败，字段名不能为空\");\n}\nservice.save(sysTableWhiteList);","typeGuard":"public boolean hasFieldName(SysTableWhiteList entity) {\n    return entity != null && oConvertUtils.isNotEmpty(entity.getFieldName());\n}","tryCatchPattern":"try {\n    service.save(sysTableWhiteList);\n} catch (JeecgBootException e) {\n    if (e.getMessage().contains(\"字段名不能为空\")) {\n        return Result.error(\"请填写字段名后重试\");\n    }\n    throw e;\n}","preventionTips":["Add @NotBlank on the fieldName field with bean validation.","Require both tableName and fieldName in the frontend form.","Use @Valid on the controller to reject invalid entities at the boundary."],"tags":["jeecg-boot","whitelist","validation","required-field","entity"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}