jeecgboot/JeecgBoot · warning · JeecgBootException

[白名单] 表名已存在,但是已被禁用,请先启用!tableName={tableName}

Error message

[白名单] 表名已存在,但是已被禁用,请先启用!tableName={tableName}

What it means

Thrown by autoAdd when a SysTableWhiteList row for the given (lower-cased) tableName already exists but its status equals CommonConstant.STATUS_0 (disabled). The system refuses to silently merge fields into a disabled entry because the operator must consciously re-enable it. The error message appends the offending tableName for traceability.

Source

Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTableWhiteListServiceImpl.java:111

    @Override
    public SysTableWhiteList autoAdd(String tableName, String fieldName) {
        if (oConvertUtils.isEmpty(tableName)) {
            throw new JeecgBootException("操作失败,表名不能为空!");
        }
        if (oConvertUtils.isEmpty(fieldName)) {
            throw new JeecgBootException("操作失败,字段名不能为空!");
        }
        // 统一转换成小写
        tableName = tableName.toLowerCase();
        fieldName = fieldName.toLowerCase();
        // 查询是否已经存在
        LambdaQueryWrapper<SysTableWhiteList> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysTableWhiteList::getTableName, tableName);
        SysTableWhiteList getEntity = super.getOne(queryWrapper);
        if (getEntity != null) {
            // 如果已经存在,并且已禁用,则抛出异常
            if (CommonConstant.STATUS_0.equals(getEntity.getStatus())) {
                throw new JeecgBootException("[白名单] 表名已存在,但是已被禁用,请先启用!tableName=" + tableName);
            }
            // 合并字段
            Set<String> oldFieldSet = new HashSet<>(Arrays.asList(getEntity.getFieldName().split(",")));
            Set<String> newFieldSet = new HashSet<>(Arrays.asList(fieldName.split(",")));
            oldFieldSet.addAll(newFieldSet);
            getEntity.setFieldName(String.join(",", oldFieldSet));
            this.checkEntity(getEntity);
            super.updateById(getEntity);
            log.info("修改表单白名单项,表名:{},oldFieldSet: {},newFieldSet:{}", tableName, oldFieldSet.toArray(), newFieldSet.toArray());
            return getEntity;
        } else {
            // 新增白名单项
            SysTableWhiteList saveEntity = new SysTableWhiteList();
            saveEntity.setTableName(tableName);
            saveEntity.setFieldName(fieldName);
            saveEntity.setStatus(CommonConstant.STATUS_1);
            this.checkEntity(saveEntity);
            super.save(saveEntity);

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Open the whitelist management page (system menu), find the entry for the tableName shown in the error, and set its status to enabled.
  2. Programmatically enable it first: load the entity, setStatus(STATUS_1), updateById, then call autoAdd.
  3. If the disabled entry is stale, delete it so autoAdd creates a fresh enabled record.
  4. Audit who/what disabled the entry (check update_by / update_time on the row) to prevent recurrence.

Example fix

// before
whiteListService.autoAdd(tableName, fieldName);

// after
SysTableWhiteList existing = whiteListService.getOne(
    new LambdaQueryWrapper<SysTableWhiteList>()
        .eq(SysTableWhiteList::getTableName, tableName.toLowerCase()));
if (existing != null && CommonConstant.STATUS_0.equals(existing.getStatus())) {
    existing.setStatus(CommonConstant.STATUS_1);
    whiteListService.updateById(existing);
}
whiteListService.autoAdd(tableName, fieldName);
Defensive patterns

Strategy: try-catch

Validate before calling

SysTableWhiteList ex = whiteListService.getOne(new LambdaQueryWrapper<SysTableWhiteList>()
    .eq(SysTableWhiteList::getTableName, tableName.toLowerCase()));
if (ex != null && CommonConstant.STATUS_0.equals(ex.getStatus())) {
    ex.setStatus(CommonConstant.STATUS_1);
    whiteListService.updateById(ex);
}

Try / catch

try {
    whiteListService.autoAdd(tableName, fieldName);
} catch (JeecgBootException e) {
    if (e.getMessage().contains("已被禁用")) {
        // prompt user to enable, or auto-enable then retry once
    }
    throw e;
}

Prevention

When it happens

Trigger: autoAdd is called for a table that was previously whitelisted then disabled (status set to 0) by an admin, and a new form/field registration now tries to add to it. The lookup queryWrapper.eq(tableName) returns the disabled row, triggering the branch.

Common situations: A table was decommissioned and its whitelist entry disabled, but a lingering online form or scheduled sync still calls autoAdd; re-importing an old form after a table rename/disable cycle; manual DB status edit left a row disabled.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/66b8b17a0fa02464. Report an issue: GitHub.