qian_1109 2021-11-03 18:07 采纳率: 50%
浏览 39
已结题

文件上传时出现 Column “updated_by” 不能为空

文件上传时,文件可以上传到MinIo,但是数据库里面没有数据
Column “updated_by” cannot be null

img

以下是后台报错:
org.springframework.dao.DataIntegrityViolationException:

Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'updated_by' cannot be null

The error may exist in cn/esky/backend/file/dao/FileMapper.java (best guess)

The error may involve cn.esky.backend.file.dao.FileMapper.insert-Inline

The error occurred while setting parameters

SQL: INSERT INTO c_file ( id, biz_type, file_type, storage_type, bucket, path, url, unique_file_name, original_file_name, content_type, suffix, size, update_time, updated_by, create_time, created_by ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'updated_by' cannot be null

; Column 'updated_by' cannot be null; nested exception is java.sql.SQLIntegrityConstraintViolationException: Column 'updated_by' cannot be null
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:87)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)

img

img

  • 写回答

1条回答 默认 最新

  • 壹升茉莉清 宇信科技高级开发工程师 2021-11-03 18:54
    关注

    这个问题有以下几种方法:
    1.在数据库表中设置非必填。
    2.在程序中获取添加人,把这个字段添加进去
    3.如果你是使用的mybatisplus的话你可以根据api写一个专门处理一些无关业务的字段比如添加时间,创建人等等字段来进行自动插入

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月12日
  • 已采纳回答 11月4日
  • 创建了问题 11月3日

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line