<?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.yunzhi.marketing.xlk.mapper.InstitutionMapper">

    <select id="getAllByUser" resultType="com.yunzhi.marketing.xlk.entity.Institution">
        SELECT
            m.*
        FROM
            xlk_user_institution t
                INNER JOIN xlk_institution s ON t.institution_id = s.institution_id
                INNER JOIN xlk_institution m ON m.institution_code LIKE CONCAT( s.institution_code, '%' )
        WHERE
            t.user_id = #{userId}
        ORDER BY
            m.institution_code * 1 ASC
    </select>
</mapper>
