SELECT 
	DISTINCT ru.id ruid,
	ru.roleid,
	ru.userid,
	r.rolecode,
	r.rolename,
	r.self_roleweight_code,
	r.visible_roleweight_code
FROM 
	t_s_role_user ru, t_s_role r
WHERE ru.roleid=r.id 
	AND ru.userid IN (
	SELECT 
		DISTINCT uo.user_id 
	FROM 
		t_s_user_org uo
	WHERE 
		1=1
		<#if ( departidList )?? && departidList ?size gt 0>
			AND uo.org_id IN(
				<#list departidList as item>
					'${item}'
			 		<#if item_has_next>,</#if>
				</#list>
			)
		</#if>
)
ORDER BY ru.userid ASC