<?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="org.jeecg.modules.adweb.enquiry.mapper.EnquiryEmailMessageMapper">

    <select id="getWaitSendEmail" resultType="org.jeecg.modules.adweb.enquiry.entity.EnquiryEmailMessage">
        SELECT
            *
        FROM
            adweb_enquiry_email_message
        WHERE
            send_status = 'WAIT_SEND'
            AND
            (
                send_error_num >= 1
                OR (send_error_num = 0 AND create_time &lt; DATE_SUB(NOW(), INTERVAL #{timeout} MINUTE))
            )
        LIMIT #{num}
    </select>
</mapper>
