<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.cyksj.mapper.manage.cms.CmsUserMapper">

    <select id="getCmsUserDetailByUserId" resultType="com.cyksj.model.views.CmsUserVO">
        select any_value(u.nickname) as nickname,
               group_concat(r.role_name) as roleNames
        from `cms_user` u
                 inner join `cms_user_role` ur on u.id = ur.user_id
                 inner join `cms_role` r on r.id = ur.role_id
        where u.id = #{userId}
        group by u.id
    </select>
</mapper>