jeecgboot/JeecgBoot · error · JeecgBootException
操作失败,表名不能为空!
Error message
操作失败,表名不能为空!
What it means
Thrown by SysTableWhiteListServiceImpl.checkEntity when sysTableWhiteList.getTableName() is empty or null (checked via oConvertUtils.isEmpty). This JeecgBootException enforces that every whitelist entry must specify a table name. The check runs before the table name is lowercased and persisted.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTableWhiteListServiceImpl.java:65
if (super.updateById(sysTableWhiteList)) {
// 清空缓存
whiteListHandler.clear();
return true;
}
return false;
}
/**
* 检查需要新增或更新的实体是否符合规范
*
* @param sysTableWhiteList
*/
private void checkEntity(SysTableWhiteList sysTableWhiteList) {
if (sysTableWhiteList == null) {
throw new JeecgBootException("操作失败,实体为空!");
}
if (oConvertUtils.isEmpty(sysTableWhiteList.getTableName())) {
throw new JeecgBootException("操作失败,表名不能为空!");
}
if (oConvertUtils.isEmpty(sysTableWhiteList.getFieldName())) {
throw new JeecgBootException("操作失败,字段名不能为空!");
}
// 将表名和字段名转换成小写
sysTableWhiteList.setTableName(sysTableWhiteList.getTableName().toLowerCase());
sysTableWhiteList.setFieldName(sysTableWhiteList.getFieldName().toLowerCase());
// 如果status为空,则默认启用
if (oConvertUtils.isEmpty(sysTableWhiteList.getStatus())) {
sysTableWhiteList.setStatus(CommonConstant.STATUS_1);
}
}
@Override
public boolean deleteByIds(String ids) {
if (oConvertUtils.isEmpty(ids)) {
return false;
}View on GitHub (pinned to 96fb33f5ec)
Solutions
- Add @NotBlank validation annotation on the tableName field of SysTableWhiteList with @Valid on the controller.
- Ensure the frontend form requires tableName before allowing submission.
- If calling programmatically, set the tableName before calling the service.
Example fix
// before
if (oConvertUtils.isEmpty(sysTableWhiteList.getTableName())) {
throw new JeecgBootException("操作失败,表名不能为空!");
}
// after — bean validation at the entity level
public class SysTableWhiteList {
@NotBlank(message = "表名不能为空")
private String tableName;
// ...
}
// Controller:
public Result<?> save(@Valid @RequestBody SysTableWhiteList entity) { ... } Defensive patterns
Strategy: validation
Validate before calling
// Validate tableName is non-empty before calling service
if (sysTableWhiteList == null || oConvertUtils.isEmpty(sysTableWhiteList.getTableName())) {
return Result.error("操作失败,表名不能为空");
}
service.save(sysTableWhiteList); Type guard
public boolean hasTableName(SysTableWhiteList entity) {
return entity != null && oConvertUtils.isNotEmpty(entity.getTableName());
} Try / catch
try {
service.save(sysTableWhiteList);
} catch (JeecgBootException e) {
if (e.getMessage().contains("表名不能为空")) {
return Result.error("请填写表名后重试");
}
throw e;
} Prevention
- Add @NotBlank on the tableName field with bean validation.
- Require tableName in the frontend form before submission.
- Use @Valid on the controller @RequestBody to fail fast.
When it happens
Trigger: Saving or updating a SysTableWhiteList where the tableName field is null, empty string, or whitespace-only. The request body omitted the tableName field or it was set to an empty value.
Common situations: Frontend form submitted without filling in the table name field; API call with a partial JSON body missing tableName; programmatic caller forgot to set the field.
Related errors
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/00a36700e1cc379d.
Report an issue: GitHub.