Lius
昨天 92432fc3105ed80a8cc75e0d047692f851944eff
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserRoleMapper.xml
@@ -15,4 +15,30 @@
      where t2.id is not null
      )
   </select>
    <select id="queryRoleNamesByUserIds" resultType="org.jeecg.modules.system.vo.SysUserRoleExitVo">
      SELECT
         t1.username,
         ISNULL(
               STUFF(
                     (
                        SELECT ',' + t3.role_name
                        FROM sys_user_role t2
                               INNER JOIN sys_role t3 ON t2.role_id = t3.id
                        WHERE t2.user_id = t1.id
                        FOR XML PATH(''), TYPE
                     ).value('.', 'NVARCHAR(MAX)'), 1, 1, ''
               ), ''
         ) AS roleNames
      FROM sys_user t1
      <where>
         <if test="userIds!=null  and userIds.size()>0">
            AND t1.id IN
            <foreach collection="userIds" index="index" item="userId" open="(" separator="," close=")">
               #{userId}
            </foreach>
         </if>
      </where>
      GROUP BY t1.username, t1.id
   </select>
</mapper>