fix: multi-tenant phase 2

This commit is contained in:
2024-06-26 10:30:53 +08:00
parent 267904be29
commit f514818e5d
16 changed files with 56 additions and 37 deletions

View File

@@ -236,6 +236,7 @@ func (r *SysTenantImpl) IsUniqueTenancy(sysTenant model.SysTenant) bool {
// 查询条件拼接
var conditions []string
var params []any
if sysTenant.TenantID != "" {
conditions = append(conditions, "tenant_id != ?")
params = append(params, sysTenant.TenantID)
@@ -245,8 +246,9 @@ func (r *SysTenantImpl) IsUniqueTenancy(sysTenant model.SysTenant) bool {
params = append(params, sysTenant.TenancyType)
}
if sysTenant.TenancyKey != "" {
conditions = append(conditions, "? like tenancy_key")
params = append(params, sysTenant.TenancyKey)
conditions = append(conditions, "(? like tenancy_key or tenancy_key like ?)")
//conditions = append(conditions, "(LOCATE(?, tenancy_key)>0 or LOCATE(tenancy_key, ?)>0)")
params = append(params, sysTenant.TenancyKey, sysTenant.TenancyKey)
}
// 构建查询条件语句