<?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.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper">


	


<!-- 批量新增销售线索额度信息-->
	<insert id="replaceSaleQuotaInfoBatch">
		replace into sale_quota_info(

		seller_id,
		nearly_thirty_days,
		gmv_month,
		gmv,
		mtd_date,
		mtd,
		create_user_id,
		create_time)
		values
		<foreach collection="saleQuotaList" item="info" separator=",">
			(
			#{info.sellerId},
			#{info.nearlyThirtyDays},
			#{info.gmvMonth},
			#{info.gmv},
			#{info.mtdDate},
			#{info.mtd},
			#{info.createUserId},
			NOW()
			)
		</foreach>
	</insert>


	<!-- 根据卖家id查看最新额度 -->
	<select id="getSaleQuotaInfoBySellerId" resultType="com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo">
		SELECT
			q.id,
			q.nearly_thirty_days,
			q.gmv_month,
			q.gmv,
			q.mtd_date,
			q.mtd,
			q.create_time
		FROM
			sale_quota_info q
		WHERE
			q.seller_id = #{sellerId}
		ORDER BY
			q.create_time DESC
			LIMIT 1
	</select>



</mapper> 