<?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.market.task.UserBindDetailMapper">

    <select id="selectPhones" resultType="java.lang.String">
        select s.phone
        from (select id as user_id, login_phone as phone
              from `user`
              where login_phone != ''
              union all
              select user_id, phone
              from `user_bind_detail`
              where phone != '') s
                 left join order_don od on od.user_id = s.user_id and od.status not in ('close', 'noPayment', 'refund')
            and od.relation_id = 0 and od.created_time > '2023-06-06 00:00:00'
        where od.id is null
        order by s.user_id
            limit #{filter}, 10000
    </select>
</mapper>