<?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.cool.store.mapper.TransferLogMapper">
    <resultMap id="BaseResultMap" type="com.cool.store.entity.TransferLogDO">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="line_id" jdbcType="BIGINT" property="lineId"/>
        <result column="partner_id" jdbcType="BIGINT" property="partnerId"/>
        <result column="from_user_id" jdbcType="VARCHAR" property="fromUserId"/>
        <result column="to_user_id" jdbcType="VARCHAR" property="toUserId"/>
        <result column="type" jdbcType="TINYINT" property="type"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
        <result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
        <result column="line_shop_type" jdbcType="TINYINT" property="lineShopType"/>
    </resultMap>


    <select id="getTransferLogList" resultType="com.cool.store.dto.TransferLogDTO">
        select b.user_id as fromUserId,
               b.name    as fromUserName,
               b.mobile  as fromUserMobile,
               c.user_id as toUserId,
               c.name    as toUserName,
               c.mobile  as toUserMobile,
               a.type    as type,
               a.line_shop_type as lineShopType
        from xfsg_transfer_log a
                 left join enterprise_user_${enterpriseId} b on b.user_id = a.from_user_id
                 left join enterprise_user_${enterpriseId} c on c.user_id = a.to_user_id
        where a.line_id = #{lindId} and a.line_shop_type = #{lineShopType}
    </select>

</mapper>