查询当前用户分配的角色接口报错

hzero-iam 1.5.2版本hzero/v1/roles/self/assigned-roles接口报错


报错日志:
2021-01-22 14:16:59.437 WARN 16884 — [ XNIO-3 task-95] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: java.sql.SQLException: Operand should contain 1 column(s)

The error may exist in URL [jar:file:/C:/Users/zhihu/repository/org/hzero/hzero-iam/1.5.2.RELEASE/hzero-iam-1.5.2.RELEASE.jar!/mapper/RoleMapper.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: select count(0) from (select ir.id, ir.code as code, irt.name as name, ir.description, ir.fd_level, ir.h_tenant_id, ht.tenant_num, httl.tenant_name, case when ( ir.code in (?, ?) or exists ( select 1 from iam_menu ps join iam_role_permission irp on (irp.permission_id = ps.id and irp.type = ‘PS’) where irp.role_id = ir.id and (irp.h_create_flag = ‘Y’ or irp.h_inherit_flag = ‘Y’) and ps.type = ‘ps’ and ps.h_enabled_flag = 1 and ps.code like ? ) ) then 1 else 0 end AS admin_flag, opp.enable_role_inherit, opp.enable_role_allocate, case when opp.enable_role_permission = 1 then 1 when opp.enable_role_permission = 0 and ( ir.code in (?, ?) or exists ( select 1 from hiam_label_rel hlr join iam_label il on (hlr.label_id = il.id) where hlr.data_id = ir.id and hlr.data_type = ‘ROLE’ and hlr.assign_type = ‘A’ and il.name = ? ) ) then 1 else 0 end as enable_role_permission from iam_role ir join iam_role_tl irt on (ir.id = irt.id and irt.lang = ?) join hpfm_tenant ht on ht.tenant_id = ir.h_tenant_id left join hpfm_tenant_tl httl ON ht.tenant_id = httl.tenant_id AND httl.lang = ? left join oauth_password_policy opp on (opp.organization_id = ir.h_tenant_id) where ir.is_enabled = 1 and ( ir.id in ( select imr.role_id from iam_member_role imr where imr.member_type = ‘user’ and imr.member_id = ? and (imr.start_date_active IS NULL OR imr.start_date_active <= ?) and (imr.end_date_active IS NULL OR imr.end_date_active >= ?) ) or ir.id in ( ( ? , ? ) ) ) order by ir.h_tenant_id, ir.id) tmp_count

Cause: java.sql.SQLException: Operand should contain 1 column(s)

; bad SQL grammar []; nested exception is java.sql.SQLException: Operand should contain 1 column(s)]

建议升级到1.5.4。问题已修复。