Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[错误报告]: com.baomidou.mybatisplus.extension.service.IService.remove(Wrapper<T> queryWrapper), 传入MPJLambdaWrapper参数, 如果两个表中都有逻辑删除字段, 如mybatis-plus.global-config.db-config.logic-delete-field: deleted, 报错java.sql.SQLIntegrityConstraintViolationException: Column 'deleted' in field list is ambiguous #227

Open
3 tasks done
geshichuangdi opened this issue Nov 15, 2024 · 0 comments

Comments

@geshichuangdi
Copy link

确认

  • 我的版本是最新版本, 我的版本号与 version 相同, 并且项目里无依赖冲突
  • 我已经在 issue 中搜索过, 确认问题没有被提出过
  • 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

1.5.1

问题描述

com.baomidou.mybatisplus.extension.service.IService.remove(Wrapper queryWrapper), 传入MPJLambdaWrapper参数, 如果两个表中都有逻辑删除字段, 如mybatis-plus.global-config.db-config.logic-delete-field: deleted, 报错java.sql.SQLIntegrityConstraintViolationException: Column 'deleted' in field list is ambiguous,
UPDATE user_role t LEFT JOIN user t1 ON (t1.id = t.user_id AND t1.deleted=0) SET deleted=1 WHERE t.deleted=0
综上; 问题原因是两个表都有deleted逻辑删除字段, remove函数设置deleted=1, 组装sql语句时没有指定哪张表的deleted字段

详细堆栈日志

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant