返回列表 发布新帖

[问题求助] DAP中使用Mybatis, 查询不到资料,请问是什么问题导致的?

26 1
发表于 2024-12-27 23:30:06 | 查看全部 阅读模式
问答

紧急程度

已完结
在云上数据库直接下SQL查得到资料, 但透过Mybatis, 未报错, 但资料笔数为0

最佳答案

查看完整内容

以当前问题来说, 目前在application.properties, tenantEnabled为true 当tenantEnabled为true, 会将tenantColumnname所设定的值(一般是tenantsid)自动加到SQL的where条件中, 例如, select a from tableA where b = "1"会变成select a from tableA where b = "1" and tenantsid = "123456" 但你在服务的interfase又设定@AllowAnonymous(匿名调用) 当使用@AllowAnonymous, 平台不会验证服务呼叫者的合法性, 也就不会将资料纪录, 所 ...

评论1

許哲瑋楼主Lv.2 发表于 2024-12-27 23:30:06 | 查看全部
以当前问题来说, 目前在application.properties, tenantEnabled为true
当tenantEnabled为true, 会将tenantColumnname所设定的值(一般是tenantsid)自动加到SQL的where条件中,
例如, select a from tableA where b = "1"会变成select a from tableA where b = "1" and tenantsid = "123456"
但你在服务的interfase又设定@AllowAnonymous(匿名调用)
当使用@AllowAnonymous, 平台不会验证服务呼叫者的合法性, 也就不会将资料纪录, 所以两相加的情况下, 就会把tenantsid = null组入导致没有资料

回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 关注公众号
Copyright © 2025 鼎捷數智股份有限公司 版权所有 All Rights Reserved. Powered by Discuz! X5.0
关灯 在本版发帖
即将开放
返回顶部
快速回复 返回顶部 返回列表