add: multi-tenant
This commit is contained in:
@@ -15,24 +15,24 @@ import (
|
||||
// 实例化数据层 SysTenantImpl 结构体
|
||||
var NewSysTenantImpl = &SysTenantImpl{
|
||||
selectSql: `select
|
||||
t.tenant_id, t.parent_id, t.ancestors, t.tenant_name, t.order_num, t.type, t.key, t.status, t.del_flag, t.create_by, t.create_time
|
||||
t.tenant_id, t.parent_id, t.ancestors, t.tenant_name, t.order_num, t.tenancy_type, t.tenancy_key, t.status, t.del_flag, t.create_by, t.create_time
|
||||
from sys_tenant t`,
|
||||
|
||||
resultMap: map[string]string{
|
||||
"tenant_id": "TenantID",
|
||||
"parent_id": "ParentID",
|
||||
"ancestors": "Ancestors",
|
||||
"tenant_name": "TenantName",
|
||||
"order_num": "OrderNum",
|
||||
"type": "Type",
|
||||
"key": "Key",
|
||||
"status": "Status",
|
||||
"del_flag": "DelFlag",
|
||||
"create_by": "CreateBy",
|
||||
"create_time": "CreateTime",
|
||||
"update_by": "UpdateBy",
|
||||
"update_time": "UpdateTime",
|
||||
"parent_name": "ParentName",
|
||||
"tenant_id": "TenantID",
|
||||
"parent_id": "ParentID",
|
||||
"ancestors": "Ancestors",
|
||||
"tenant_name": "TenantName",
|
||||
"order_num": "OrderNum",
|
||||
"tenancy_type": "TenancyType",
|
||||
"tenancy_key": "TenancyKey",
|
||||
"status": "Status",
|
||||
"del_flag": "DelFlag",
|
||||
"create_by": "CreateBy",
|
||||
"create_time": "CreateTime",
|
||||
"update_by": "UpdateBy",
|
||||
"update_time": "UpdateTime",
|
||||
"parent_name": "ParentName",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ func (r *SysTenantImpl) SelectTenantListByRoleId(roleId string, tenantCheckStric
|
||||
// SelectTenantById 根据部门ID查询信息
|
||||
func (r *SysTenantImpl) SelectTenantById(tenantId string) model.SysTenant {
|
||||
querySql := `select t.tenant_id, t.parent_id, t.ancestors,
|
||||
t.tenant_name, t.order_num, t.type, t.key, t.status,
|
||||
t.tenant_name, t.order_num, t.tenancy_type, t.tenancy_key, t.status,
|
||||
(select tenant_name from sys_tenant where tenant_id = t.parent_id) parent_name
|
||||
from sys_tenant t where t.tenant_id = ?`
|
||||
results, err := datasource.RawDB("", querySql, []any{tenantId})
|
||||
@@ -249,11 +249,11 @@ func (r *SysTenantImpl) InsertTenant(sysTenant model.SysTenant) string {
|
||||
if sysTenant.OrderNum > 0 {
|
||||
params["order_num"] = sysTenant.OrderNum
|
||||
}
|
||||
if sysTenant.Type != "" {
|
||||
params["type"] = sysTenant.Type
|
||||
if sysTenant.TenancyType != "" {
|
||||
params["tenancy_type"] = sysTenant.TenancyType
|
||||
}
|
||||
if sysTenant.Key != "" {
|
||||
params["key"] = sysTenant.Key
|
||||
if sysTenant.TenancyKey != "" {
|
||||
params["tenancy_key"] = sysTenant.TenancyKey
|
||||
}
|
||||
if sysTenant.Status != "" {
|
||||
params["status"] = sysTenant.Status
|
||||
@@ -306,11 +306,11 @@ func (r *SysTenantImpl) UpdateTenant(sysTenant model.SysTenant) int64 {
|
||||
if sysTenant.OrderNum > 0 {
|
||||
params["order_num"] = sysTenant.OrderNum
|
||||
}
|
||||
if sysTenant.Type != "" {
|
||||
params["type"] = sysTenant.Type
|
||||
if sysTenant.TenancyType != "" {
|
||||
params["tenancy_type"] = sysTenant.TenancyType
|
||||
}
|
||||
if sysTenant.Key != "" {
|
||||
params["key"] = sysTenant.Key
|
||||
if sysTenant.TenancyKey != "" {
|
||||
params["tenancy_key"] = sysTenant.TenancyKey
|
||||
}
|
||||
if sysTenant.Status != "" {
|
||||
params["status"] = sysTenant.Status
|
||||
|
||||
Reference in New Issue
Block a user