报错信息
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'sys_patient_info.user_id' ### The error may exist in file [D:\learn\Project\RuoYi-Vue-master\ruoyi-system\target\classes\mapper\system\SysUserMapper.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into sys_patient_info(emergency_contact, emergency_contact_phone, user_id) values (?, ?, ?) ### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'sys_patient_info.user_id' ; Duplicate entry '1' for key 'sys_patient_info.user_id'; nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'sys_patient_info.user_id'
报错原因
这个错误信息表明您在尝试向sys_patient_info
表中插入一条新记录时,遇到了主键或唯一索引冲突的错误。具体来说,错误信息指出Duplicate entry '1' for key 'sys_patient_info.user_id'
,意味着您试图插入的user_id
值1已经在sys_patient_info
表的user_id
字段中存在,违反了唯一性约束。
解决方法
把user_id的值改成表中没有的数据