问题
报错代码块:
if (menuIds.contains(menuId)) { // 判断是否与最上层删除的菜单相同
roleMenu2Mapper.deleteByPrimaryKey(roleMenuId); // 相同则删除
}
报错信息:
### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '91eab91ccb774dea976043ef1b7a'
### The error may involve com.yunsystem.system.mapper.RoleMenu2Mapper.deleteByPrimaryKey-Inline
### The error occurred while setting parameters
### SQL: DELETE FROM tb2_role_menu WHERE id = ? AND menu_id = ? AND role_id = ?
### Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '91eab91ccb774dea976043ef1b7a'
; Data truncation: Truncated incorrect DOUBLE value: '91eab91ccb774dea976043ef1b7a'; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '91eab91ccb774dea976043ef1b7a'
org.springframework.dao.DataIntegrityViolationException:
原因
请去看看你的xxxMapper对应的实体类XXX定义里字段是否明确了哪一个是主键!!!!!!!
喏,忘了加主键 @Id 了,mybatis不知道哪个是主键,所以你调用deletebyPrimaryKey方法删除时它不知道传入的参数应该匹配哪个,就这么简单~~~
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/157198.html