<?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.czg.service.account.mapper.ShopShareRecordMapper">

    <select id="getRecord" resultType="com.czg.account.vo.ShopShareRecordVO">
        SELECT *
        FROM `tb_shop_share_record` as a
                 left join tb_shop_user as b on a.shop_id = b.shop_id and b.user_id = a.invited_id
                 left join tb_shop_user as c on a.shop_id = c.shop_id and c.user_id = a.be_invited_id
        where a.shop_id=#{shopId}
        <if test="key != null and key != ''">
            and (b.nick_name like concat('%', #{key}, '%') or c.nick_name like concat('%', #{key}, '%') or b.phone like concat('%', #{key}, '%') or c.phone like concat('%', #{key}, '%'))
        </if>
        <if test="status != null and status != ''">
            and a.status=#{status}
        </if>

    </select>
</mapper>
