mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-25 03:48:35 +08:00
【feat】 添加postgresql数据库支持,【修复】pg数据库的代码生成功能
This commit is contained in:
@@ -134,8 +134,13 @@ func (m *sysRoleModel) GetRoleOrganizationId(data entity.SysRole) []int64 {
|
||||
|
||||
func (m *sysRoleModel) FindOrganizationsByRoleId(roleId int64) (entity.SysRole, error) {
|
||||
var roleData entity.SysRole
|
||||
err := global.Db.Table(m.table).
|
||||
Select("sys_roles.data_scope, GROUP_CONCAT(sys_role_organizations.organization_id) as org").
|
||||
db := global.Db.Table(m.table)
|
||||
if global.Conf.Server.DbType == "mysql" {
|
||||
db.Select("sys_roles.data_scope, GROUP_CONCAT(sys_role_organizations.organization_id) as org")
|
||||
} else {
|
||||
db.Select("sys_roles.data_scope, STRING_AGG(sys_role_organizations.organization_id::text,',') as org")
|
||||
}
|
||||
err := db.
|
||||
Joins("LEFT JOIN sys_role_organizations ON sys_roles.role_id = sys_role_organizations.role_id").
|
||||
Where("sys_roles.role_id = ?", roleId).
|
||||
Group("sys_roles.role_id").
|
||||
|
||||
Reference in New Issue
Block a user