<?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="cn.pluss.platform.mapper.SubMerchantMapper">

    <resultMap id="BaseResultMap" type="cn.pluss.platform.entity.SubMerchant" autoMapping="true">
    </resultMap>

    <resultMap id="VO" type="cn.pluss.platform.vo.SubMerchantVO" autoMapping="true">
    </resultMap>

    <select id="pageVO" resultType="cn.pluss.platform.vo.SubMerchantVO">
        SELECT sm.id
             , sm.merchantId
             , sm.channelId
             , sm.subMchId
             , sm.subMchType
             , sm.remark
             , sm.channelTypeId
             , sm.status
             , sm.createTime
             , sm.updateTime
             , mbi.merchantCode
             , mbi.userId
             , ui.loginName
             , ua.userName
        FROM tb_pluss_sub_merchant sm
                 LEFT JOIN tb_pluss_merchant_channel_status mcs ON mcs.merchantId = sm.merchantId
                 LEFT JOIN tb_pluss_merchant_base_info mbi ON mbi.merchantCode = mcs.merchantCode
                 LEFT JOIN tb_pluss_user_info ui ON ui.id = mbi.userId
                 LEFT JOIN tb_pluss_user_app ua ON ua.userId = mbi.userId
        ${ew.customSqlSegment}
    </select>


</mapper>