<?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.distribute.sub.UserDistributeSubMapper">


    <select id="getSubRelate" resultType="com.cyksj.model.entity.UserDistributeSub">
        select us.*
        from (select shared_id
              from user_distribute_shared
              where user_id = #{userId} limit 1) s
                 inner join user_distribute_sub us
                            on s.shared_id = us.sub_user_id
    </select>
</mapper>