<?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.hzs.report.member.mapper.CuMemberPerkDetailMemberMapper">

    <!-- 查询明细会员列表 -->
    <select id="queryMemberList" resultType="com.hzs.common.domain.report.member.ext.CuMemberPerkDetailMemberExt">
        select distinct cmpdm.pk_member_perk,
                        cmpdm.pk_member_perk_detail,
                        cmpdm.distinct_pk_member,
                        cm.member_code,
                        cm.member_name,
                        bv.vertex_name,
                        cmt.team_name
        from cu_member_perk_detail_member cmpdm
                 inner join cu_member cm
                            on cm.pk_id = cmpdm.distinct_pk_member
                 left join bd_vertex bv
                           on bv.pk_id = cm.pk_vertex
                 left join cu_member_team cmt
                           on cmt.pk_id = cm.pk_id
        where cmpdm.pk_member_perk = #{pkMemberPerk}
        order by cm.member_code
    </select>

</mapper>
