<?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.zm.order.tool.server.hint.HintOrderPushLogsDao">
    <resultMap id="ResultMap" type="com.zm.order.tool.server.model.OrderPushLogs">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="user_id" jdbcType="BIGINT" property="userId"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
        <result column="scene" jdbcType="INTEGER" property="scene"/>
        <result column="push_at" jdbcType="TIMESTAMP" property="pushAt"/>
        <result column="features" jdbcType="VARCHAR" property="features"/>
        <result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
        <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt"/>
        <result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
    </resultMap>

    <sql id="tb">
        order_push_logs
    </sql>

    <sql id="cols_all">
        id,
		user_id,
		order_no,
		scene,
		push_at,
		features,
		created_at,
		updated_at,
		is_deleted
    </sql>

    <sql id="values">
    	#{id,jdbcType=BIGINT},
		#{userId,jdbcType=BIGINT},
		#{orderNo,jdbcType=VARCHAR},
		#{scene,jdbcType=INTEGER},
		#{pushAt,jdbcType=TIMESTAMP},
		#{features,jdbcType=VARCHAR},
		now(),
		now(),
		0
    </sql>

    <delete id="deleteListSize" parameterType="map">
        delete
        from
        <include refid="tb"/>
        <where>
            <![CDATA[ AND updated_at <= #{updatedAtEnd} ]]>
        </where>
        limit ${size}
    </delete>

</mapper>